Sign in to follow this  
Followers 0
Clever1mba

File WaitClose

8 posts in this topic

HELLO

How i can wait until process close then wait for file delete and then go for copy

ProcessClose("autoit.exe")

FileDelete(@SystemDir & "\autoit.exe")

FileCopy(d:\Newautoit.exe",  @SystemDir & "\NewAutoit.exe")

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

The help says the ProcessClose returns none

try something like

ProcessClose("autoit.exe")
$PID = ProcessExists("autoit.exe")
While $PID
   Sleep (1000)
   $PID = ProcessExists("autoit.exe")
   if $PID then
     ProcessClose($PID)
   endif
Wend

or

ProcessClose("autoit.exe")
$PID = ProcessExists("autoit.exe")
if $PID then
   ProcessWaitClose($PID)
endif
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

if(FileDelete(@SystemDir & "\autoit.exe")) then
; do something
endif

it's all in the help.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

While FileExists("somefile.txt")

FileDelete("somefile.txt")

WEnd

Or you can compile the FileDelete() into a separate exe and do a RunWait.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

There are many ways you could do this, but I would do something like...

$Program_1 = "blah.exe"
$Program_2 = "test.exe"
$Program_3 = "blahblah.exe"

$Kill_Process = StringSplit($Program_1 & "," & $Program_2 & "," & $Program_3, ",")

For $I = 1 To $Kill_Process[0]
   ProcessClose($Kill_Process[$I])
Next
Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

HELLO

PLZ tell me easy way to put multi process your example works fine but need lots of type if process list more then 250 is there any to put list single line NOT LIKE $Program_1 = "blah.exe" AND then add

StringSplit in this take more time to and take more space so i want to know single line addition way for multi process kill

$Program_1 = "blah.exe"

$Program_2 = "test.exe"

$Program_3 = "blahblah.exe"

$Kill_Process = StringSplit($Program_1 & "," & $Program_2 & "," & $Program_3, ",")

For $I = 1 To $Kill_Process[0]

  ProcessClose($Kill_Process[$I])

Next

like webpage keyword added blah, blah.com etc it easy way to add

<{POST_SNAPBACK}>

If you dont want his advice then figure it out. He offered you the best way to do it. Now if you want another way it is right in his example. You can skip one step.

Just do...

$Kill_Process = StringSplit("blah.exe,test.ext,blahblah.exe,testtest.exe,blahtest.exe,etc.exe", ",")

Just some thoughts,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

@ asimzameer :

Untested, but something like this might work :

$stopservice = StringSplit("SharedAccess,wscsvc", ",")

For $i = 1 To $stopservice[0]
    Sleep(10)
    RunWait(@ComSpec & " /c " & "net.exe stop " & $stopservice[$i],"",@SW_HIDE)
Next

Good luck !

-Helge-

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