hairyllama Posted June 2, 2010 Share Posted June 2, 2010 (edited) So i just found AutoIt and have been working away at a simple test script as i learn. I decided to add an .ini file to make things easier. However even though i have verified that the ini file is named properly and placed in the correct directory when i use FileExists it won't find the file. I have tried using... $iniFile = @scriptDir & "\default.ini" I also have tried naming the ini file the same as the script and then.. $iniFile=stringleft(@ScriptName,stringlen(@scriptname)-4) & ".ini" But no matter what i try it isn't finding the file. The ini file IS in the appropriate directory. and i do have #include <file.au3> so any help is appreciated. Edited June 2, 2010 by hairyllama Link to comment Share on other sites More sharing options...
ajag Posted June 2, 2010 Share Posted June 2, 2010 (edited) So i just found AutoIt and have been working away at a simple test script as i learn. I decided to add an .ini file to make things easier. However even though i have verified that the ini file is named properly and placed in the correct directory when i use FileExists it won't find the file. I have tried using... $iniFile = @scriptDir & "/default.ini" I also have tried naming the ini file the same as the script and then.. $iniFile=stringleft(@ScriptName,stringlen(@scriptname)-4) & ".ini" But no matter what i try it isn't finding the file. The ini file IS in the appropriate directory. and i do have #include <file.au3> so any help is appreciated. Hi hairyllama, Is this really in your code? $iniFile = @scriptDir & "/default.ini" ^ It should be a backslash "\" A-Jay Edited June 2, 2010 by ajag Rule #1: Always do a backup Rule #2: Always do a backup (backup of rule #1) Link to comment Share on other sites More sharing options...
hairyllama Posted June 2, 2010 Author Share Posted June 2, 2010 Hi hairyllama, Is this really in your code? $iniFile = @scriptDir & "/default.ini" ^ It should be a backslash "\" A-Jay Oops yes i am using backslash just a typo when writing the first post! I shall edit it if i can. Link to comment Share on other sites More sharing options...
ajag Posted June 2, 2010 Share Posted June 2, 2010 (edited) So it is better to post a snippet of your real code. It will help to see what's going wrong.Did you try to type the full path like $IniFile = "D:\Test\default.ini"?A-Jay Edited June 2, 2010 by ajag Rule #1: Always do a backup Rule #2: Always do a backup (backup of rule #1) Link to comment Share on other sites More sharing options...
hairyllama Posted June 2, 2010 Author Share Posted June 2, 2010 #include <file.au3> if not FileExists("C:\default.ini") Then msgbox(0,"","The ini file could not be found at following location: root") exit EndIf Just to test and make sure i wasn't insane. I did that, and yes the file default.ini is placed in the C:\ root. So i have no idea whats going on lol Link to comment Share on other sites More sharing options...
ajag Posted June 2, 2010 Share Posted June 2, 2010 #include <file.au3> if not FileExists("C:\default.ini") Then msgbox(0,"","The ini file could not be found at following location: root") exit EndIf Just to test and make sure i wasn't insane. I did that, and yes the file default.ini is placed in the C:\ root. So i have no idea whats going on lol Then you have to call a MD (hehe). Your example works fine for me... A-Jay Rule #1: Always do a backup Rule #2: Always do a backup (backup of rule #1) Link to comment Share on other sites More sharing options...
hairyllama Posted June 2, 2010 Author Share Posted June 2, 2010 Then you have to call a MD (hehe). Your example works fine for me...A-JayRats thats what i was afraid of. Guess something is screwed up with my system then. Laaaame ill try it on one of my other pc's. Thanks for the testing. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 2, 2010 Share Posted June 2, 2010 (edited) #include <file.au3> if not FileExists("C:\default.ini") Then msgbox(0,"","The ini file could not be found at following location: root") exit EndIf Just to test and make sure i wasn't insane. I did that, and yes the file default.ini is placed in the C:\ root. So i have no idea whats going on lol file.au3 doesn't need to be included for the FileExists function. If the file does exist at that location, then that script will just end without displaying a message, is that what's happening? Try this simpler rendition of that code if necessary. If FileExists("C:\default.ini") Then MsgBox(0, "", "The file exists") Edited June 2, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
saywell Posted August 11, 2011 Share Posted August 11, 2011 (edited) It seems that @SCRIPTDIR includes a backslash when it's being run from root directory of a drive.TryMsgBox (0, "backslash or not?", @ScriptDir)when run from the root of a drive [eg memory stick for test purposes], then from a subfolder.This isn't in the documentation, which just says:@ScriptDir - Directory containing the running script. (Result does not contain a trailing backslash)William Edited August 11, 2011 by saywell 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