| View previous topic :: View next topic |
| Author |
Message |
space23810 Guest
|
Posted: Sat Feb 18, 2006 7:33 am Post subject: TAB as a variable? (Newbie) |
|
|
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
|
Posted: Sat Feb 18, 2006 8:25 am Post subject: |
|
|
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 |
|
 |
Maelgwyn
Joined: 13 Jan 2006 Posts: 36 Location: Brisbane, Australia
|
Posted: Sat Feb 18, 2006 8:26 am Post subject: |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sat Feb 18, 2006 12:27 pm Post subject: |
|
|
@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 |
|
 |
space238
Joined: 18 Feb 2006 Posts: 3
|
Posted: Mon Feb 20, 2006 6:30 am Post subject: |
|
|
| Thanks guys. My script works now. |
|
| Back to top |
|
 |
|