AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: June 22nd, 2011, 5:29 am 
Offline

Joined: June 3rd, 2011, 5:19 am
Posts: 9
Trying to set a series of #ifwinactives for a password manager. I got the code working well for all except the last entry which, because the site is stupid, requires a sleep between uid and pwd. When I run it, the log shows that it is sending the uid and pwd, but the site is getting the "uid{tab}" and then just sitting there... Is this my script? or something else?

Code:
#IfWinActive website
^space:: sendinput uid{tab}
sleep 1000
sendinput pw{enter}
#IfWinActive


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2011, 9:55 am 
Offline

Joined: May 29th, 2011, 3:06 am
Posts: 85
If the hotkey is being triggered ok, then it's not related to IfWinActive as all that effects is what windows hotkeys are active for.

Perhaps you need something like this.
Code:
uid := "Bob"
pw := "Jane"

#IfWinActive website
^space::
   sendinput %uid%{tab}
   sleep 1000
   sendinput %pw%{enter}
return
BTW, you'll need to make sure uid and pw are set in the auto-execution section at the top of the script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 22nd, 2011, 9:59 am 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
This isn't valid for a multiline hotkey, must start on a new line.
Code:
^space:: sendinput uid{tab}

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 23rd, 2011, 9:49 am 
Offline

Joined: June 3rd, 2011, 5:19 am
Posts: 9
Thanks a bunch guys, I didn't know I would have to start it on a new line and that was it! :shock:

For future reference, how do I know when to do this? I imagine it applies to a set of scenarios, is it in the documentation somewhere?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 24th, 2011, 7:09 am 
Offline

Joined: May 29th, 2011, 3:06 am
Posts: 85
Yeah, it's in the docs, under the Hotkeys part.

For hotkeys etc, they basically work in 2 modes:
  1. When there is code on the same line after the :
    It will run the code after the : and then return automatically at the end of the line, so anything below it is essentially ignored.
  2. When there is no code on the same line after the :
    It will run the line below and continue running until it the first 'return' it encounters.

So basically, if you only have 1 line to run, you can put it after the :, but if you need to run more than one line you need to put them all below the label/hotkey and also put a return so it knows when to stop.

There's also something similar for 'If (expression)' (in help) and similar statements where you can put one line underneath, or several using { and }. It can be a bit confusing at the start, hey. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2011, 5:57 am 
Offline

Joined: June 3rd, 2011, 5:19 am
Posts: 9
Thanks a ton! I've actually written and modified a lot of scripts at this point and I still never knew why things were or weren't done that way! :shock:


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, rbrtryn and 68 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