Sign in to follow this  
Followers 0
Nightblade

Noob help with IE

10 posts in this topic

Greetings,

I am a complete noob with autoit, but I like its funtionality.

Just wish I had a clue

I am currently playing with a script, that'll automate moving from sector to sector and trading with a port in this web based game called BlackNova Traders.

Currently my script looks like this:

; BNT Trade wars starting out in Sector 276

$count = 1

Do

Sleep(1000)

;Trade with Port (Energy)

MouseClick ("left", 452,381)

WinWaitActive ("http://bnt1.blacknova.net/port.php", "", 30)

MouseClick ("left", 37,510)

WinWaitActive ("http://bnt1.blacknova.net/port2.php", "", 30)

MouseClick ("left", 63,597)

WinWaitActive ("http://bnt1.blacknova.net/main.php", "", 30)

;Move to sector 3203

MouseClick ("left", 90,670)

WinWaitActive ("http://bnt1.blacknova.net/main.php", "", 30)

;Trade with Port (Ore)

MouseClick ("left", 457,382)

WinWaitActive ("http://bnt1.blacknova.net/port.php", "", 30)

MouseClick ("left", 41,508)

WinWaitActive ("http://bnt1.blacknova.net/port2.php", "", 30)

MouseClick ("left", 59,597)

WinWaitActive ("http://bnt1.blacknova.net/main.php", "", 30)

;Move to sector 276

MouseClick ("left", 90,630)

WinWaitActive ("http://bnt1.blacknova.net/main.php", "", 30)

$count = $count + 1

Sleep(10000)

until $count > 20

Sorry, if this wasnt the most appropriate way of showing it.

I used to use sleep(30000) in between mouseclicks

but i am looking for a way for WinWaitActive to recognize when the page is loaded. I have tried looking up in the forums but anything close usually was way above me head :)

nB

Any help would be appreciated

nB

Share this post


Link to post
Share on other sites



You state this

WinWaitActive ("http://bnt1.blacknova.net/port.php", "", 30)

help states this

WinWaitActive ( "title", ["text"], [timeout] )

Your http is not the title.......however if you use this

WinWaitActive ( "", "", 30 )

the script will wait 30 seconds for the "last window called" to become active

Hope it helps

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

One way to tell if a page is loaded is to check pixels colors of the loaded page. Use the tool that came with AutoIt3 to find out what the color and location is.

$color = ______; Fill in the blank with the number for the color after the page has loaded
Do
    Sleep(1000)
    $location = PixelGetColor(x,y,)
Until $location = $color

Find the color and get the "x" and "y" location of a color that is unique to the loaded page.


.

Share this post


Link to post
Share on other sites

You state this

WinWaitActive ("http://bnt1.blacknova.net/port.php", "", 30)

help states this

WinWaitActive ( "title", ["text"], [timeout] )

Your http is not the title.......however if you use this

WinWaitActive ( "", "", 30 )

the script will wait 30 seconds for the "last window called" to become active

Hope it helps

8)

<{POST_SNAPBACK}>

Yeah i got that idear after a few times playing with it, and I just threw in the time (30) to allow enough time for the page to load.

Tried a bunch o times to find something to use as the title or text, but I couldnt figure out anything - not sure what in the heck im lookin for, doah

nB

Share this post


Link to post
Share on other sites

Try StatusBarGetText() in the help file or use COM. COM is probaably the most reliable way. Search the forums and there should be examples floating around that work with IE.


[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

#6 ·  Posted (edited)

One way to tell if a page is loaded is to check pixels colors of the loaded page. Use the tool that came with AutoIt3 to find out what the color and location is.

$color = ______; Fill in the blank with the number for the color after the page has loaded
Do
    Sleep(1000)
    $location = PixelGetColor(x,y,)
Until $location = $color

Find the color and get the "x" and "y" location of a color that is unique to the loaded page.

<{POST_SNAPBACK}>

hmm i ll havta looky at this idear

me problem is that sometime the page hangs for awhile when loading.

was looking for a way (not sure if possible) for soemthing to tell autoit when the page is complete like on the very bottom of IE it says done.

Thanks alot guys for the input gives me something to try out

been years since i ve played with programming kinda fun to write scripts again

nB

Edited by Nightblade

Share this post


Link to post
Share on other sites

Try StatusBarGetText() in the help file or use COM. COM is probaably the most reliable way. Search the forums and there should be examples floating around that work with IE.

<{POST_SNAPBACK}>

umm what is COM??

I ve been lookin around the forums here, and has someone written a noob manuel or AutoIT for complete morons book?? as most of the stuff i ve read is way above my head

I like the examples that came in the AutoIt help but they werent enough for me and everything else is so far out there

nB

Share this post


Link to post
Share on other sites

umm what is COM??

I ve been lookin around the forums here, and has someone written a noob manuel or AutoIT for complete morons book?? as most of the stuff i ve read is way above my head

I like the examples that came in the AutoIt help but they werent enough for me and everything else is so far out there

nB

<{POST_SNAPBACK}>

Hmm...

I never notice the StatusBarGetText() function. It does seem like a better way to go with. Unless the game is a Flash game. As for COM, it is above my head and is used more for interfacing with other programming/scripting laugues and some other stuff.

I still have not found that book yet. The way that I learn is by reading the help file, playing with the Exsamples in the exsamples folder and playing with scripts on the forum. There is really just few things to learn. Learn about Data type(strings and numbers), learn about variables, learn how loops works, learn how If statements works, learn how to use functions , learn how to get values out of function and learn how to tie all of those thing togather. After all of that, learn how to use arrays.


.

Share this post


Link to post
Share on other sites

Thanks,

For all the help guys

Well I still cant figure out the winwaitactive or how to use the statusbargettext (got it to work but couldnt understand how to implement it)

Used the get color that quick silver showed me and its working great even faster than i can click on things :)

now i m going havta play with setting up a gui to ask fo rhow many loops you would like the script to run thru

thanks all,

nB

Share this post


Link to post
Share on other sites

Thanks,

For all the help guys

Well I still cant figure out the winwaitactive or how to use the statusbargettext (got it to work but couldnt understand how to implement it)

Used the get color that quick silver showed me and its working great even faster than i can click on things :)

now i m going havta play with setting up a gui to ask fo rhow many loops you would like the script to run thru

thanks all,

nB

<{POST_SNAPBACK}>

You are welcome,

here is a one way to use those functions....

AutoItSetOption("WinTitleMatchMode", 2)
If Not WinActive("Internet Explorer", "") Then
    WinActivate("Internet Explorer", "")
EndIf
Do
;;;;;;;this loop waits for the page to load.
;;;;;;you may need to refreash the page when testing this
    $x = StatusbarGetText("Internet Explorer")
    Sleep(100)
Until $x = "done"
MsgBox(0, "Internet Explorer's status bar says:", $x)

Check to see if the window is active. If not then make that window top most. After the window active checking and activating, sleep until the page is loaded.

P.S. take note of the way the MsgBox is use to show/check the value that a fuction returns.


.

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