Jump to content
Sign in to follow this  
rich2323

Execute autoit command from ini file

Recommended Posts

rich2323

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

Share this post


Link to post
Share on other sites
99ojo

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

Share this post


Link to post
Share on other sites
rich2323

That worked thank you!!

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

Thanks again!

Rich

Share this post


Link to post
Share on other sites
99ojo

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.