Hi,
Im new to this program but familiar with VBScript. I want to build a macro that will 1) prompt the user as to how many times to run the loop and 2)request input on each occurance of the loop.
This macro will basically ask how many orders there are, then ask for each order number one by one, followed by some keystrokes. The purpose is to increase the speed of a very monotonous task.
I can't seem to get the looping part to work. Here is my code thus far:
VBSTART
Function GetName
GetName = InputBox("How many picking lists do you want to pick : ")
End Function
VBEND
VBEval>GetName,name
MessageModal>You want to pick this many picking lists : %name%
For x = 1 to %name%
PList = InputBox("Scan Picking List : ")
Press Tab
Press Tab
Press Tab
Press Tab
Send Character/Text>%PList%
Press Enter
Next
Thanks for anyone's help!
Looping
Moderators: JRL, Dorian (MJT support)
This code will do it:
Input>NumLists,Enter number of picking lists required
Let>k=0
Repeat>k
Let>k=k+1
SetFocus>some_window_title
Press Tab
Press Tab
Press Tab
Press Tab
Send Character/Text>%PList%
Press Enter
Until>k=NumLists
You MUST have a SetFocus line or the Press Tabs and Sends will land on whatever last had the focus - which in this case will be Macro Scheduler due to the Input box. Modify the SetFocus line to have it focus the application you are automating.
Please read the Scripting Windows for Beginners guide in the help file to get you started with writing scripts in Macro Scheduler. It will all become much clearer
Input>NumLists,Enter number of picking lists required
Let>k=0
Repeat>k
Let>k=k+1
SetFocus>some_window_title
Press Tab
Press Tab
Press Tab
Press Tab
Send Character/Text>%PList%
Press Enter
Until>k=NumLists
You MUST have a SetFocus line or the Press Tabs and Sends will land on whatever last had the focus - which in this case will be Macro Scheduler due to the Input box. Modify the SetFocus line to have it focus the application you are automating.
Please read the Scripting Windows for Beginners guide in the help file to get you started with writing scripts in Macro Scheduler. It will all become much clearer

MJT Net Support
[email protected]
[email protected]
Almost there
Hi, Thanks for the snippet. I added the second prompt (to request the individual picking list). The only problem I'm having now is that it doesn't focus to the input box on each loop. How do I do that?
Input>NumLists,Enter number of picking lists required
Let>k=0
Repeat>k
Let>k=k+1
Input>PList,Scan picking list
SetFocus>Microsoft Business Solutions-Axapta - Calculated Industries [CIAXPROD - AXDB]
Press CTRL
Send Character/Text>f
Release CTRL
Send Character/Text>%PList%
Press Enter
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Until>k=NumLists
Input>NumLists,Enter number of picking lists required
Let>k=0
Repeat>k
Let>k=k+1
Input>PList,Scan picking list
SetFocus>Microsoft Business Solutions-Axapta - Calculated Industries [CIAXPROD - AXDB]
Press CTRL
Send Character/Text>f
Release CTRL
Send Character/Text>%PList%
Press Enter
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Press Tab
Until>k=NumLists