First, thank you for any possible help you can offer.
I am the IT guy for a small mfg company. We use some ERP software to keep track of what jobs are on the floor at any given time as well as track the costs associated with them. The software requests an MRP regeneration be run every night (basically forcing a refresh of all costs, within the system). There is a built-in menu function for this process (Alt+f, q) I have created the below script which is fully successful with an active user session. But, as I want this to run at 0100 every day, the server on which it resides is either locked or logged out.
I have read the FAQ about replacing Send() with ControlSend() or ControlCommand(), but the menu's for the software are apparently not Controls as these fail when I attempt to implement them. I found a command on the forums to generate a list of controls, but found nothing that I can send to (most listed as "button").
Here is the code that I am using:
AutoItSetOption ("TrayIconDebug", 1);0-off
; Start the Material Planning Window and login as the SYSADM user
Run("C:\Infor\VISUAL Enterprise\VISUAL Manufacturing\VMPLNWIN.EXE -d <DB> -u <USER> -p <PASSWORD>")
WinWait("Material Planning Window - Infor ERP VE - [Material Planning Window]")
; Send ALT+F and then Q to open the MRP Window
Send("!f")
Send("q")
WinWait("VISUAL MRP(tm) - Material Requirements Planning")
;WinActivate("VISUAL MRP(tm) - Material Requirements Planning")
; Send a left-click to the approriate Radio button
ControlClick("VISUAL MRP(tm) - Material Requirements Planning", "", "[CLASS:Gupta:GPRadio; TEXT:Process all top level parts (regeneration); ID:4105]")
; Send ALT+O for the OK button to start the Regen and wait for the Regen window to close
Send("!o")
WinWaitClose("VISUAL MRP(tm) - Material Requirements Planning")
; Sleep, just because MRP Regen is closed, MPW may not be ready to close yet.
Sleep(30000)
; Close the Material Planning Window
;WinActivate("Material Planning Window - Infor ERP VE - [Material Planning Window]")
Sleep(60000)
Send("!f")
Send("x")
WinKill("Material Planning Window - Infor ERP VE - [Material Planning Window]")
WinWaitClose("Material Planning Window - Infor ERP VE - [Material Planning Window]")
Exit
Is there a way to emulate a user login or to maintain a login with stubborn programs like this? Would the FAQ section on setting the script as a service help?
I appreciate any help or direction you can give me with this project.