BoguLans

Obtaining URL Adress

7 posts in this topic

Hello!
I have the problem, I've just read a guide of AutoIt, but I don't know how to make one thing.
I need to get on specific adress of the site, but if this adress will change while I will request it (for example, if i will send an adress http://mysite.com/somearticle and it get changed to http://mysite.com/error) the program will close. Else, if the URL will stay normal, program will continue. I know the "if" functions etc. but I dont know command to write the potencially changed adress to the variable.
Could somebody help? I know that my question may be from deep basic, but i really dont know. Also sorry for my bad english. Hope somebody help me.

Share this post


Link to post
Share on other sites



Just show the code, and we'll help.

Cheers, Starf0x

Share this post


Link to post
Share on other sites

Thanks for quick response!

I would show my code, but... It's empty. I have to start with the conditional "if", but i dont know any http command... I need to do this only in program, not in browser, and as i said, when i will send request adress, it should return the same adress, but else, it will stop the program. That's analogic to enter the adress in the adress bar in browser for example http://www.google.pl/somethinghere , but when I will enter the adress and then the adress will change to http://www.google.pl/somethinghere?error, the program will exit. If the written adress will stay (when I will write http://www.google.pl/somethinghere and the site will load without changing adress) program will do another instruction.

Share this post


Link to post
Share on other sites

Try something like:

#include <IE.au3>

Local $sURL = "www.autoitscript.com"
Local $oIE = _IECreate($sURL)
_IELoadWait($oIE)
;~ Retrieves the URL of $oIE.
Local $sGetURL = _IEPropertyGet($oIE, 'locationurl')
;~ Will show its been redirected to www.autoitscript.com/site/
MsgBox(0,'', $sGetURL)

 

Share this post


Link to post
Share on other sites

Yes, that's almost exactly that I want, thanks! 
But I have one more question too, could I do that this script won't open the IE browser, but do it all only in script? 
Really thank you for that code anyway!

Share this post


Link to post
Share on other sites
13 minutes ago, jguinch said:

Take the time to look at the help file. _IECreate has an option to run IE hidden.

 

Got it, I've just added some parameters:

Quote

Local $oIE = _IECreate($sURL, 0, 0, 0)

Thank you all for your help!

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