Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sure the process finished... (2000 sr 1)

    I have this command line into amcroa and i would want to be sure this process are finished, how to make this controll?
    I have used the event waittime but not are sure of this strategy.....

    Kill "E:MACRODIFRONZOGOTFI200"

    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 15
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime


    X = Shell("E:MACRODIFRONZOIPSEMA.BAT", vbHide)

    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 25
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime

    The bat file:
    E:MACRODIFRONZOpkunzip -o a:*.zip E:MACRODIFRONZO

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: sure the process finished... (2000 sr 1)

    The instruction Kill "E:MACRODIFRONZOGOTFI200" deletes a file, and I assume that the unzip operation creates that file again. You could use a loop and test if the file is gone, then unizp, and loop until the file is present:

    Kill "E:MACRODIFRONZOGOTFI200"
    Do
    Application.Wait Now + TimeSerial(0, 0, 5)
    Loop Until Dir("E:MACRODIFRONZOGOTFI200") = ""

    X = Shell("E:MACRODIFRONZOIPSEMA.BAT", vbHide)
    Do While Dir("E:MACRODIFRONZOGOTFI200") = ""
    Application.Wait Now + TimeSerial(0, 0, 5)
    Loop

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: sure the process finished... (2000 sr 1)

    Kill "E:MACRODIFRONZOGOTFI200"
    Do
    Application.Wait Now + TimeSerial(0, 0, 5)
    Loop Until Dir("E:MACRODIFRONZOGOTFI200") = ""

    ... is possible to controll (with similar ON ERROR) if the file to be deleted not existis got to, in every case, the next line and if existis delete it and go to the nex line of code....

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: sure the process finished... (2000 sr 1)

    peraphs this is a good idea?:

    On Error GoTo 10
    Kill "E:MACRODIFRONZOGOTFI200"
    Do
    Application.Wait Now + TimeSerial(0, 0, 5)
    Loop Until Dir("E:MACRODIFRONZOGOTFI200") = ""

    10
    X = Shell("E:MACRODIFRONZOIPSEMA.BAT", vbHide)
    Do While Dir("E:MACRODIFRONZOGOTFI200") = ""
    Application.Wait Now + TimeSerial(0, 0, 5)
    Loop

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: sure the process finished... (2000 sr 1)

    You should be able to write the code yourself - higher up in this thread you can see how to use Dir to find out if a file exists.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •