FireLordZi Posted February 2, 2008 Share Posted February 2, 2008 How can I extract the date from my ini that looks like this: [section] Key=value1;value2;value3;~February 1, 2008 While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
covaks Posted February 2, 2008 Share Posted February 2, 2008 $var = IniRead("file.ini","section","key","") $var2 = StringSplit($var,";") $date = StringTrimLeft($var2[UBound($var2)-1],1) msgbox(1,"",$date) Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 2, 2008 Share Posted February 2, 2008 How can I extract the date from my ini that looks like this: [section] Key=value1;value2;value3;~February 1, 2008 IniRead() will get the value of "Key" for you. Then you just parse the string. One way to do that is use StringInStr() to find out where the tilde is, then use StringMid() to get the part of the string past that. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
FireLordZi Posted February 2, 2008 Author Share Posted February 2, 2008 @PsaltyDS and @ covaks: Thanks for all your help! :) While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
FireLordZi Posted February 2, 2008 Author Share Posted February 2, 2008 $var = IniRead("C:\buddies.ini", "OnlineBuddies", "turnof", "Key not found.") $var0 = StringSplit($var,";") $var2 = StringSplit($var,"~") $date1 = StringTrimLeft($var2[UBound($var2)-1],1) msgbox(1,"",$date1) I did that and it's returning /31/2008 at 3:47:07 PM when it is supposed to be returning 1/31/2008 at 3:47:07 PM What's the problem? While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
andybiochem Posted February 2, 2008 Share Posted February 2, 2008 $var = IniRead("C:\buddies.ini", "OnlineBuddies", "turnof", "Key not found.") $var0 = StringSplit($var,";") $var2 = StringSplit($var,"~") $date1 = StringTrimLeft($var2[UBound($var2)-1],1) msgbox(1,"",$date1) I did that and it's returning /31/2008 at 3:47:07 PM when it is supposed to be returning 1/31/2008 at 3:47:07 PM What's the problem? AutoIT doesn't recognise month names as integers...i.e. the word February is not recognised as "2". You will probably need to set up some sort of switch to account for this... Switch $month case "January" $month = "01" case "February" $month = "02" case "March" $month = "03" case "April" $month = "04" ;etc, etc, EndSwitch - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 2, 2008 Share Posted February 2, 2008 $sINI = "C:\Temp\Test.ini" $sData = IniRead($sINI, "Section", "Key", "") $sData = StringMid($sData, StringInStr($sData, "~") + 1) ConsoleWrite("Debug: $sData = " & $sData & @LF) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
FireLordZi Posted February 2, 2008 Author Share Posted February 2, 2008 $sINI = "C:\Temp\Test.ini" $sData = IniRead($sINI, "Section", "Key", "") $sData = StringMid($sData, StringInStr($sData, "~") + 1) ConsoleWrite("Debug: $sData = " & $sData & @LF) Thanks! While Alive() { DrinkWine(); }AutoIt Programmer 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