failedtocompile Posted January 2, 2010 Share Posted January 2, 2010 Hello people just trying to work with IniRead(), more specifically retrieving data from the key and then using in conjunction with FileGetShortName() currently it just outputs what is written in the ini file but i need it to interpret the string so it can be used with FileGetShortName() My .ini [file1] path2=@ScriptDir & '\file\test.htm' ;just with this example i do not want to use exact UNC paths, also it is not translated in DOS properly if using 'file1\test.htm' Have tried with no quotes around the path also. my Script: $filel1 = IniRead(@ScriptDir & '\guiconfig.ini', 'file1', 'path2', "") $file1string = String ($file1) $file1path = FileGetShortName($file1string) MsgBox(0, "", $file1path) any help would be appreciated ftc Link to comment Share on other sites More sharing options...
UEZ Posted January 3, 2010 Share Posted January 3, 2010 It make no sense to have @ScriptDir macro in ini file but anyway, here a possibility: $ini = IniRead(@ScriptDir & "\GUIConfig.ini", "file1", "path2", "Error") If $ini <> "Error" Then $aTmp = StringSplit($ini, "&") $path = StringStripWS($aTmp[2], 7) $short = FileGetShortName(@ScriptDir & StringMid($path, 2, StringLen($path) - 2)) ConsoleWrite($short & @CRLF) Else ConsoleWrite($ini & @CRLF) EndIf UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 3, 2010 Share Posted January 3, 2010 (edited) You want Execute. $file1 = Execute(IniRead(@ScriptDir & '\guiconfig.ini', 'file1', 'path2', "")) $file1path = FileGetShortName($file1) MsgBox(0, "", $file1path) Edited January 3, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
failedtocompile Posted January 3, 2010 Author Share Posted January 3, 2010 You want Execute. $file1 = Execute(IniRead(@ScriptDir & '\guiconfig.ini', 'file1', 'path2', "")) $file1path = FileGetShortName($file1) MsgBox(0, "", $file1path) danke AdmiralAlkex that method worked. I also came up with another method including the IniRead encapsulate into my Run(@ComSpec) which yielded similar results. My Main Goal is to have almost all external calls configured from an ini file, so can modify the ini file instead of the code. Thanks again to both for your help. 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