Jump to content

Whats Wrong With This Script ?


Recommended Posts

GUICreate ( "Bla Bla ", 450, 300)

$not = GuiSetControl("button", "Run Notepad",  10, 30, 150)

$war = GuiSetControl("button", "Run explorer",  10, 100, 150)

GuiWaitClose()

$not = Run("notepad.exe")

$war = Run("explorer.exe")

exit

why does it run both programs ??

Link to comment
Share on other sites

It uses regular AutoIt script, you would need to have an if statement.

$not = Run("notepad.exe")

$war = Run("explorer.exe")

is the same as:

Run("notepad.exe")
Run("explorer.exe")

except that you don't get the exit code to become the variables you call out.

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

GUICreate ( "Bla Bla ", 450, 300)

$not = GuiSetControl("button", "Run Notepad",  10, 30, 150)

$war = GuiSetControl("button", "Run explorer",  10, 100, 150)

GuiWaitClose()

$not = Run("notepad.exe")

$war = Run("explorer.exe")

exit

why does it run both programs ??

You need to check which button has closed the GUI

GUICreate ( "Bla Bla ", 450, 300)

$not = GuiSetControl("button", "Run Notepad",  10, 30, 150)

$war = GuiSetControl("button", "Run explorer",  10, 100, 150)

GuiWaitClose()

if $not = GuiRead() then  Run("notepad.exe")

if $war =GuiRead() then Run("explorer.exe")

exit

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