Results 1 to 14 of 14

Thread: [RESOLVED] wait until execute

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Resolved [RESOLVED] wait until execute

    how can i delay the function
    insword

    until the the previous shell executes

    VB Code:
    1. 'open command prompt to run Python script
    2.  Open Apath & "dos.bat" For Output As #1
    3.     Print #1, "cd C:\python24"
    4.     Print #1, "buckwalter2unicode.py -i C:\newfile.txt -o C:\newoutfile.txt -E mbcs"
    5.     Close #1
    6.     Shell Apath & "dos.bat"
    7.    
    8.  
    9.  insword

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: wait until execute

    Won't this be finished when "C:\newoutfile.txt" is created? If so, do it in a Do Loop.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: wait until execute

    Yes it will finished when "C:\newoutfile.txt" is created

    OK
    how can i check its existing before opening it in the function insword
    if file exist then open it


    do while "newoutfile.txt" exist
    Open "C:\buckwalter_morphan_1\data\newoutfile.txt" For Input As #ff
    tmp = Split(Input(LOF(1), 1), vbCrLf)
    loop

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: wait until execute

    God no!

    Check for file existence with the DIR command
    VB Code:
    1. Do While Dir("Yourfilename")=""
    2.    DoEvents
    3. Loop

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: wait until execute

    thanks randem


    but this didn't work because
    the shell command will write to the file newoutfile.txt
    and the do while will execute the function just after creation and befor finish writing

    which will give me unwanted output

    so how can i start insword after writing to file

  6. #6
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: wait until execute

    Well, after you detect the file then you attempt to gain exclusive access.

    Will the file be a specific size when created?

  7. #7
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: wait until execute

    Dear om-yousif,
    Have a look at this thread
    Please mark you thread resolved using the Thread Tools as shown

  8. #8

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: wait until execute

    thanks danasegarane
    its exactlly what i need
    but how can i hide the command prompt window
    i don't want it to be visible to the user

  10. #10

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: wait until execute

    ???? gavio ?????

    i'm new in VB
    what did you say

  12. #12
    Member
    Join Date
    Aug 2006
    Location
    Arabian Gulf
    Posts
    46

    Re: wait until execute

    Hi om-yousif...
    I think U can write like this:
    VB Code:
    1. ' ShellAndWait Apath & "dos.bat"
    2.     Shell Apath & "dos.bat", vbHide

  13. #13
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: wait until execute

    Why not just ShellandWait???

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    131

    Re: wait until execute

    Thanks everyone i used shellandwait

    thanks again for your help

Posting Permissions

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



Click Here to Expand Forum to Full Width