Sign in to follow this  
Followers 0
Rewl

Click button and go to webpage?

10 posts in this topic

So this is my first day programming in Auto IT and I'm making a tool kit with buttons that I want to go to a website. Is this the right code for it?

Case $Builds
            _IENavigate($iE, "http://www.google.com")

Again, first day doing it. I have $iE = _IECreate() and i do have the #include <IE.au3>

if you fix it to amke it right please put comments or explain why mine isnt right. Thankyou


[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites



There is nothing to fix. You've only given us 2 lines of the code to work with. I'm assuming the Case statement is in a Switch but where is that Switch? I'm also assuming that $Builds is the button you are talking about but again there is nothing to show that one way or the other. If you tried, the code and it worked, then it's right. If it didn't work then it's not right but we will need more info to determine what isn't right about it. Do you in fact even need the IE.au3 file? If all you are using for is to open a page in your web browser then you could simply use

Case $Builds
    ShellExecute("http://www.google.com")

Without some more information it is pretty difficult to give you any guidance.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you don't need to automate the webpage, and simply want the user to visit it, or to link to it, just do it like this:

Case $Builds
ShellExecute("http://www.google.com")

What ShellExecute() does, is to call the correspondent program to run the command http://, and it will call the defined browser, either IE, or FireFox, or some other.

Your code would need for you to include IE.au3, or else it wouldn't work, and in my opinion, it is a waste of an object variable to do it. It is way simpler like this.

Edited by jiglei

Share this post


Link to post
Share on other sites

thanks guys, yeah i know it's really not that much code but i've only been learning auto it for about 2 hours so, can't blame me. and it worked, thanks guys!


[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

There was no blame or critisism intended, simply a statement that we needed more info.

By the way; Welcome to the forums.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

There was no blame or critisism intended, simply a statement that we needed more info.

By the way; Welcome to the forums.

Thankya. Another question if you have time

I want my case $MenuItem4 to close the program. When I type

Case $MenuItem4
Exit

The program won't load.

Here's source

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Builds
 ShellExecute("http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=diablo+2+1.1.3+builds")
        Case $Calc
            ShellExecute("calc.exe")
        Case $Log
            ShellExecute("Notepad.exe")
        Case $MenuItem4
            
        


 EndSwitch
WEnd

[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This is one of the beauties of Switch statements. You can have more than a single message perform the same function.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $MenuItem4
            Exit
        Case $Builds
             ShellExecute("http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=diablo+2+1.1.3+builds")
        Case $Calc
            ShellExecute("calc.exe")
        Case $Log
            ShellExecute("Notepad.exe")
    EndSwitch
WEnd
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Ah, as I see. Thanks man! Cheers


[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

@ Geosoft

Sorry am i understanding that correctly

Case $GUI_EVENT_CLOSE, $MenuItem4
            Exit

Is this saying that you have tied 2 exit choices under one command?, either the program inbuilt detection or the $menuitem.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

That's correct. In a Switch statement, NOT in a Select, you can use the method I showed. The comma is the same as using an OR statement.

Here is another tip that applies only to Switch.

If you are dealling with GUI controls which are consecutive, you can use this.

Case $Ctrl_1 To $Ctrl_10
    ;; Do Something

It works well for things like setting the state of multiple checkboxes.

EDIT: Also great when you need to perform functions using dynamically created controls.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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