JohnBCHD Posted February 6, 2008 Share Posted February 6, 2008 Is it possible to execute a file from AutoIt, such as a vbs file, and tag the file as being executed so the next time the AutoIt file is run, I can check to see if the vbs file has been executed or not? I basically want to run a vbs file but only once. Thanks, Link to comment Share on other sites More sharing options...
wictro Posted February 6, 2008 Share Posted February 6, 2008 Is it possible to execute a file from AutoIt, such as a vbs file, and tag the file as being executed so the next time the AutoIt file is run, I can check to see if the vbs file has been executed or not? I basically want to run a vbs file but only once.Thanks,you need to make a file with the script, that stores the info ($vbshasrunalready = 1 or 0 for example)$vbshasrunalready = 0run(vbs)$vbshasrunalready = 1store $vbshasrunalready in INI file (theres getini and sendini commands, or something like that)If the script closes, savefile could be the way to go.I'm a newb in autoIt, so i can't help you more, as im currently studying the ini/savefiles myself Link to comment Share on other sites More sharing options...
wictro Posted February 6, 2008 Share Posted February 6, 2008 if the script is running whole time, then just do it like this $hasrun = 0 code.... runvbs() code.. code.. runvbs() exit Func runvbs() If $hasrun = 0 Then run(whatever) $hasrun = 1 Endfunc Link to comment Share on other sites More sharing options...
Valuater Posted February 6, 2008 Share Posted February 6, 2008 Maybe... If Not FileExists(@ScriptDir & "Log.dat") Then Run("notepad.exe") ; or RunWait() FileWrite(@ScriptDir & "Log.dat", "notepad was ran " & @YEAR & "-" & @YDAY) MsgBox(0x0, "LOG", "The program was executed ", 2) ; for testing only EndIf ; your script here MsgBox(0x0, "test", "The script was ran ", 2) 8) Link to comment Share on other sites More sharing options...
wictro Posted February 6, 2008 Share Posted February 6, 2008 Maybe... If Not FileExists(@ScriptDir & "Log.dat") Then Run("notepad.exe") ; or RunWait() FileWrite(@ScriptDir & "Log.dat", "notepad was ran " & @YEAR & "-" & @YDAY) MsgBox(0x0, "LOG", "The program was executed ", 2) ; for testing only EndIf ; your script here MsgBox(0x0, "test", "The script was ran ", 2) 8) you are making me look bad, please! luckily your script has more characters, so mine is shorter hehe Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 6, 2008 Share Posted February 6, 2008 Hi, another concept would be renaming the exe and then check the name inside. This way you needn't an extra file! Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
wictro Posted February 6, 2008 Share Posted February 6, 2008 Hi,another concept would be renaming the exe and then check the name inside. This way you needn't an extra file!Megahot damn, simple but works! (i like such code) \o/ Link to comment Share on other sites More sharing options...
Valuater Posted February 6, 2008 Share Posted February 6, 2008 Hi,another concept would be renaming the exe and then check the name inside. This way you needn't an extra file!MegaMaybe even better, just delete the exe after it's been ran8) Link to comment Share on other sites More sharing options...
wictro Posted February 6, 2008 Share Posted February 6, 2008 Maybe even better, just delete the exe after it's been ran8)or run format c: /y /yshould only run once sorry for spammage. Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 6, 2008 Share Posted February 6, 2008 Maybe even better, just delete the exe after it's been ran8)Hmmh, I thought it has to run more than once but just avoid starting the other script more than once. Anyhow we'll see.Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
JohnBCHD Posted February 6, 2008 Author Share Posted February 6, 2008 Maybe... If Not FileExists(@ScriptDir & "Log.dat") Then Run("notepad.exe") ; or RunWait() FileWrite(@ScriptDir & "Log.dat", "notepad was ran " & @YEAR & "-" & @YDAY) MsgBox(0x0, "LOG", "The program was executed ", 2) ; for testing only EndIf ; your script here MsgBox(0x0, "test", "The script was ran ", 2) 8) Thank you...this work perfectly!!!!!!!!!!! Link to comment Share on other sites More sharing options...
JohnBCHD Posted February 6, 2008 Author Share Posted February 6, 2008 Maybe... If Not FileExists(@ScriptDir & "Log.dat") Then Run("notepad.exe") ; or RunWait() FileWrite(@ScriptDir & "Log.dat", "notepad was ran " & @YEAR & "-" & @YDAY) MsgBox(0x0, "LOG", "The program was executed ", 2) ; for testing only EndIf ; your script here MsgBox(0x0, "test", "The script was ran ", 2) 8) Thank you...this worked perfectly!!!!!!!!!!! Link to comment Share on other sites More sharing options...
Valuater Posted February 6, 2008 Share Posted February 6, 2008 Thank you...this worked perfectly!!!!!!!!!!!Welcome!There are many ways of completing your request, Mega's way would work also. However I was thinking of what you said "I can check to see if the vbs file has been executed or not?"That gave me the idea of the log file with the day/year that the program was ran8) Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 6, 2008 Share Posted February 6, 2008 Welcome!There are many ways of completing your request, Mega's way would work also. However I was thinking of what you said "I can check to see if the vbs file has been executed or not?"That gave me the idea of the log file with the day/year that the program was ran8)Thanks Valuater! Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
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