Nick3399 Posted October 28, 2022 Posted October 28, 2022 (edited) I have a script that has a GUI and I have been running with a start button using the below code: Case $StartButton I would also like to try scheduling this using Windows TaskScheduler to run every morning at 8 AM EST. What would be the best way to add a condition to either start with the start button OR when TaskScheduler runs at 8 AM EST (or any specific time)? I am hesitant to just do 8 AM condition as it may increase processing a lot always looking at the time. Essentially what I am looking to have happen is for my computer to auto-unlock (login?) using task scheduler and run this script Edited October 28, 2022 by Nick3399
Nine Posted October 28, 2022 Posted October 28, 2022 Just add a command line parameter when run from task scheduler. “They did not know it was impossible, so they did it” ― Mark Twain Want some cheese with your whine ? Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
Nick3399 Posted October 28, 2022 Author Posted October 28, 2022 1 hour ago, Nine said: Just add a command line parameter when run from task scheduler. How would I do that? Is there any documentation I can reference
Developers Jos Posted October 28, 2022 Developers Posted October 28, 2022 1 hour ago, Nick3399 said: How would I do that? Is there any documentation I can reference Google? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Nick3399 Posted October 28, 2022 Author Posted October 28, 2022 (edited) 1 hour ago, Jos said: Google? So would the Run Line in Task Manager be something along the lines of: "C:\Program Files\Documents\MYFILE.EXE " & "/parm1=Value" and then in my code Case $StartButton OR $CmdLine[0]= "parm1" The documentation is quite confusing for this and I am not really understanding Edited October 28, 2022 by Nick3399
Nine Posted October 28, 2022 Posted October 28, 2022 You need to use $CmdLine[0] and $CmdLine[1]. See here. You probably need to start it once. So insert the statement before the GUI loop, something like : .... If $CmdLine[0] and $CmdLine[1] = "Start" then StartFunction() GuiSetState() While True ... WEnd Making a runable script would greatly help us to help you. For the next topic please provide an example script so we can adapt it more easily... “They did not know it was impossible, so they did it” ― Mark Twain Want some cheese with your whine ? Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
Nick3399 Posted October 28, 2022 Author Posted October 28, 2022 2 minutes ago, Nine said: You need to use $CmdLine[0] and $CmdLine[1]. See here. You probably need to start it once. So insert the statement before the GUI loop, something like : .... If $CmdLine[0] and $CmdLine[1] = "Start" then StartFunction() GuiSetState() While True ... WEnd Making a runable script would greatly help us to help you. For the next topic please provide an example script so we can adapt it more easily... I just updated my last posts code - can you tell me if that is now correct?
Nine Posted October 28, 2022 Posted October 28, 2022 6 minutes ago, Nick3399 said: can you tell me if that is now correct? No it is not correct. Please provide a runable script with basic statements so we can help you. I will not repeat this request another time. “They did not know it was impossible, so they did it” ― Mark Twain Want some cheese with your whine ? Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy
Nick3399 Posted October 28, 2022 Author Posted October 28, 2022 (edited) 18 hours ago, Nine said: No it is not correct. Please provide a runable script with basic statements so we can help you. I will not repeat this request another time. FilePath is: C:\Users\robert\OneDrive\Desktop\TempFile.exe Block of relevant code is below: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Save SaveOptions() Case $StartButton ;TAB1 of GUI If WinExists("[CLASS:QT373947473845]") Then $oBlah = WinGetHandle("[CLASS:QT373947473845]") $BSLoc = WinGetPos ("[CLASS:QT373947473845]") If $BSLoc[0] <> 0 or $BSLoc[1] <> 0 or $BSLoc[2] <> 800 or $BSLoc[3] <> 600 Then WinSetState ( $oBlah, "", @SW_MINIMIZE ) sleep(500) WinActivate($oBlah) WinWaitActive($oBlah) WinMove($oBlah, "", 0, 0, 800, 600) sleep(2000) Else WinActivate($oBlah) WinWaitActive($oBlah) sleep(2000) EndIf Endif EndSwitch WEnd The Case $StartButton is the line where I am trying to do an OR if run by TaskManager Edited October 29, 2022 by Nick3399
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now