rudi Posted July 25, 2008 Share Posted July 25, 2008 Hi. I think the exampe shows what I'm thinking about to do: ; I want to use such an INI file to specify where data shall go to. I want to be able to make use of Autoit @MACROs... $handle=FileOpen("MyProg.ini",2) FileWriteLine($handle,"[paths]") FileWriteLine($handle,"MainPath=@ProgramFilesDir") FileWriteLine($handle,"SubPath=\This-Time-I-want-it-here\") FileClose($handle) $MainPath=IniRead("MyProg.ini","paths","MainPath",@MyDocumentsDir) ; file: @ProgramFilesDir $SubPath = IniRead("MyProg.ini","paths","SubPath","\MyProgDataDir\") ; file: \This-Time-I-want-it-here\ $PathPrefix=$MainPath & $SubPath MsgBox(0,"Path",$PathPrefix) Howto? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
weaponx Posted July 25, 2008 Share Posted July 25, 2008 Thats not how you create an ini file... $ini = "MyProg.ini" IniWrite($ini, "paths", "MainPath",@ProgramFilesDir) IniWrite($ini, "paths", "SubPath","\This-Time-I-want-it-here\") Link to comment Share on other sites More sharing options...
yyyy273 Posted July 25, 2008 Share Posted July 25, 2008 $string = (@ProgramFilesDir & "\This-Time-I-want-it-here\") consolewrite($string) Is that what you are trying to do? Link to comment Share on other sites More sharing options...
rudi Posted July 25, 2008 Author Share Posted July 25, 2008 Thats not how you create an ini file... $ini = "MyProg.ini" IniWrite($ini, "paths", "MainPath",@ProgramFilesDir) IniWrite($ini, "paths", "SubPath","\This-Time-I-want-it-here\") Thanks, I know. As I had the INI created manually already, this copy/paste was the easiest way, to "plain write" it from inside the sample script. I could have added this as well ------- sample MyProg.ini ---------- [paths] MainPath=@ProgramFilesDir SubPath=\I-want-it-here\ ------- sample MyProg.ini END----- But that was NOT my question. The question is about an easy way to expand macros inside strings. So e.g. $Prefix="@ProgramFilesDir" Howto expand the /content/ of $Prefix, which is a Autoit Macro right now? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
ProgAndy Posted July 25, 2008 Share Posted July 25, 2008 You need to use Execute e.g.: Func _IniReadMacro($fn,$sec,$key,$def) Local $return = IniRead($fn,$sec,$key,$def) If StringLeft($return,1) = "@" Then $return = Execute($return) If @error Then Return SetError(@error,0,$def) EndIf Return $return EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes 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