Button ; <

04/07/2010 19:23 Dostrix#1
Hey!
How i can set to button run exe program?

I click to button and next program (exe) started

thanks
04/07/2010 20:26 mipez#2
Run or ShellExecute
04/07/2010 20:50 .nAno#3
Quote:
Originally Posted by mipez View Post
Run or ShellExecute
...wenn schon :P

I think "Run" isn't such a good Function to Call a new Process, i prefer ShellExecute.

I'm not able to understand what you need to know, but i'll show you what you some solutions to solve your Problem:

Call 1 Process by pressing a button:
PHP Code:
$button GUICtrlCreateButton (...)
...

Switch 
GuiGetMsg()
     Case 
$button
           ShellExecute 
(...)
...
EndSwitch 
This Code isn't executable, you'll have to fill in the Parameters and so on ;)

Call 2 or more process by pressing a button:
PHP Code:
Dim $array_with_executable [3]

$array_with_executable [0] = "C:\Path1"
$array_with_executable [1] = "C:\Path2"
$array_with_executable [2] = "C:\Path3"

$i 0

$button 
GUICtrlCreateButton (...)
...


Switch 
GuiGetMsg()
     Case 
$button
           ShellExecute 
($array_with_executable[$i], ... )
           
$i $i 1
...
EndSwitch 
These example don't inlcude any error preventing Stuff or so ;)
04/07/2010 20:59 mipez#4
Quote:
Originally Posted by .nAno View Post
PHP Code:
Dim $array_with_executable [3]

$array_with_executable [0] = "C:\Path1"
$array_with_executable [1] = "C:\Path2"
$array_with_executable [2] = "C:\Path3"

$i 0

$button 
GUICtrlCreateButton (...)
...


Switch 
GuiGetMsg()
     Case 
$button
           ShellExecute 
($array_with_executable, ... )
           
$i $i 1
...
EndSwitch 
Isses nicht leichter einfach eine ShellExecute nach der anderen auszuführen?
Isn't it easier to execute one ShellExecute after another?
PHP Code:
While 1
    $msg 
GUIGetMsg()
    Switch 
$msg
        
Case $button
            ShellExecute
("exename","""yourpath")
            
ShellExecute("exename","""yourpath")
            
ShellExecute("exename","""yourpath")
            ...
    EndSwitch
WEnd 
04/07/2010 21:27 .nAno#5
i guess "next Programm" doesn't mean start all Programms at once ;)
04/07/2010 21:33 mipez#6
Quote:
Originally Posted by .nAno View Post
i guess "next Programm" doesn't mean start all Programms at once ;)
Ah you mean: Click the button the first time -> first prog starts, Click it a second time -> second prog starts, and so on Oo
Well, that speaks for itself xD

(Warum reden wir eig englisch? xD)
04/07/2010 21:36 .nAno#7
because this thread is an englisch one :P
04/07/2010 21:38 mipez#8
Quote:
Originally Posted by .nAno View Post
because this thread is an englisch one :P
...english xD

Ah, hey Dostrix, did ya understand?
04/08/2010 15:00 Dostrix#9
but I want to set up a another bot which is located in the same folder.
and whats is "yourpath" ? its np. "C:\Documents and Settings\Rafał\Pulpit\Dostrix Bot" ?
04/08/2010 17:57 mipez#10
Quote:
Originally Posted by Dostrix View Post
but I want to set up a another bot which is located in the same folder.
and whats is "yourpath" ? its np. "C:\Documents and Settings\Rafał\Pulpit\Dostrix Bot" ?
Well, path means the location of the folder where your .exe should be.
04/08/2010 19:17 Dostrix#11
its dont work : <
Quote:
While 1
$msg = GUIGetMsg()
Switch $msg
Case $button
ShellExecute("Jedzenie","", "C:\Documents and Settings\Rafał\Pulpit\Dostrix Bot")
...
EndSwitch
WEnd
and i have
Quote:
$button = GUICtrlCreateButton("Jedzenie", 20, 20, 60, 30)
GUICtrlSetOnEvent($button , "button")
04/08/2010 20:45 mipez#12
ShellExecute("Jedzenie.exe","", "C:\Documents and Settings\Rafał\Pulpit\Dostrix Bot")

You forgot .exe^^
04/08/2010 20:51 Dostrix#13
again dont work : <
04/09/2010 12:08 mipez#14
...grr...
Don't know why, but try this:
Code:
$path = "C:\Documents and Settings\Rafał\Pulpit\Dostrix Bot"
ShellExecute($path & "\Jedzenie.exe","", $path)
This little \ troubled me many times in my own scripts.
04/09/2010 14:00 Dostrix#15
Quote:
While 1
$msg = GUIGetMsg()
Switch $msg
Case $button
$path = "C:\Documents and Settings\Rafał\Pulpit\Dostrix Bot"
ShellExecute($path & "\Jedzenie.exe","", $path)
...
EndSwitch
WEnd
nothing : <