AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hotkey to Execute to other Hotkeys

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
rlsaj



Joined: 22 Aug 2008
Posts: 8

PostPosted: Fri Mar 05, 2010 12:24 am    Post subject: Hotkey to Execute to other Hotkeys Reply with quote

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
View user's profile Send private message
jl34567



Joined: 03 Jan 2010
Posts: 262

PostPosted: Fri Mar 05, 2010 12:34 am    Post subject: Reply with quote

Do you want them doen simultaneously or one after the other?

Some code would help.
Back to top
View user's profile Send private message AIM Address
entropic



Joined: 21 Dec 2008
Posts: 181

PostPosted: Fri Mar 05, 2010 12:41 am    Post subject: Reply with quote

Does this work for you?

Code:


^!+<::
LabelA:
Msgbox A
Return

^!+>::
LabelB:
Msgbox B
Return

^!+a::
GoSub, LabelA
GoSub, LabelB
Return
Back to top
View user's profile Send private message
rlsaj



Joined: 22 Aug 2008
Posts: 8

PostPosted: Fri Mar 05, 2010 12:41 am    Post subject: Reply with quote

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
View user's profile Send private message
entropic



Joined: 21 Dec 2008
Posts: 181

PostPosted: Fri Mar 05, 2010 12:44 am    Post subject: Reply with quote

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
View user's profile Send private message
rlsaj



Joined: 22 Aug 2008
Posts: 8

PostPosted: Fri Mar 05, 2010 12:51 am    Post subject: Reply with quote

There must be something integral here that I'm not understanding, why must i have a message box in my script?
Back to top
View user's profile Send private message
rlsaj



Joined: 22 Aug 2008
Posts: 8

PostPosted: Fri Mar 05, 2010 12:54 am    Post subject: Reply with quote

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
View user's profile Send private message
entropic



Joined: 21 Dec 2008
Posts: 181

PostPosted: Fri Mar 05, 2010 1:46 am    Post subject: Reply with quote

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
View user's profile Send private message
rlsaj



Joined: 22 Aug 2008
Posts: 8

PostPosted: Fri Mar 05, 2010 1:56 am    Post subject: Reply with quote

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
View user's profile Send private message
entropic



Joined: 21 Dec 2008
Posts: 181

PostPosted: Fri Mar 05, 2010 2:11 am    Post subject: Reply with quote

No problem, to get F5 to work try this:
Code:

SendInput {F5}
Back to top
View user's profile Send private message
rlsaj



Joined: 22 Aug 2008
Posts: 8

PostPosted: Fri Mar 05, 2010 2:16 am    Post subject: Reply with quote

Just got that about 5 seconds before I read your post! I guess RTFM can help Smile

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group