Autoxics Posted April 19, 2006 Share Posted April 19, 2006 This works fine when the script is anywhere execpt in the temp folder it does not work, well the first part does , as if Notepad is running, but the else statment does not if notepad in not running however booth statments works well if the script is execute in from another directory , like C:\ $var = ProcessExists("Notepad.exe") If ProcessExists("Notepad.exe") Then MsgBox(4096, "", "Notepad Is Running.") Else If @compiled Then Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @ScriptFullPath, "D:/.", @SW_HIDE) Sleep (10) EndIf EndIF Exit So i figured it must be a missing @TempDir so i tried this but with no luck Where have i gone wrong? Please try out the code if you want to. $var = ProcessExists("Notepad.exe") If ProcessExists("Notepad.exe") Then MsgBox(4096, "", "Notepad Is Running.") Else If @compiled Then Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @TempDir & @ScriptFullPath, "D:/.", @SW_HIDE) Sleep (10) EndIf EndIF Exit Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 19, 2006 Moderators Share Posted April 19, 2006 (edited) Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @TempDir & @ScriptFullPath, "D:/.", @SW_HIDE)That doesn't look right (in red). Edit: Also your @TempDir & @ScriptFullPath doesn't make much sense either.... My suggestion is for you to debug like this at the top:MsgBox(0, 'Info', @TempDir & @ScriptFullPath) so you can see for yourself. Edited April 19, 2006 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 More sharing options...
Valuater Posted April 19, 2006 Share Posted April 19, 2006 (edited) this cant be right either @TempDir & @ScriptFullPath 8) Aw,,, smoke came back and got that one too.. Edited April 19, 2006 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 19, 2006 Moderators Share Posted April 19, 2006 Aw,,, smoke came back and got that one too..lol, Although I don't play with run commands often, nor do I mess with del at all, I would imagine that you would need a space after del as well. 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 More sharing options...
Autoxics Posted April 19, 2006 Author Share Posted April 19, 2006 I get an error on that one "Incorrect Number of parameters" Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 19, 2006 Moderators Share Posted April 19, 2006 I get an error on that one "Incorrect Number of parameters"What did you try?... I said that D:/. doesn't look right... Try just putting "" there. 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 More sharing options...
Autoxics Posted April 19, 2006 Author Share Posted April 19, 2006 I put the compile script here C:\Documents and Settings\Administrator\Local Settings\Temp and i used this $var = ProcessExists("Notepad.exe") If ProcessExists("Notepad.exe") Then MsgBox(4096, "", "Notepad Is Running.") Else If @compiled Then Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @TempDir & @ScriptFullPath, "", @SW_HIDE) Sleep (10) EndIf EndIF Exit Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 19, 2006 Moderators Share Posted April 19, 2006 I put the compile script here C:\Documents and Settings\Administrator\Local Settings\Temp and i used this $var = ProcessExists("Notepad.exe") If ProcessExists("Notepad.exe") Then MsgBox(4096, "", "Notepad Is Running.") Else If @compiled Then Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @TempDir & @ScriptFullPath, "", @SW_HIDE) Sleep (10) EndIf EndIF ExitDid you try the Message Box I put up there... or did I just type it for fun? You'll see what your problem is. 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 More sharing options...
Autoxics Posted April 19, 2006 Author Share Posted April 19, 2006 (edited) I tried it out to put this ontop of my script MsgBox(0, 'Info', @TempDir & @ScriptFullPath) I runed the script in C:\Documents and Settings\Administrator\Local Settings\Temp I get a message box with path, but i dont know how to use that info in the correct way Edited April 19, 2006 by Autoxics Link to comment Share on other sites More sharing options...
Autoxics Posted April 19, 2006 Author Share Posted April 19, 2006 This is the box i get , Should i put this exact name in between the "" Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 19, 2006 Moderators Share Posted April 19, 2006 (edited) This is the box i get , Should i put this exact name in between the ""Ugh!!Look at it... does that look right? You have 2 paths there. Just use @ScriptFullPath Edited April 19, 2006 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 More sharing options...
Autoxics Posted April 19, 2006 Author Share Posted April 19, 2006 (edited) Ok i just use this now one of the path i got from the messagebox inbetween this" " and i just use @ScriptFullPath Like this $var = ProcessExists("Notepad.exe") If ProcessExists("Notepad.exe") Then MsgBox(4096, "", "Notepad Is Running.") Else If @compiled Then Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @ScriptFullPath, "C:\Documents and Settings\Administrator\Local Settings\Temp\", @SW_HIDE) Sleep (10) EndIf EndIF Exit But it dont work Edited April 19, 2006 by Autoxics Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 20, 2006 Moderators Share Posted April 20, 2006 Ok i just use this now one of the path i got from the messagebox inbetween this" " and i just use @ScriptFullPath Like this $var = ProcessExists("Notepad.exe") If ProcessExists("Notepad.exe") Then MsgBox(4096, "", "Notepad Is Running.") Else If @compiled Then Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @ScriptFullPath, "C:\Documents and Settings\Administrator\Local Settings\Temp\", @SW_HIDE) Sleep (10) EndIf EndIF Exit But it dont workWhat are you trying to do exactly? 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 More sharing options...
Autoxics Posted April 20, 2006 Author Share Posted April 20, 2006 (edited) No Worriys i got it working! I want to use this on a project i am working on witch if a cetaint process is running i want to keep the script alive and as soon as a that certain process is not active anymore i want the script exits and deletes itself right away, you been a great help here, i ve been scratching my brain substanse here trying to figure it out and it was pretty simple ones i tried out a few codes from the help @ScriptName that was the fellow that did it ! anyway here is the code if anyone ellse needs it! And thank you SmOke_N for trying to figure it out and helping me, without you i dont think id manage to solve it, Great forum support, and as a thank you to the forum and for this free terrific applications i have decided to donate a few bucks to the development of Autoit, so you guys gets some credits for the help you give. Any help is most appriciated And the help ive got so far is to good to be true!thanks for doing what you guys do! I hope to be able to help others out aswell, when ive become more than a noob $var = ProcessExists("Notepad.exe") If ProcessExists("Notepad.exe") Then MsgBox(4096, "", "Notepad Is Running.") Else If @compiled Then Run(@ComSpec & " /c " & 'ping -n 1 localhost & del ' & @ScriptName, "", @SW_HIDE) Sleep (10) EndIf EndIF Exit Edited April 20, 2006 by Autoxics Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now