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 

TAB as a variable? (Newbie)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
space23810
Guest





PostPosted: Sat Feb 18, 2006 7:33 am    Post subject: TAB as a variable? (Newbie) Reply with quote

Hi.

I'm working on a script and I need the help of the experts. I searched the forums and could not come up with any helpful suggestions.

Below is part of the code I am using. Any help would be greatly appreciated.

Send, {TAB 15}{ENTER}
Sleep, 1000
Send, {TAB 2}{ENTER}
Sleep, 1000
Gosub, Save
Send, !G C{ENTER}
Sleep, 1000

The first time I need fifteen tabs the next time 17 tabs and keep going at least for 100 times. I know that I need a loop my problem is that I can't come up with a way to define the variable to loop.
Back to top
AgentSmith15



Joined: 06 May 2005
Posts: 37

PostPosted: Sat Feb 18, 2006 8:25 am    Post subject: Reply with quote

In your loop does the variable have the % signs around it?

Example

RepeatCount is the variable...
Code:
Loop {
   ...
}
Loop %RepeatCount% {
   ...
}














Also why is it at the Send/SendRaw reference examples don't have commas at the end of Send.


Last edited by AgentSmith15 on Sat Feb 18, 2006 10:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
Maelgwyn



Joined: 13 Jan 2006
Posts: 36
Location: Brisbane, Australia

PostPosted: Sat Feb 18, 2006 8:26 am    Post subject: Reply with quote

I'm hardly an expert but I'll do what I can.

Yes you do need a loop. To set one up is simple.

Code:


TabVar = 15      ;Sets a variable called tabvar to 15

Loop                 ;Starts your loop

{                      ;Anything between the braces is what is looped

Send, {TAB %TabVar%}    ;Sends 15 Tabs because TabVar = 15

Tabvar := Tabvar + 2                     ;Adds 2 to TabVar

}


You have probably noticed that I left out bits of your original code. I'm not exactly sure what they were doing so i just left them out. This script by itself Sends tab 15 times, then 17, then 19, etc...

Hope this works...

Maelgwyn
_________________
The rapidity of particle flow alone determines power: LRH
Back to top
View user's profile Send private message MSN Messenger
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Sat Feb 18, 2006 12:27 pm    Post subject: Reply with quote

@Maelgwyn: good.
But you loop infinitely...

@space23810: as AgentSmith15 pointed out, you can do:
Loop 100
or
Loop %loopNb%
You can also use A_Index inside a loop to get the current iteration number.

@AgentSmith15:
AHK's doc wrote:
Tip: You may have noticed from the other examples that the first comma of any command may be omitted.

_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
space238



Joined: 18 Feb 2006
Posts: 3

PostPosted: Mon Feb 20, 2006 6:30 am    Post subject: Reply with quote

Thanks guys. My script works now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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