Jump to content

menu won't execute executables


Recommended Posts

ok here is the code

CODE
While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1

Run("C:\Documents and Settings\Cieran\My Documents\Scripts\Screensaver\Good.exe")

Case $msg = $Button_2

ShellExecute("Bad.au3", "", "C:\Documents and Settings\Kieren\My Documents\Scripts\Screensaver", "Run")

Case $msg = $Button_3

ShellExecute("Surreal.au3", "", "C:\Documents and Settings\Kieren\My Documents\Scripts\Screensaver", "Run")

Case $msg = $Button_6

ShellExecute("Chatter.au3", "", "C:\Documents and Settings\Kieren\My Documents\Scripts\Chat Programs", "Run")

Case $msg = $Button_7

Run("C:\Documents and Settings\Cieran\My Documents\Scripts\Chat Programs\Chatter - Logoff.exe")

EndSelect

Wend

the shellexecutes are how I had it at the early state so I could make edits to the programs, but now that I want to compile them, I click on the buttons with .exe, and nothing happens, no error message, just doesn't wanna execute?

Link to comment
Share on other sites

I tried this i wrote real quick and it uses a button to run an .exe and it works:

#include <GUIConstants.au3>

GUICreate("Test", 70, 20)

$button = GUICtrlCreateButton("Run .exe", 1, 1, 70, 20)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $button
        Run("Notepad.exe")
        Sleep(1000)
        ShellExecute("Notepad.exe")
    EndSelect
WEnd
GUIDelete()
Exit
but you could try removing the C:\DOCUMENTS ect. and just use the name of the file with the extension. Hope thats helps, Clipper34

Link to comment
Share on other sites

arminius

I click on the buttons with .exe, and nothing happens, no error message, just doesn't wanna execute

Wrong Run parameter in ShellExecute() func. From the help:

verb [optional] The "verb" to use, common verbs include:

open = (default) Opens the file specified. The file can be an executable file, a document file, or a folder

edit = Launches an editor and opens the document for editing. If "filename" is not a document file, the function will fail

print = Prints the document file specified. If "filename" is not a document file, the function will fail

properties = Displays the file or folder's properties

where you found the Run parameter? :)
Link to comment
Share on other sites

  • Moderators

I've tried just the file name, it says cannot find external file, I try the full path and when I click on the button nothing happens, no error message but no script execution

You probably have spaces in the exe path.

$s_Path = "My Exe Path And My ExeName.exe"

Run('"' & $s_Path & '"')

Surround them by double quotes.

Edit:

P.S.

.au3 extension is not an executable.

To do that as an executable, you need to use /AutoIt3ExecuteScript .

Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $s_MyAu3File & '"')

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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