Sign in to follow this  
Followers 0
goranga

hotkeysend !+^ modifiers and $vars

5 posts in this topic

Hi Ive been having trouble with a script Ive been writing and would appreciate any help.

I have been unable to set a get hotkeyset() to work with alt, ctrl or shift modifiers and keys defined in variables.

For example

Global $foo = "{f1}"

HotKeySet($foo, "_Bar")

works great, f1 press triggers the function _bar

However if I want to catch ALT + f1 the following does not work

Global $foo = "{f1}"

HotKeySet("!$foo", "_Bar")

I would like to keep the F1 hotkey in a $var so that it is tidy and easy to change down the road.

Thanks in advance :mellow:

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I was able to get it to work by defining $foo like this Global $foo = "!{F1}".

However, this works like you more intended,

Global $foo = "{F1}"
HotKeySet("{ALT}$foo", "_Bar")

EDIT: Well now I can't get it to work that way.. My eyes must've been screwin w/ me, I thought for sure it was working a minute ago..

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Yeah I couldn't get

HotKeySet("{ALT}$foo", "_Bar")

to work either :mellow:

Also for general code maintainability/adaptability id like to keep

Global $foo = {F1}

vs

Global $foo = "!{F1}"

Share this post


Link to post
Share on other sites

this works

Global $foo = "{F1}"

HotKeySet("!"&$foo, "_Bar")

while 1

Sleep(10)

wend

Func _Bar()

MsgBox(0,"","It Works!")

EndFunc


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

+10 post count to kaotkbliss!

Works perfectly, thanks again :mellow:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0