Guest shibz2 Posted February 23, 2005 Share Posted February 23, 2005 I have 2 copies of the same script, each in their own folder. They are set up to pull the settings for the variables from a settings.ini file located in the same directory as the script. After the first one is done running, it is set up to automatically start up the second script which will use a totally different set of settings defined in it's own settings.ini file. When run individully, they run 100% fine. The first one does what it is suposed to, and so does the second one. The problem is when I enable it so that the first one starts the second when it is done. When that is enabled, the first one runs flawlessly, but then the second one starts running and for some reason, instead of getting it's settings from the settings.ini file in it's folder, it gets it from the first one's folder. I spent 5 hours yesterday searching for my problem, and I couldn't find anything. I think the bug might be in Autoit. I will try to post an example script when I get home. Link to comment Share on other sites More sharing options...
CyberSlug Posted February 23, 2005 Share Posted February 23, 2005 (edited) Put the following line at the beginning of each script:MsgBox(4096,"Debug", "The working directory is " & @CRLF & @WorkingDir)My hunch is that you are not explicitly setting the working directory in your script. Then, when C:\folderOne\scriptOne.au3 calls the following, scriptTwo.au3 is still going to going to use C:\folderOne as the "current working directory"Run(@AutoItExe & " " & "C:\folderTwo\scriptTwo.au3")I don't think this is an AutoIt bug; I think it's a Windows feature.There are two solutions:FileChangeDir(@ScriptDir) ;before you call iniRead in second scriptThe other is to useIniRead(@ScriptDir & "\nameofIniFile.ini") ;an alternativeHope this helps Edited February 23, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Guest shibz2 Posted February 23, 2005 Share Posted February 23, 2005 well, you were right, I stuck that debug line in there and when the second one started up, it was using the folder from the first one. Thanks so much. I was getting really frustrated there. As far as I can see, FileChangeDir(@ScriptDir) fixed it. Stupid windows and their "features" Too bad windows isn't open source, i'd have a few modifications to make if it was. Link to comment Share on other sites More sharing options...
Valik Posted February 23, 2005 Share Posted February 23, 2005 Its not a bug and its not a Windows feature. When you use Run() and do not specify a working directory, AutoIt uses it's own current working directory when it spawns the new process for lack of a better one. 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