AutoHotkey Community

It is currently May 27th, 2012, 4:22 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: February 22nd, 2010, 5:20 pm 
Offline

Joined: September 13th, 2007, 8:59 pm
Posts: 23
Location: Haiti
Code:
#InstallKeybdHook
b:: send XYZ
c:: sendRaw ab
d:: send {raw}ab
e:: sendPlay {raw}ab

hit 'c' or 'd', get 'aXYZ'; why not 'ab'? If SendRaw does not do that, what does? In other words, how to output a char 'as is' without having it reinterpreted through hotkeys?
hitting 'e' does nothing; why?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 5:23 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Use the $ modifier.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 7:01 pm 
Offline

Joined: September 13th, 2007, 8:59 pm
Posts: 23
Location: Haiti
Thank you! However, I ran into some weird behaviour:

Code:
SetKeyDelay 800 ; to ensure sent keys don't get jumbled
a:: send UVW
$b:: send XYZ
c:: send ab
d:: sendInput ab
e:: send ba

hitting e gives bUVW --OK; but so does hitting c or d!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 7:53 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
If you read the link Titan provided it will tell you what the $ prefix is for:

Code:
SetKeyDelay 800 ; to ensure sent keys don't get jumbled
a:: send UVW
b:: send XYZ
$c:: send ab ; prevents it from executing 'a' or 'b' as hotkeys
$d:: sendInput ab ; prevents it from executing 'a' or 'b' as hotkeys
$e:: send ba ; prevents it from executing 'b' or 'a' as hotkeys

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 22nd, 2010, 9:53 pm 
Offline

Joined: September 13th, 2007, 8:59 pm
Posts: 23
Location: Haiti
Not true. I tried it:
Hit a, get UVW
Hit b, get XYZ
Hit c, get UVWXYZ not ab
Hit d, get UVWXYZ not ab
And you don't explain why, in the script I used, hitting 'c' or 'd' gives 'bUVW' instead of the expected 'UVWb'


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 9:57 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Are you using the most recent version of AutoHotkey? I tested that script before I posted it so I know that it works.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: version number
PostPosted: February 22nd, 2010, 10:20 pm 
Offline

Joined: September 13th, 2007, 8:59 pm
Posts: 23
Location: Haiti
Where to find the version number?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 10:24 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Hover your mouse over the exe file itself, it should bring up a tooltip with the file version.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: AHK version
PostPosted: February 23rd, 2010, 2:39 pm 
Offline

Joined: September 13th, 2007, 8:59 pm
Posts: 23
Location: Haiti
sinkfaze wrote:
Hover your mouse over the exe file itself, it should bring up a tooltip with the file version.

OK: 1.0.48.5


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2010, 4:38 pm 
sinkfaze wrote:
I tested that script before I posted it so I know that it works.

...I tested your script & I got the same behavior as TAB4217, the wrong behavior...this works tho...

Code:
SetKeyDelay, 119 ;//to ensure sent keys don't get jumbled...omg 800 was too slow during testing!!!
$a::Send, UVW
$b::Send, XYZ
c::Send, ab
d::SendInput, ab
e::Send, ba

...this works too...

Code:
;//#InstallKeybdHook
#UseHook
SetKeyDelay, 119 ;//to ensure sent keys don't get jumbled...omg 800 was too slow during testing!!!
a::Send, UVW
b::Send, XYZ
c::Send, ab
d::SendInput, ab
e::Send, ba

...you must enable the hook on the Hotkeys you don't want simulatable (simulatable?), in this case you want to send a & b & not have them re-simulated as the other keys, so at a minimum enable hook ($ prefix) on a & b...or #UseHook on all keys so you don't have to worry about which ones to $ later...


Report this post
Top
  
Reply with quote  
 Post subject: inverted sends
PostPosted: February 24th, 2010, 3:05 pm 
Offline

Joined: September 13th, 2007, 8:59 pm
Posts: 23
Location: Haiti
Anonymous wrote:
Code:
#UseHook
SetKeyDelay, 119 ;//to ensure sent keys don't get jumbled
a::Send, UVW
b::Send, XYZ
c::Send, ab
d::SendInput, ab
e::Send, ba

