Jump to content

Execute autoit command from ini file


rich2323
 Share

Recommended Posts

I am trying to read an autoit command from an ini file then execute the command that was read.

Example:

test.ini file:
[Run]
pv_run1 = msgbox(0,"testing","testing")

test.au3 file:
$run1 = IniRead ( "test.ini", "run", "pv_run1", "nothing" )

I want to run the command $run1 so it will display a message box.

I have not been able to do this. Does anyone have any suggestions? Is this possible?

Thanks,

Rich

Link to comment
Share on other sites

Hi,

just add:

1) Change ini to:

[Run]

pv_run1 = msgbox(0,'testing','testing')

2)

$run1 = IniRead ( "test.ini", "run", "pv_run1", "nothing" )
$cmd = " /AutoIt3ExecuteLine " & Chr (34) & $run1 & Chr (34)
Run(@AutoItExe & $cmd)

or more elegant:

_executeAutoITcmd (IniRead ( "test.ini", "run", "pv_run1", "nothing" ))

Func _executeAutoITcmd ($run)
    $cmd = " /AutoIt3ExecuteLine " & Chr (34) & $run & Chr (34)
    Run(@AutoItExe & $cmd)
EndFunc

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

I am guess that the "Chr (34)" is a space.

No, it is "

:)

See helpfile Running Scripts:

Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line"

Execute one line of code.

;-))

Stefan

Edited by 99ojo
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...