jben Posted April 23, 2008 Share Posted April 23, 2008 (edited) Hey. Can someone help me with solving my ini file issue.. I'm trying to read in 2 different pieces of information and use this info for the dirmove. The ini would look like this [section1] location=something destination=something [section2] location=something destination=something [section3] location=something destination=something My code is below. Thanks #include <date.au3> Dim $date[3]=[@YEAR,@MON,@MDAY] $inputlocation = @TempDir&"\XS_TEMP2";Location to obtain extracted files $outputlocation = "C:\OUTPUT\";location to output files $foldername = @YEAR & _WeekNumberISO() If Not FileExists($outputlocation) Then DirCreate($outputlocation);creates the dir if it doesn't exist ;************INI TEST***************** $sections = IniReadSectionNames ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini");reads the sections $filetoextract = IniRead ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini",$sections,"Filetoextract", "default");gets file to extract $locationtosave = IniRead ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini",$sections,"Locationtosave", "default");gets location to save DirMove($inputlocation & $filetoextract,$outputlocation & $locationtosave) Edited April 23, 2008 by jben Link to comment Share on other sites More sharing options...
DarkMatter Posted April 23, 2008 Share Posted April 23, 2008 (edited) IniReadSectionNames returns an array. Success: Returns an array of all section names in the INI file. Failure: Sets @error on failure. Should do something like the following: $filetoextract = IniRead ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini",$sections[0],"Filetoextract", "default");gets file to extract Edited April 23, 2008 by DarkMatter [sub]Quantum mechanics: The dreams stuff is made of[/sub] Link to comment Share on other sites More sharing options...
monoceres Posted April 23, 2008 Share Posted April 23, 2008 (edited) Hey. Can someone help me with solving my ini file issue.. I'm trying to read in 2 different pieces of information and use this info for the dirmove. The ini would look like this [section1] location=something destination=something [section2] location=something destination=something [section3] location=something destination=something My code is below. Thanks #include <date.au3> Dim $date[3]=[@YEAR,@MON,@MDAY] $inputlocation = @TempDir&"\XS_TEMP2";Location to obtain extracted files $outputlocation = "C:\OUTPUT\";location to output files $foldername = @YEAR & _WeekNumberISO() If Not FileExists($outputlocation) Then DirCreate($outputlocation);creates the dir if it doesn't exist ;************INI TEST***************** $sections = IniReadSectionNames ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini");reads the sections $filetoextract = IniRead ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini",$sections,"Filetoextract", "default");gets file to extract $locationtosave = IniRead ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini",$sections,"Locationtosave", "default");gets location to save DirMove($inputlocation & $filetoextract,$outputlocation & $locationtosave) Hello jben, having troubles gain? IniReadSectionNames() return an array so this would be better: #include <date.au3> Dim $date[3]=[@YEAR,@MON,@MDAY] $inputlocation = @TempDir&"\XS_TEMP2\";Location to obtain extracted files $outputlocation = "C:\OUTPUT\";location to output files $foldername = @YEAR & _WeekNumberISO() If Not FileExists($outputlocation) Then DirCreate($outputlocation);creates the dir if it doesn't exist $sections = IniReadSectionNames ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini");reads the sections If IsArray($sections) Then For $section In $sections $filetoextract = IniRead ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini",$section,"Filetoextract", "default");gets file to extract $locationtosave = IniRead ("C:\Documents and Settings\myname\Desktop\INI TEST\locations.ini",$section,"Locationtosave", "default");gets location to save DirMove($inputlocation & $filetoextract,$outputlocation & $locationtosave) Next EndIf Edit: Also fixed some backslash errors in your code Edited April 23, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
jben Posted April 23, 2008 Author Share Posted April 23, 2008 thanks... 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