Xenobiologist Posted May 27, 2006 Share Posted May 27, 2006 Hi, I want to build a config.ini which stores all the pathes to the files used in the script, so that everybody can easily change the GUI. This is a test script. The problem is, I don't know how to write the path with a macro into the config.ini that it still works. :"> ;ExpandVarsTest Opt("GUICloseOnESC",1) #include <GUIConstants.au3> Opt("ExpandVarStrings", 0) Global $configArray = IniReadSection(@ScriptDir & "\config.ini", "config") If @error Then MsgBox(4096, "", "Error occured, probably no language.ini file.") MsgBox(0,"",$configArray[1][1]) Opt("ExpandVarStrings", 1) $GUI = GUICreate("Test", 500, 300, 50, 50) GUICtrlCreatePic($configArray[1][1], 0, 50, 500, 300) ;GUICtrlCreatePic($configArray[2][1], 0, 50, 500, 300) ;works GUISetState(@SW_SHOW, $GUI) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE INI-File. [config] path=@scriptDir & \Moon7.gif path=c:\Downloads\AutoIt-Skripte\Entwicklung\images\Moon7.gif So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
w0uter Posted May 27, 2006 Share Posted May 27, 2006 (edited) eval maby ? Edited May 27, 2006 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 27, 2006 Author Share Posted May 27, 2006 eval maby ? HI, you mean something like: GUICtrlCreatePic(Eval($configArray[1][1]), 0, 50, 500, 300) Hmmh, still doesn't work. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Daniel W. Posted May 27, 2006 Share Posted May 27, 2006 Opt("GUICloseOnESC",1) #include <GUIConstants.au3> Opt("ExpandVarStrings", 0) Global $folder = @ScriptDir Global $configArray = IniReadSection(@ScriptDir & "\config.ini", "config") $keys = StringReplace( $configArray[1][1], "@ScriptDir" , $folder ) If @error Then MsgBox(4096, "", "Error occured, probably no language.ini file.") Opt("ExpandVarStrings", 1) $GUI = GUICreate("Test", 500, 300, 50, 50) GUICtrlCreatePic($keys, 0, 50, 500, 300) ;GUICtrlCreatePic($configArray[2][1], 0, 50, 500, 300) ;works GUISetState(@SW_SHOW, $GUI) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE try this... Its not working completely but maybe you can work it out that it works completely --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 27, 2006 Author Share Posted May 27, 2006 Hi, thanks for your try. I already tested several things, but I didn't work. Maybe it isn't possible to use a macro in a $var. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Daniel W. Posted May 27, 2006 Share Posted May 27, 2006 hmm then i got no idea --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
mr.underperson Posted May 27, 2006 Share Posted May 27, 2006 [config] path=@ScriptDir\Moon7.gif -mu Link to comment Share on other sites More sharing options...
Daniel W. Posted May 28, 2006 Share Posted May 28, 2006 (edited) Opt("GUICloseOnESC",1) #include <GUIConstants.au3> Opt("ExpandVarStrings", 0) Global $folder = @ScriptDir Global $configArray = IniReadSection(@ScriptDir & "\config.ini", "config") $keys = StringReplace( $configArray[1][1], "@ScriptDir" , $folder ) If @error Then MsgBox(4096, "", "Error occured, probably no language.ini file.") Opt("ExpandVarStrings", 1) $GUI = GUICreate("Test", 500, 300, 50, 50) GUICtrlCreatePic($keys, 0, 50, 500, 300) ;GUICtrlCreatePic($configArray[2][1], 0, 50, 500, 300) ;works GUISetState(@SW_SHOW, $GUI) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE [config] path=@ScriptDir\Moon7.gif This way it works Edited May 28, 2006 by Daniel W. --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
mr.underperson Posted May 28, 2006 Share Posted May 28, 2006 Yes, that's why I posted it. -mu Link to comment Share on other sites More sharing options...
Daniel W. Posted May 28, 2006 Share Posted May 28, 2006 Yes but just that code looked like it should be used with the code from first post in this thread. --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
mr.underperson Posted May 28, 2006 Share Posted May 28, 2006 At the end of the day it's pure coincedence that the "macro" used in the ini is the same as the AutoIt "macro". It could just as easily be %AppDir%, or {RunDir}, or ^foo, or whatever you like. And then you could just call them "tokens", and be done with it! -mu Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 28, 2006 Author Share Posted May 28, 2006 HI, thanks! This way it works for @ScriptDir, but it is still a long way round. I thought this : Opt("ExpandVarStrings", 1) should solve the porblem without the StringReplace, but it doesn't. Opt("GUICloseOnESC",1) #include <GUIConstants.au3> Global $folder = @ScriptDir Global $configArray = IniReadSection($folder & "\config.ini", "config") $keys = StringReplace($configArray[1][1], "@ScriptDir" , $folder) If @error Then MsgBox(4096, "", "Error occured, probably no language.ini file.") $GUI = GUICreate("Test", 500, 300, 50, 50) GUICtrlCreatePic($keys, 0, 50, 500, 300) GUISetState(@SW_SHOW, $GUI) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE Nevertheless, thanks - but I don't like this solution. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
MHz Posted May 28, 2006 Share Posted May 28, 2006 You were close.. ;ExpandVarsTest Opt("GUICloseOnESC",1) #include <GUIConstants.au3> Opt("ExpandVarStrings", 0) Global $configArray = IniReadSection(@ScriptDir & "\config.ini", "config") If @error Then MsgBox(4096, "", "Error occured, probably no language.ini file.") Opt("ExpandVarStrings", 1) MsgBox(0, '', $configArray[1][1]) $GUI = GUICreate("Test", 500, 300, 50, 50) GUICtrlCreatePic($configArray[1][1], 0, 50, 500, 300) ;GUICtrlCreatePic($configArray[2][1], 0, 50, 500, 300);works GUISetState(@SW_SHOW, $GUI) do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE config.ini [config] path=@scriptDir@\Moon7.gif path=c:\Downloads\AutoIt-Skripte\Entwicklung\images\Moon7.gif You need to double up in the @ symbol to expand vars. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 28, 2006 Author Share Posted May 28, 2006 Wooooohoooo, That's it! Thank you MHz and all the others. As it is always, there is an easy soultion, but searching it can be hard enough. Where did you find it? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
MHz Posted May 28, 2006 Share Posted May 28, 2006 Where did you find it?Helpfile: ExpandEnvStrings. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 28, 2006 Author Share Posted May 28, 2006 Helpfile: ExpandEnvStrings. Um, okay. I think my English is too bad to get it the way it was meant. I understood it like this: if I expand the macro etc. and I still want to use a @ or & then I have to double it like @@ or $$ but I didn't ever think of surrounding the part of the macro. :"> So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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