Sign in to follow this  
Followers 0
hobie

What is the best way to check the status

5 posts in this topic

I've gotten my first script working with some minor crude logic mostly around sending the "save as" command to IE to save an image. The main problem here is that some images take more time then others to load. I inserted a sleep command after waiting for the IE window to activate and before sending the keystrokes to issue a "save as" command to IE.

; wait for internet explorer to activate
    WinWaitActive("http://internal.org/del.php?img=/images/lab1/scope102/")

    sleep( 2000 )
    ; send "save as"
    Send("{ALTDOWN}f{ALTUP}a")

    ; wait for save as dialog window
    WinWaitActive("Save Picture")

    Send($picture & "{ALTDOWN}s{ALTUP}")

    ; wait for main window to activate
    _WinWaitActivate("http://internal.org/del.php?img=/images/lab1/scope102/","")

    ; then close it
    Send("{ALTDOWN}{F4}{ALTUP}")

I'm looking for a better way to check if IE has finished loading the image before attempting to save it. I've thought about using the waitactive("save as") returning a 0 value and then starting a small delay and then attempting to check the window status again. This seem like a poor choice but I'm not up to programming windows stuff (been doing embedded fw for 30yrs).

I would like to hear some suggestions as to how to go about this in a proper windows programming method.

TIA.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

you can do it something like this if you have url of the page

InetGet("http://pics.internal.org/gallery/sewing/IMG_7085","a.txt");get source of page and save it to some txt doc
$file = FileOpen("a.txt",0);open the doc in read mode

$1 = StringSplit(FileRead($file),'<a id="photo_url" href="',1);read the doc and isolate img url from soure
$2 = StringSplit($1[2],'"',1); -II-

$saveas = StringSplit($2[1],'/',1);isolate the file img name
InetGet($2[1],$saveas[$saveas[0]]);download and save picture with it defolt name

FileClose($file);close the opened txt doc
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

BogQ,

Thank you for your reply. I'll have to try your method but from what I've been told that since the images are part of a data base which I don't have direct access to except via PHP.

Besides that is not what I was attempting to do. The point of the "exercise" was to use a "save as" dialog control to save the image after IE has loaded and to come up with a way to determine that IE has finished loading the image then call the "save as" control to save it.

I would like to learn other ways to interact with IE controls when I become more familiar with AutoIt.

Share this post


Link to post
Share on other sites

Check out the IE Management section under User Defined Functions in the help file, there's a function called _IELoadWait that "Wait for a browser page load to complete before returning."


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Check out the IE Management section under User Defined Functions in the help file, there's a function called _IELoadWait that "Wait for a browser page load to complete before returning."

kaotkbiss,

Thanks for the reply. I've been reading some of the UDF functions - don't remember reading this one, will have to now. Thanks again for the tip.

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