anyday Posted March 24, 2006 Share Posted March 24, 2006 is it possible to run a few commands at the start of the script only the first time the script is ruN? Link to comment Share on other sites More sharing options...
Nuffilein805 Posted March 24, 2006 Share Posted March 24, 2006 yes it is you just have to write a value somewhere or have a specific thing that you can only see when you've already run the script once e.g. if not fileexist (@tempdir & "\checkfile.chk") then ;do whatever you want to do at first start filewriteline (@tempdir & "\checkfile.chk", ".") endif ;here is the rest of your script hope this helps you my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
anyday Posted March 24, 2006 Author Share Posted March 24, 2006 yea thanks man i will try it out, but yea seems like that would do it. Link to comment Share on other sites More sharing options...
MHz Posted March 24, 2006 Share Posted March 24, 2006 To ensure it is the 1st code executed, then you can use OnAutoItStart(). AutoIt will look for this function as the 1st code to run before anything else. Func OnAutoItStart() ;Code here ;... ;... EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 24, 2006 Share Posted March 24, 2006 HI, if you know that it is the first run you can also do something like this If $CmdLine[0] > 0 And $CmdLine[1] = "firstRun" Then do some stuff Endif So long, 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...
anyday Posted March 25, 2006 Author Share Posted March 25, 2006 (edited) Nuffilein805, I get the following error with your code if not fileexist (@ScriptDir & "\checkfile.chk") then if not ^ERROR Error: Unknown function name. n/m i see the prob should be FileExists Works great, thanks ------------------------------- MHz The code you posted works good but it runs every time the script is ran i only need it to run the very first time a user runs the script Edited March 25, 2006 by anyday 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