Jump to content

Problem with IE.au3.


Recommended Posts

Ha glad I could get it to work for you! It seemed as though you can't use on _IELoadWait (or rely on anything that waits for the the instance of IE to finish loading, hence you need IELinkClickByText($oIE,$charactername,0,0)) at all for the game page.

Either live with a Sleep command, or work on finding another way to test if the page is finished loading.

Good luck!

EDIT: Didn't see you were having trouble with it moving on to another fight... I may check out the game but for right now I just joined to see if I could help, do me a favor and see if you can get anywhere on your own or at least reduce the code your having a problem with. If you can't get it I'll try to come back on and see if I can get it to work.

Edited by someone
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

lol, nice avatar. You could always do a pixelsearch to see if some particular area loaded or something, then add a sleep. I think you could even do a checksum on an entire area. I've never tried that before, though..

Everything is loading , and I'm using sleep to make sure it does in fact load in time.

However, after finishing the fight, it still hangs (without printing out an error message.)

Link to comment
Share on other sites

The problem is exactly

Edit

It just loops there nonstop.

Is there a way to make it stop until

EDIT

the width of that is 100%?

Because that represents the health bar.

Or when

EDIT

Those two numbers are equal?

Edited by Federalist
Link to comment
Share on other sites

func heal()
do
heal crap
until
$oStatsFrame = _IEGetObjById($oIE, "theframe")
$statsClip = _IEDocReadHTML($oStatsFrame)
StringInStr($Clip, "120/120")
endfunc

Someone PMed this to me.

It did not work , and it's not what I'm really looking for.

I just can't find any code that will call the HTML and sleep until it reads a "100%".

Link to comment
Share on other sites

func heal()
do
heal crap
until
$oStatsFrame = _IEGetObjById($oIE, "theframe")
$statsClip = _IEDocReadHTML($oStatsFrame)
StringInStr($Clip, "120/120")
endfunc

Someone PMed this to me.

It did not work , and it's not what I'm really looking for.

I just can't find any code that will call the HTML and sleep until it reads a "100%".

Ha me someone? If I did I have to get more sleep because I don't remember that at all... but anyway, here this will work for you...

Do 
    Sleep(500)
    $oHP = _IEGetObjById ($oIE, "pHP")
    $HP = _IEPropertyGet($oHP, "innertext")
    $HP_WS = StringStripWS($HP, 8)
    $HP_Array = StringSplit($HP_WS, "/")
    _ArrayDisplay($HP_Array)
Until $HP_Array[1] = $HP_Array[2]

_IELinkClickByText($oIE,"Fight Another Level 1 Monster",0,0)

You can add a MsgBox(0, "", $HP) if you want to see what it looks like before using stringsplit. I used stringstripWS to remove all whitespace in the "40 / 40" text. You may not need that but I thought that might avoid a problem down the road. From there, stringsplit splits "40/40" by "/". The loops ends when the first part of stringsplit (40) equals the second part (40). Run the code after you killed a monster while your health is regenerating to see it work.

Hope this helps!

Edited by someone
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

Per a previous question... can I tell when the text in a DIV represents equal values...

I took your HTML and created an htm file and opened it in the browser...

<HTML><TITLE>Foo</TITLE><BODY>
<DIV class=statValue id=pHP>1592 / 1665</DIV>
</BODY></HTML>

Now study this code...

#include <IE.au3>
$oIE = _IEAttach("Foo")
$oDiv = _IEGetObjById($oIE, "pHP")
$sText = _IEPropertyGet($oDiv, "innertext")
ConsoleWrite("InnerText of DIV = " & $sText & @CR)
$quotient = Execute($sText)
ConsoleWrite("quotient = " & $quotient & @CR)
ConsoleWrite("Does quotient equal 1? " & ($quotient = 1) & @CR)

Produces this output...

InnerText of DIV = 1592 / 1665
quotient = 0.956156156156156
Does quotient equal 1? False

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Per a previous question... can I tell when the text in a DIV represents equal values...

I took your HTML and created an htm file and opened it in the browser...

<HTML><TITLE>Foo</TITLE><BODY>
<DIV class=statValue id=pHP>1592 / 1665</DIV>
</BODY></HTML>

Now study this code...

#include <IE.au3>
$oIE = _IEAttach("Foo")
$oDiv = _IEGetObjById($oIE, "pHP")
$sText = _IEPropertyGet($oDiv, "innertext")
ConsoleWrite("InnerText of DIV = " & $sText & @CR)
$quotient = Execute($sText)
ConsoleWrite("quotient = " & $quotient & @CR)
ConsoleWrite("Does quotient equal 1? " & ($quotient = 1) & @CR)

Produces this output...

InnerText of DIV = 1592 / 1665
quotient = 0.956156156156156
Does quotient equal 1? False

Dale

Thanks a bunch someone & Dale.

And when I say "someone" pmed this to me, I meant some random person. Not you. XD

I'll test those when I get home, but I have a VERY good feeling about both of them working.

Stringsplit seemed a circuitous route to doing this - this seems a lot better.

Link to comment
Share on other sites

someone, you never cease to amaze. :)

Your code worked wonders , and the entire thing works now. ^_^

I was just wondering - if I wanted it to have three 'random options' , how would I do that?

I know how to do it for two...

EDIT

But how do I do it for three?

Like if I wanted random to be 1, 20 , 5, 1

?

Edited by Federalist
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...