Jump to content

convert string in an ini to the macro ?


skippynz
 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...