| View previous topic :: View next topic |
| Author |
Message |
rlsaj
Joined: 22 Aug 2008 Posts: 8
|
Posted: Fri Mar 05, 2010 12:24 am Post subject: Hotkey to Execute to other Hotkeys |
|
|
I have a shortcut key (ctrl-alt-shift+<) that performs an action
I have another shortcut key (ctrl-alt-shift+>) that performs another action.
I want these actions to be performed at the same time, so I want both shortcuts to be executed when I press ctrl-alt-shift+a, so I want something like:
^+!A::^+!<, ^+!<
but obviously that's wrong... Any help? |
|
| Back to top |
|
 |
jl34567
Joined: 03 Jan 2010 Posts: 262
|
Posted: Fri Mar 05, 2010 12:34 am Post subject: |
|
|
Do you want them doen simultaneously or one after the other?
Some code would help. |
|
| Back to top |
|
 |
entropic
Joined: 21 Dec 2008 Posts: 181
|
Posted: Fri Mar 05, 2010 12:41 am Post subject: |
|
|
Does this work for you?
| Code: |
^!+<::
LabelA:
Msgbox A
Return
^!+>::
LabelB:
Msgbox B
Return
^!+a::
GoSub, LabelA
GoSub, LabelB
Return
|
|
|
| Back to top |
|
 |
rlsaj
Joined: 22 Aug 2008 Posts: 8
|
Posted: Fri Mar 05, 2010 12:41 am Post subject: |
|
|
One after the other, I'm not sure what you mean by 'some code would help'.
This is why I need it:
I use Firefox as my browser and with Adblock Plus (hides ads/regions I specify) + Stylish (a Firefox extension for user stylesheets), so this means that some websites look completely different when I view them and this is great.
There are times however, when I want them to look default so I want to disable Adblock (Ctrl-alt-shift+>) and Stylish (Ctrl-Alt-Shift+<) at the same time. Now I want to press a single shortcut key combination rather than the two that I currently have. |
|
| Back to top |
|
 |
entropic
Joined: 21 Dec 2008 Posts: 181
|
Posted: Fri Mar 05, 2010 12:44 am Post subject: |
|
|
There are a bunch of ways to structure it, here's another one:
| Code: |
!^+<::A()
!^+>::B()
!^+a::
A()
B()
Return
A()
{
Msgbox A
}
B()
{
Msgbox B
}
|
|
|
| Back to top |
|
 |
rlsaj
Joined: 22 Aug 2008 Posts: 8
|
Posted: Fri Mar 05, 2010 12:51 am Post subject: |
|
|
| There must be something integral here that I'm not understanding, why must i have a message box in my script? |
|
| Back to top |
|
 |
rlsaj
Joined: 22 Aug 2008 Posts: 8
|
Posted: Fri Mar 05, 2010 12:54 am Post subject: |
|
|
How about this, is there something fundamentally (or "not advised") about this method:
| Code: |
!^+a::
A()
B()
Return
A()
{
SendInput !^+<
}
B()
{
SendInput !^+>
}
|
It appears to do what I want.... |
|
| Back to top |
|
 |
entropic
Joined: 21 Dec 2008 Posts: 181
|
Posted: Fri Mar 05, 2010 1:46 am Post subject: |
|
|
I totally read your first post wrong, glad you got it figured out.
You may need to put a Sleep between the calls to A() and B() if you find the application can't keep up. |
|
| Back to top |
|
 |
rlsaj
Joined: 22 Aug 2008 Posts: 8
|
Posted: Fri Mar 05, 2010 1:56 am Post subject: |
|
|
Thanks entropic, a lot for your help - you pushed me in the right direction. I will use the Sleep if I note it can't keep up - which it may, but has not yet.
I'm having a difficult timing trying to use F5 (refresh).
Essentially, I want the 2 aforementioned keys to work and then the browser page to be refreshed (F5). Of course SendInput F5 actually sends the letters F and then 5...
Something tells me this should be a lot easier that what I thought about it. |
|
| Back to top |
|
 |
entropic
Joined: 21 Dec 2008 Posts: 181
|
Posted: Fri Mar 05, 2010 2:11 am Post subject: |
|
|
No problem, to get F5 to work try this:
|
|
| Back to top |
|
 |
rlsaj
Joined: 22 Aug 2008 Posts: 8
|
Posted: Fri Mar 05, 2010 2:16 am Post subject: |
|
|
Just got that about 5 seconds before I read your post! I guess RTFM can help
Now my complete script is the following, at what it does for my Firefox config is -
- disables Adblock Plus (ctrl+alt+shift+<)
- disables Stylish Styles (ctrl+alt+shift+>)
- refreshes the page (unfortunately I have to refresh to make some of the Adblock'ed stuff to be visible).
| Code: |
!^+a::
A()
B()
C()
Return
A()
{
SendInput !^+<
}
B()
{
SendInput !^+>
}
C()
{
Send {F5}
}
|
|
|
| Back to top |
|
 |
|