Sign in to follow this  
Followers 0
rich2323

Execute autoit command from ini file

4 posts in this topic

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



#2 ·  Posted (edited)

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

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

#4 ·  Posted (edited)

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  
Followers 0