Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Waiting for Sys.Exec to Finish Execution
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
vahnx




PostPosted: Fri Feb 24, 2012 2:57 pm   Post subject: Waiting for Sys.Exec to Finish Execution

What is it you are trying to achieve?
Downloading images using a .vbs script


What is the problem you are having?
Sys.Exec continues to execute my code and doesn't wait for the .vbs script to complete


Describe what you have tried to solve this problem
Looked for Sys.Exec controls in the Turing doc and other methods to execute my vbs script from Turing


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here> <<< SAY WHAT

Turing:


if Sys.Exec ("download_images.vbs") then
     % DO STUFF
     % WOAH DUDE WAIT FOR VBS SCRIPT TO FINISH MAN I CANT DRAW AN IMAGE UNTIL ITS DOWNLOADED!
end if



Please specify what version of Turing you are using
4.1.2

PS Clicking Submit and forgetting a title causes this form template to wipe out! Could a forum manager fix that? Thank god back space remembered.
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Feb 24, 2012 3:11 pm   Post subject: RE:Waiting for Sys.Exec to Finish Execution

You could attempt to load until it works.

for example;

code:

loop
exit when pic.load ("your_image.bmp");
end loop


I don't know if this will work (there are syntax errors in that; it won't even compile). You'll have to look into the documentation for images to see if this is possible.
vahnx




PostPosted: Fri Feb 24, 2012 3:13 pm   Post subject: RE:Waiting for Sys.Exec to Finish Execution

I wrote a loop before it attempts to load the image, does a If File.Exists(array) on an image array I made which practically solves my problem... except if an image exists before it fully downloads. Maybe in my vbs script I can download to a temp directory then move them to the turing folder when complete..
Insectoid




PostPosted: Fri Feb 24, 2012 3:18 pm   Post subject: RE:Waiting for Sys.Exec to Finish Execution

You could download them under alternate names, and then rename them when they've finished.
vahnx




PostPosted: Fri Feb 24, 2012 3:22 pm   Post subject: Re: Waiting for Sys.Exec to Finish Execution

Not to go off topic by switching languages, but do you know how to make vbs wait for a file to finish downloading before going to the next object?

code:

dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
dir = "http://i133.photobucket.com/albums/******"
fileName = array("woods","barn","sheep","god","ghost","deadend","mexico","desert","oasis","death")
'0,1,2 etc.

for i = 0 to 9
   xHttp.Open "GET", "http://i133.photobucket.com/albums/******" & fileName(i) & ".jpg", False
   xHttp.Send

   with bStrm
      .type = 1 '//binary
      .open
      .write xHttp.responseBody
      .savetofile "images/" & fileName(i) & ".jpg", 2 '//overwrite
      .close
   end with
next
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: