colafrysen Posted February 3, 2009 Share Posted February 3, 2009 Hi, i am writing a file that saves files, the filenames are custom named by the users via a ini-File. I want to be able to use variables like time and date inside the ini-file to use in the filename, for example. INI-File: [File] Name=File1%Month%-%Date% Where %Month% and %Date% will be equal to the AutoIt macros @mon and @mday Help appreciated [font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size] Link to comment Share on other sites More sharing options...
James Posted February 3, 2009 Share Posted February 3, 2009 Then just do: Name=File1 & @MON&-&@mDAY Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
colafrysen Posted February 3, 2009 Author Share Posted February 3, 2009 Then just do: Name=File1 & @MON&-&@mDAY Thanks, but the syntax for the AutoIt strings with the "&" and quotes are a bit to hard for the people who are going to use this application. so even though it would work I want an easier syntax. [font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size] Link to comment Share on other sites More sharing options...
James Posted February 3, 2009 Share Posted February 3, 2009 Thanks, but the syntax for the AutoIt strings with the "&" and quotes are a bit to hard for the people who are going to use this application. so even though it would work I want an easier syntax.Well think about it Just convert it in script. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 3, 2009 Share Posted February 3, 2009 Thanks, but the syntax for the AutoIt strings with the "&" and quotes are a bit to hard for the people who are going to use this application. so even though it would work I want an easier syntax. If you have no intention of learning AutoIt, then stop using AutoIt, and please stop posting in AutoIt forums. If, however, you want to learn, the syntax of what JamesBrooks gave you was not valid for use in a script. It whould have been: $Name = "File1" & @MON & "-" & @MDAY Saving that value to an ini file would be: IniWrite($sIniFile, "Section_Name", "Name", "File1" & @MON & "-" & @MDAY) If that doesn't cover your usage then be more clear about what you want to do. 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...
colafrysen Posted February 3, 2009 Author Share Posted February 3, 2009 First, I really want to learn AutoIt, big time. well i got this far #include <Date.au3> $input = "File1%time%-%date%.jpg" $input2 = '"'&$input&'"' $Time = @HOUR&":"&@MIN $input3 = StringReplace ($input2,"%time%",'"&$time&"') $Date = _DateTimeFormat( _NowCalc(),2) $input4 = StringReplace ($input3,"%date%",'"&$Date&"') MsgBox(1,$input,$input4) Bot how do i make AutoIt recognise the contents of $input 4 as code, and not just a string. Just tell me if I am unclear and thanks for all the quick replies [font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size] Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 3, 2009 Share Posted February 3, 2009 First, I really want to learn AutoIt, big time. well i got this far #include <Date.au3> $input = "File1%time%-%date%.jpg" $input2 = '"'&$input&'"' $Time = @HOUR&":"&@MIN $input3 = StringReplace ($input2,"%time%",'"&$time&"') $Date = _DateTimeFormat( _NowCalc(),2) $input4 = StringReplace ($input3,"%date%",'"&$Date&"') MsgBox(1,$input,$input4) Bot how do i make AutoIt recognise the contents of $input 4 as code, and not just a string. Just tell me if I am unclear and thanks for all the quick replies I think you might be looking for Execute(): #include <Date.au3> $input = "File1%time%-%date%.jpg" ConsoleWrite("Debug: $input = " & $input & @LF) $input2 = '"'&$input&'"' ConsoleWrite("Debug: $input2 = " & $input2 & @LF) $time = @HOUR&":"&@MIN ConsoleWrite("Debug: $time = " & $time & @LF) $input3 = StringReplace ($input2,"%time%",'"&$time&"') ConsoleWrite("Debug: $input3 = " & $input3 & @LF) $Date = _DateTimeFormat( _NowCalc(),2) ConsoleWrite("Debug: $Date = " & $Date & @LF) $input4 = StringReplace ($input3,"%date%",'"&$Date&"') ConsoleWrite("Debug: $input4 = " & $input4 & @LF) $sResult = Execute($input4) ConsoleWrite("Debug: $sResult = " & $sResult & @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...
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