Sign in to follow this  
Followers 0
JohnMC

run/shell execute from inside function

2 posts in this topic

#1 ·  Posted (edited)

so i started to throw together a script to start a aplication and then restart it if its closed for some reason, but ive found a very strange result when the script executes the program from within my function using variables in place of the path, i cant even imagine what im doing wrong, but when the program runs its as if its not interacting with explorer corectly, it starts but 2 or more other items open in the task bar that have no visable GUI, and they have titles like 000000C1C_PID, also the program window minimizes to to the edge of the desktop asif explorer isnt running.

This works perfectly even when i put it in a loop

while 1
         if ProcessExists("SyncBackSE.exe")=0 then ShellExecute ( "SyncBackSE.exe","","C:\Program Files\2BrightSparks\SyncBackSE")oÝ÷ ÚÉ^ztÓ§u«­¢+ÙÝ¡¥±Ä(ÍÑÉÐ ÅÕ½ÐíèÀäÈíAɽɴ¥±ÌÀäÈìÉ  É¥¡ÑMÁÉ­ÌÀäÈíMå¹  ­MÀäÈíMå¹    ­M¹áÅÕ½Ðì¤(ͱÀ ÄÀÀ¤)ݹ()Õ¹ÍÑÉÐ ÀÌØíÕ±°°ÀÌØí±ôÀ°ÀÌØíѥѱôÀ¤($ÀÌØíáõMÑÉ¥¹QÉ¥µ1Ð ÀÌØíÕ±°±MÑÉ¥¹%¹MÑÈ ÀÌØíÕ±°°ÅÕ½ÐìÀäÈìÅÕ½Ðì°À°´Ä¤¤($ÀÌØíÁÑ õMÑÉ¥¹1Ð ÀÌØíÕ±°±MÑÉ¥¹%¹MÑÈ ÀÌØíÕ±°°ÅÕ½ÐìÀäÈìÅÕ½Ðì°À°´Ä¤´Ä¤($(%¥AɽÍÍá¥ÍÑÌ ÀÌØíá¤ôÀÑ¡¸($%ͱÀ ÔÀÀ¤($$íIÕ¸ ÀÌØíÕ±°°ÀÌØíÁÑ ¤($%M¡±±áÕÑ ÀÌØíá°ÅÕ½ÐìÅÕ½Ðì°ÀÌØíÁÑ ¤(($¥ÀÌØí±ôÅÕ½Ðí´ÅÕ½ÐìQ¡¸($%]¥¹]¥Ð ÀÌØíѥѱ¤($%ͱÀ ÔÀÀ¤($%]¥¹MÑMÑÑ ÀÌØíѥѱ°ÅÕ½ÐìÅÕ½Ðì±M]}5%9%5%i¤($¹¥(%¹%($)¹Õ¹

ps both shellexecute and run have the same resulting issue within my function

thanks in advance for any help

********************

Update:

so i still dont know what to think of this issue, but i found it had to do with the fact i didnt nest the 2nd if statement within the first, but seeing as the criteria for that if statement was never met, i dont understand what the hell happend. whatev

Edited by JohnMC

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ok since your code seems a little strange I',m going to do my best to fix it up :)

;
;~ while 1
 If using more than one line of code in a if statement you must use the if statement as follows:
If ProcessExists("SyncBackSE.exe") = 0 Then
    ShellExecute("SyncBackSE.exe", "", "C:\Program Files\2BrightSparks\SyncBackSE")
    start("C:\Program Files\2BrightSparks\SyncBackSE\SyncBackSE.exe")
EndIf



;~  Sleep(50)
;~ WEnd


Func start($full, $flag = 0, $title = 0)
    $exe = StringTrimLeft($full, StringInStr($full, "\", 0, -1))
    $path = StringLeft($full, StringInStr($full, "\", 0, -1) - 1)
    If ProcessExists($exe) = 0 Then
        Sleep(500)
        ;Run ($full,$path)
        ShellExecute($exe, "", $path)
    EndIf

    If $flag = "m" Then ; Where does this m come from??
        WinWait($title)
        Sleep(500)
        WinSetState($title, "", @SW_MINIMIZE)
    EndIf
EndFunc   ;==>start

I didn't know if this was the entire script but I threw in a while loop for you.

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
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
Sign in to follow this  
Followers 0