Jump to content

Run() wtf?


Recommended Posts

Problem fixed. (i just had a blank out for a sec up there ^^)

Edited by Aces

~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

Link to comment
Share on other sites

Func RunMenu()
    $input = InputBox("Run...", "Please type the path/file you would like to run.")
    If Run($input) = @error Then
        Return 1
        MsgBox(0, $GUItitle, "Could not run " & $input & " at this time.")
    EndIf
EndFunc

if $input does not execute then the "If" line remains false, and cancels out the "If -> EndIf" commands.

anyone see a flaw?

Run() returns the PID of the process. Chances a very low, that the PID will ever be equal @error....

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

hrm.. isnt @error a premade macro?

~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

Link to comment
Share on other sites

alright, fixed the auto exit fatal error problem

but it still doesnt pop up the msg box

i will edit for update

~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

Link to comment
Share on other sites

Func RunMenu()
    $input = InputBox("Run...", "Please type the path/file you would like to run.")
    $Run = Run($input)
    If $Run = @error Then
        MsgBox(0, $GUItitle, "Could not run " & $input & " at this time.")
    EndIf
EndFunc

cancels out the "If -> EndIf" commands.

anyone see a flaw?

Again: Run() returns the PID (process ID). That's not an error code!! So, why do you compare the PID with @error ???

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Func RunMenu()
    $input = InputBox("Run...", "Please type the path/file you would like to run.")
    $Run = Run($input)
    If $Run = @error Then
        MsgBox(0, $GUItitle, "Could not run " & $input & " at this time.")
    EndIf
EndFunc

cancels out the "If -> EndIf" commands.

anyone see a flaw?

Func RunMenu()
    $input = InputBox("Run...", "Please type the path/file you would like to run.")
    $Run = Run($input)
    If $Run = 0 Then
        MsgBox(0, $GUItitle, "Could not run " & $input & " at this time.")
    EndIf
EndFunc
Edited by ChrisL
Link to comment
Share on other sites

If Run() fails, then a good chance that a fatal error will happen. To control the error yourself, then use Opt() with "RunErrorsFatal".

Func RunMenu()
    Opt('RunErrorsFatal', 0)
    $input = InputBox("Run...", "Please type the path/file you would like to run. Use double quotes if needed")
    $pid = Run($input)
    If @error Then
        MsgBox(0, $GUItitle, "Could not run " & $input & " at this time.")
    EndIf
    ProcessWaitClose($pid)
EndFunc

:whistle:

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