Jump to content

How do I associate an executable script from a Macro?


tonyjh
 Share

Recommended Posts

I have written a number of scripts to automate repetitive functions and have them in a toolbar. They work fine if I run them from there. But then I created a macro with three tabs and radio buttons to launch these with.... and they do work, but only after I manually run the script first......... why is that ? If I try to run them from the macro first, I get this error message that reads:

"Line 0 (File "C:\Documents and Settings\CurrentUser\Desktop\Robots\Seg_Memo.au3"):

Error:Error reading the file."

The commad line is where the file "Seg_Memo.au3" resides.... but in the Macro, the structure looks like this:

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $AForm7

Case $Button1

run_selected()

Case $Button2

Exit

EndSwitch

WEnd

Func run_selected()

If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then Run("C:\Program Files\AutoIt3\autoit3.exe ZapTH.au3")

If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then Run("C:\Program Files\AutoIt3\autoit3.exe ZapGH.au3")

If BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED Then Run("C:\Program Files\AutoIt3\autoit3.exe ZapRB.au3")

If BitAND(GUICtrlRead($Radio4), $GUI_CHECKED) = $GUI_CHECKED Then Run("C:\Program Files\AutoIt3\autoit3.exe Seg_Memo.au3")

If BitAND(GUICtrlRead($Radio5), $GUI_CHECKED) = $GUI_CHECKED Then Run("C:\Program Files\AutoIt3\autoit3.exe Land_Size.au3")

EndFunc

Is there anyway I can get the script to run from the macro without having to run the script manually ahead of time?

I appreciate any help I can get here.

TH

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...