...you must enable the hook on the Hotkeys you don't want simulatable (simulable?), in this case you want to send a & b & not have them re-simulated as the other keys, so at a minimum enable hook ($ prefix) on a & b...or #UseHook on all keys so you don't have to worry about which ones to $ later...

Yes! TY. Boy, is AHK complexe... and unintuitive!
Now, my other question:
Code:
SetKeyDelay 99 ; to ensure sent keys don't get jumbled
a:: send UVW
$b:: send XYZ
c:: send ab
d:: sendInput ab
e:: send ba
z:: sendPlay ab

hitting e gives bUVW --OK; but so does hitting c or d, which should give UVWb. Why?
And, why does hitting 'z' do nothing?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: inverted sends
PostPosted: February 24th, 2010, 3:38 pm 
You really don't need to quote so much of each post when replying...

TAB4217 wrote:
Boy, is AHK complexe... and unintuitive!

...complex, yes, but I think it's completely intuitive for Send, ab to give UVWXYZ when the simulated keys are stacked (SendRaw is not designed for this purpose)...

TAB4217 wrote:
Now, my other question:

...(z was not part of this other question before now)...but I believe it's a bug...or at least THIS is unintuitive...you must sleep between keys, not sure why...

Code:
SetKeyDelay, 119
a::Send, UVW
$b::Send, XYZ
c::Send("a{Sleep, 0}b")
d::Send("a{Sleep, 28}b", "Input")
e::Send, ba
z::SendPlay, ab

...Sleep, 0 is enough for c to work, Sleep, 28 works on my comp for SendInput (0 & 19 are not enough)...the above requires my Send() function...or broken down ugly code...

Code:
SetKeyDelay, 119
a::Send, UVW
$b::Send, XYZ
c::
Send, a
Sleep, 0
Send, b
return
d::
SendInput, a
Sleep, 28
SendInput, b
return
e::Send, ba
z::SendPlay, ab

...the z key works for me in notepad...(it sends ab)...


Report this post
Top
  
Reply with quote  
 Post subject: Re: inverted sends
PostPosted: February 24th, 2010, 5:00 pm 
Offline

Joined: September 13th, 2007, 8:59 pm
Posts: 23
Location: Haiti
Anonymous wrote:
it's completely intuitive for Send[...]

OK; I was referring to the effect of #UseHook.
Anonymous wrote:
...(z was not part of this other question before now)

It was 'e' in previous post --2010 Feb Mon 22, 11:20 am
Anonymous wrote:
Code:
SetKeyDelay, 119
a::Send, UVW
$b::Send, XYZ
c::Send("a{Sleep, 0}b")
d::Send("a{Sleep, 28}b", "Input")
e::Send, ba
z::SendPlay, ab

AHK did not recognize the 'function' Send; so, I removed the parentheses, and got:
c-> "b"UVW
d-> "b"UVW
The quotes being unwanted, I tried
Code:
c::Send a{Sleep, 0}b
d::Send a{Sleep, 28}b, "Input"

and obtained:
c-> bUVW
d-> b, "Input"UVW
I don't understand what ', "Input"' is supposed to do; so I removed it: both 'c' and 'd' yielded 'bUVW'. The mystery remains: why 'ab' reacts like 'ba'.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: inverted sends
PostPosted: February 24th, 2010, 5:19 pm 
TAB4217 wrote:
AHK did not recognize the 'function' Send

...narf!...I said...

Anonymous wrote:
...the above requires my Send() function...

...my Send() function allows "sleeping inside a send", which is why I used it...

TAB4217 wrote:
so, I removed the parentheses, and got:

...it don't matter what you got when you removed the parens, my Send() function is a function & needs parens...

TAB4217 wrote:
The mystery remains: why 'ab' reacts like 'ba'.

...my 2nd example DID NOT require my Send() function & DOES provide your wanted output...however, why sleeping between keys is necessary does remain a mystery tho...


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Mickers, rbrtryn and 65 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group