NTKBO Posted January 25, 2006 Share Posted January 25, 2006 Hello again, still working on my first script. I have an INI file with one section "[Locations]" and two keys "Newsreader" & "FoldersLoc" [Locations] Newsreader = C:\Program Files\Communications\Usenet\Auto\NewsBin\V5 and Up\nbpro.exe FoldersLoc = F:\Downloads\Newsbin\~Folders.bat My goal is to be able to move this script (once compiled) to any directory needed, keeping it's INI file with it. To this end, I do not wish to hard code the INI folder's path, so I created a Variable for this: Dim $g_szVersion , $BatPath , $News , $Val , $Param ,$Path $Path = '"'&@ScriptDir & "\NZButil.ini"&'"' MsgBox(4096, "Variable Check", "$Path: "&$Path); test $Path is correct This seems to get the correct path. In my main section, I can't seem to retrieve the "Newsreader" key nor "FoldersLoc" key: Note: I've tried it with quotes in the "iniRead" and without (niether seem to work). $News = iniRead ( $Path , "Locations", "Newsreader" , "Newsreader Not Found" ) $Param = $CmdLine[1] MsgBox(4096, "Paramiters sent", "Result: "&$News&" "&$Param) ;$Val=RunWait ( $News & ' "' & $Param & '"') <- Will be actual line after testing $BatPath = IniRead ( "$Path", "Locations", "FoldersLoc" , "Not Found" ) MsgBox(4096, "Batch command:", "Result: "&$BatPath&"") ;Run($BatPath)<- Will be actual line after testing I know I'm missing SOMETHING. Link to comment Share on other sites More sharing options...
cdkid Posted January 25, 2006 Share Posted January 25, 2006 (edited) $BatPath = IniRead ( "$Path", "Locations", "FoldersLoc" , "Not Found" ) should be $BatPath = IniRead ( $Path, "Locations", "FoldersLoc" , "Not Found" ) (u had quotes around the variable) --hope this helps Edited January 25, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
ACalcutt Posted January 25, 2006 Share Posted January 25, 2006 i think the problem is your quotes in $path...it works without them ;$Path = '"'&@ScriptDir & "\NZButil.ini"&'"' $Path = @ScriptDir & "\NZButil.ini" msgbox(0, "", $Path) $newsreader = IniRead($path, "Locations", "Newsreader" , "Newsreader Not Found" ) msgbox(0, "", $newsreader) and what was mentioned above Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature Link to comment Share on other sites More sharing options...
NTKBO Posted January 25, 2006 Author Share Posted January 25, 2006 $BatPath = IniRead ( "$Path", "Locations", "FoldersLoc" , "Not Found" ) should be $BatPath = IniRead ( $Path, "Locations", "FoldersLoc" , "Not Found" ) (u had quotes around the variable) --hope this helps It is helpfull to know the quotes aren't needed, but the first instance: $News = iniRead ( $Path , "Locations", "Newsreader" , "Newsreader Not Found" ) Did not have quotes, but still didn't work. Thank you for your help! Link to comment Share on other sites More sharing options...
NTKBO Posted January 25, 2006 Author Share Posted January 25, 2006 i think the problem is your quotes in $path...it works without them ;$Path = '"'&@ScriptDir & "\NZButil.ini"&'"' $Path = @ScriptDir & "\NZButil.ini" msgbox(0, "", $Path) $newsreader = IniRead($path, "Locations", "Newsreader" , "Newsreader Not Found" ) msgbox(0, "", $newsreader) and what was mentioned above That was the ticket! $ACalcutt= Thank to both you, and cdkid ! AutoIt seems to be all about putting useful features in when authors refuse!! Link to comment Share on other sites More sharing options...
ACalcutt Posted January 25, 2006 Share Posted January 25, 2006 (edited) i was refering to this $Path = '"'&@ScriptDir & "\NZButil.ini"&'"' should be $Path = @ScriptDir & "\NZButil.ini" (not sure if you saw my other post befire posting the one above) edit: i see you noticed :-D Edited January 25, 2006 by ACalcutt Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature 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