Jump to content
Sign in to follow this  
skippynz

convert string in an ini to the macro ?

Recommended Posts

skippynz

not sure if this is possible but i have an INI file with the macro @startupcommondir in it - and wanted to convert that to be able to be used in create dir.

INI File

[default]
Iconlocation=@startmenucommondir & '\new folder'

thought of using this

$Iconlocation = IniRead("icons.ini", "default", "Iconlocation", "NotFound")
DirCreate(_StringProper($Iconlocation))

but it didnt work - any ideas ?

TIA

Craig

Share this post


Link to post
Share on other sites
PsaltyDS

not sure if this is possible but i have an INI file with the macro @startupcommondir in it - and wanted to convert that to be able to be used in create dir.

INI File

[default]
Iconlocation=@startmenucommondir & '\new folder'

thought of using this

$Iconlocation = IniRead("icons.ini", "default", "Iconlocation", "NotFound")
DirCreate(_StringProper($Iconlocation))

but it didnt work - any ideas ?

TIA

Craig

If you can read that string from the file with IniRead() then you can resolve it with Execute():
$sString = "@startmenucommondir & '\new folder'"
$sString = Execute($sString)
ConsoleWrite("$sString = " & $sString & @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

Share this post


Link to post
Share on other sites
skippynz

If you can read that string from the file with IniRead() then you can resolve it with Execute():

$sString = "@startmenucommondir & '\new folder'"
$sString = Execute($sString)
ConsoleWrite("$sString = " & $sString & @LF)

;)

thanks that worked a treat - i will have to remember that one for next time - such a simple piece of code.. :D

Share this post


Link to post
Share on other sites
DW1

I don't get it... why the need for the Execute()?

How are these any different?

test1()
test2()
Func test1()
    $sString = @startmenucommondir & '\new folder'
    ConsoleWrite("$sString = " & $sString & @LF)
EndFunc

Func test2()
    $sString = "@startmenucommondir & '\new folder'"
    $sString = Execute($sString)
    ConsoleWrite("$sString = " & $sString & @LF)
EndFunc

EDIT:

Never mind... right after the post I realized it's because it was in a string from the IniRead... duh.. sorry

Edited by danwilli

Share this post


Link to post
Share on other sites
Szhlopp

If you can read that string from the file with IniRead() then you can resolve it with Execute():

$sString = "@startmenucommondir & '\new folder'"
$sString = Execute($sString)
ConsoleWrite("$sString = " & $sString & @LF)

;)

Lol I couldn't figure this out either... Thanks :D

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×