 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sergio
Joined: 16 Mar 2008 Posts: 25 Location: Brooklyn
|
Posted: Thu May 15, 2008 10:57 pm Post subject: Innefficient code - any ideas? |
|
|
I use AHK to create shipping labels. So imagine an MS office file where I create a table, then it inputs first address -TAB- inputs second address -TAB- inputs first address again -TAB- second address -TAB- first note -TAB- second note. The pattern is a very clear 1, 2, 1, 2, 1, 2.
Then the process starts again exactly the same way 3, 4, 3, 4, 3, 4, and on and on it goes. Does anyone know how I can create a loop to do this for me?
| Code: | Send, %varShippingAddress1%{TAB}
Sleep, 50
Send, %varShippingAddress2%{TAB}
Sleep, 50
Send, %varShippingAddress1%{TAB}
Sleep, 50
Send, %varShippingAddress2%{TAB}
Sleep, 50
Send, %varItemTitle1%-%varNoteBox1%{ENTER}{TAB}
Sleep, 50
Send, %varItemTitle2%-%varNoteBox2%{ENTER} |
_________________
 |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1132
|
Posted: Fri May 16, 2008 2:51 am Post subject: |
|
|
something like this?
| Code: | Sendmode, play
VSA := "varShippingAddress"
VIT := "varItemTitle"
VNB := "varNoteBox"
Loop % NumberOfAddresses
{
If (Mod(A_Index, 2) = 0)
continue
B_Index := A_Index+1
Send, % %VSA%%A_Index% "{TAB}"
Sleep, 50
Send, % %VSA%%B_Index% "{TAB}"
Sleep, 50
Send, % %VSA%%A_Index% "{TAB}"
Sleep, 50
Send, % %VSA%%B_Index% "{TAB}"
Sleep, 50
Send, % %VIT%%A_Index% "-" %VNB%%A_Index% "{ENTER}{TAB}"
Sleep, 50
Send, % %VIT%%B_Index% "-" %VNB%%B_Index% "{ENTER}"
Sleep, 250
} |
_________________ My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|