Sign in to follow this  
Followers 0
edena

About Tabs on Keyboard?

22 posts in this topic

I pressed 13 tabs on my keyboard to enter a search keyword in the Google input box using Firefox browser.

When I used Internet Explorer browser it was 48 tabs. (That must be another cause that's slowing the browser! lol!)

OK! back to my question:

What if I create Autoit GUI to do the tabbing for me, will this be the best option or what is the best option.

Please give me a Autoit Help File Function for a better option for _IE.

Thank You.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

_IENavigate to "http://www.google.com/search?q=your+search+here" ?

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Exactly like the example in the help file:

_IENavigate

--------------------------------------------------------------------------------

Directs an existing browser window to navigate to the specified URL.

#include <IE.au3>

_IENavigate ( ByRef $o_object, $s_url [, $f_wait = 1] )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

$s_url URL to navigate to (e.g. "http://www.autoitscript.com")

$f_wait [optional] specifies whether to wait for page to load before returning

0 = Return immediately, not waiting for page to load

1 = (Default) Wait for page load to complete before returning

Return Value

Success: Returns -1

Failure: Returns 0 and sets @ERROR

@Error: 0 ($_IEStatus_Success) = No Error

1 ($_IEStatus_GeneralError) = General Error

3 ($_IEStatus_InvalidDataType) = Invalid Data Type

4 ($_IEStatus_InvalidObjectType) = Invalid Object Type

6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout

8 ($_IEStatus_AccessIsDenied) = Access Is Denied

9 ($_IEStatus_ClientDisconnected) = Client Disconnected

@Extended: Contains invalid parameter number

Remarks

This function always returns a value of -1. This is because the navigate method has no useful return value and therefore nothing can be implied from it. You will need to employ other methods to determine success or failure of the navigation.

New security in Windows Vista causes a new browser window to be created when a browser is instructed to navigate to a URL in a different security zone. This occurs as well with the initial creation and navigation initiated with _IECreate. The new window is a new browser instance and the previous browser object variable no longer points to it. There are several workarounds: 1) add #RequireAdmin to your code (this is required even if the account is part of the Administrator's Group and will propmt for credentials if necessary), 2) use _IEAttach to connect to the new browser window 3) add the target website to the Trusted Sites security zone in IE, 4) turn off "Protected Mode" in IE, or 5) disable UAC. Care must be taken to understand the implications of disabling IE security features when accessing untrusted sites.

Example

; *******************************************************

; Example 1 - Create a browser window and navigate to a website,

; wait 5 seconds and navigate to another

; wait 5 seconds and navigate to another

; *******************************************************

;

#include <IE.au3>

$oIE = _IECreate ("www.autoitscript.com")

Sleep(5000)

_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?")

Sleep(5000)

_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?showforum=9")


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Okay please bare with me just want to understand Autoit techniques,

For argument sake, what if there are two (2) input boxes in the Google search engine, they are vertically arranged and I want to insert my search query to [input box 2].

For example:

[input box 1]

[input box 2]

(Search button)

Is it using tab or navigate you said earlier or what is you best option for this?

Thank You.

Share this post


Link to post
Share on other sites

One such function would be _IEFormElementGetObjByName() perhaps used with _IEFormElementSetValue()

There are many examples in the help file and on the forums, I suggest you study them and try them out, a bit of trial and error is not going to do your learning process any harm at all.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

two (2) input boxes in the Google search engine

Should I understand that these 2 boxes are in YOUR GUI? Fields where you input the search terms?

Very easy:

- when the button is pressed (start)

- use GUICtrlRead to get the text of one input

- replace empty spaces between words with "+"

- add the missing URL bit (http://www.google.com/search?q=)

- create a new IE (as in example)

- navigate to the URL you got from above step

- do the same for every input box you have


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Should I understand that these 2 boxes are in YOUR GUI? Fields where you input the search terms?

Very easy:

- when the button is pressed (start)

- use GUICtrlRead to get the text of one input

- replace empty spaces between words with "+"

- add the missing URL bit (http://www.google.com/search?q=)

- create a new IE (as in example)

- navigate to the URL you got from above step

- do the same for every input box you have

Yes! Sir!,

It's a GUI with two input boxes and a button!!!:)

But one thing, I can't find the GUICtrlRead function in my help file. I'm looking at a whole lot of UDF's and the list comes to GUICtrlRebar_AddBand.

Where will I find the GUICtrlRead function to see an example?

Also why should I must put the plus (+) sign between words in my GUI input boxes (field), am I right here or am I wrong about saying this, if am right then can I just write down the words in my GUI input box?

Thank You!!!

And thanks JohnOne for the option didn't know that too!

Edited by edena

Share this post


Link to post
Share on other sites

If you look in the function list just above _GUICtrlRebar_AddBand you will see the function.

There is no reason why your help file would look different and this function was in AutoIt like forever.

GUICtrlRead

--------------------------------------------------------------------------------

Read state or data of a control.

GUICtrlRead ( controlID [, advanced] )

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate... function.

advanced [optional] returns extended information of a control.

0 = (Default) Returns a value with state or data of a control.

1 = Returns extended information of a control (see Remarks).

Return Value

Success: Returns depending the control (see below).

Failure: Returns 0.

Type Value

Checkbox, Radio state of the button. See State table

Combo, List The value selected

Input, Edit The text entered

Button The display text

Date The selected date

Progress Current percentage

Slider Current value

Tab The number or the controlID of the tabitem selected depending of the advanced parameter value.

Menu, MenuItem State of the menu/item. See State table

TreeView Control identifier (controlID) of the selected TreeViewItem

TreeViewItem State of the TreeViewItem

ListView Control identifier (controlID) of the selected ListViewItem. 0 means no item is selected

Dummy The value set by GUICtrlSendToDummy or GUICtrlSetData

Remarks

In 'advanced' mode the return value contains additional data of the control (see below).

Note: not for all known controls there is additional data available!

Type Additional Value

Checkbox, Radio The text of the control.

Menu, MenuItem The text of the control.

TreeView The text of the current selected TreeViewItem.

TreeViewItem The text of the TreeViewItem.

ListViewItem The state of the ListViewItem if $LVS_EX_CHECKBOXES exStyle used in advanced mode. See State table

Tab The controlID of the tabitem selected

For Checkbox, Radio control several states can be returned as $GUI_FOCUS and $GUI_CHECKED,. So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the control is checked.

For Listview items several states can be returned as $GUI_CHECKED and $GUI_UNCHECKED (only for listview controls with LVS_EX_CHECKBOXES-exstyle and on 'advanced' return) . So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the item is checked.

For Treeview items several states can be returned as $GUI_FOCUS, $GUI_EXPAND and $GUI_CHECKED, $GUI_UNCHECKED (only for treeview controls with TVS_CHECKBOXES-style . So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the item is checked.

Related

GUICtrlUpdate..., GUIGetMsg, GUICtrlSetData, GUIEventOptions (Option), GUICtrlCreate..., GUICtrlGetState, GUICtrlSendToDummy, GUICtrlSendMsg

Example

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()

Local $menu1, $n1, $n2, $msg, $menustate, $menutext

GUICreate("My GUICtrlRead") ; will create a dialog box that when displayed is centered

$menu1 = GUICtrlCreateMenu("File")

$n1 = GUICtrlCreateList("", 10, 10, -1, 100)

GUICtrlSetData(-1, "item1|item2|item3", "item2")

$n2 = GUICtrlCreateButton("Read", 10, 110, 50)

GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button

GUISetState() ; will display an empty dialog box

; Run the GUI until the dialog is closed

Do

$msg = GUIGetMsg()

If $msg = $n2 Then

MsgBox(0, "Selected listbox entry", GUICtrlRead($n1)) ; display the selected listbox entry

$menustate = GUICtrlRead($menu1) ; return the state of the menu item

$menutext = GUICtrlRead($menu1, 1) ; return the text of the menu item

MsgBox(0, "State and text of the menuitem", "state:" & $menustate & @LF & "text:" & $menutext)

EndIf

Until $msg = $GUI_EVENT_CLOSE

EndFunc ;==>Example

I will quote myself here:

- use GUICtrlRead to get the text of one input

- replace empty spaces between words with "+"

You can see that I have advised you to read first the content of the InputBox then replace the spaces = you type the search terms "naturally" and do the processing in background.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

If you look in the function list just above _GUICtrlRebar_AddBand you will see the function.

There is no reason why your help file would look different and this function was in AutoIt like forever.

I will quote myself here:

You can see that I have advised you to read first the content of the InputBox then replace the spaces = you type the search terms "naturally" and do the processing in background.

:) Dem! this is harder than I thought but very exciting.

No wander people just come here to ask for the codes.

Well! I'll just find my way through the help files and the forum. ;)

;) Thank You very much for your time :D

Share this post


Link to post
Share on other sites

you can write a function name in the SciTe click on them and press the F1 key to recive the help for that function. try looking that way for the help file

Share this post


Link to post
Share on other sites

... sigh ...

For the future, always include your code attempts otherwise the ones willing to help you will need to write the whole code.

Now - here is a working code - try to learn as much as you can from it.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 338, 102, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 16, 16, 217, 21)
$Input2 = GUICtrlCreateInput("Input2", 16, 56, 217, 21)
$Button1 = GUICtrlCreateButton("Search 1", 248, 16, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Search 2", 248, 56, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $search_1, $search_2

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _SearchGoogle("Input1")
        Case $Button2
            _SearchGoogle("Input2")
    EndSwitch
WEnd

Func _SearchGoogle($sInput)
    Switch $sInput
        Case "Input1"
            $search_1 = ""
            ;read content of input, strip leading-trailing-or double spaces, replace them with "+"
            Local $sURL_friendly = StringReplace(StringStripWS(GUICtrlRead($Input1), 7)," ", "+")   
            ;add missing URL part
            Local $searchURL = "http://www.google.com/search?q="&$sURL_friendly
            ;create IE window
            $search_1 = _IECreate ("www.google.com")
            Sleep(1000)
            ;navigate there
            _IENavigate ($search_1, $searchURL)
        Case "Input2"
            $search_2 = ""
            Local $sURL_friendly = StringReplace(StringStripWS(GUICtrlRead($Input2), 7)," ", "+")
            Local $searchURL = "http://www.google.com/search?q="&$sURL_friendly
            $search_2 = _IECreate ("www.google.com")
            Sleep(5000)
            _IENavigate ($search_2, $searchURL)
    EndSwitch
EndFunc

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

you can write a function name in the SciTe click on them and press the F1 key to recive the help for that function. try looking that way for the help file

Hey! All you guys thanks for your replies! :)

Thanks monoscout999, for the short-cut ;)

Share this post


Link to post
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 338, 102, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 16, 16, 217, 21)
$Input2 = GUICtrlCreateInput("Input2", 16, 56, 217, 21)
$Button1 = GUICtrlCreateButton("Search 1", 248, 16, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Search 2", 248, 56, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $search_1, $search_2

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _SearchGoogle("Input1")
        Case $Button2
            _SearchGoogle("Input2")
    EndSwitch
WEnd

Func _SearchGoogle($sInput)
    Switch $sInput
        Case "Input1"
            $search_1 = ""
            ;read content of input, strip leading-trailing-or double spaces, replace them with "+"
            Local $sURL_friendly = StringReplace(StringStripWS(GUICtrlRead($Input1), 7)," ", "+")   
            ;add missing URL part
            Local $searchURL = "http://www.google.com/search?q="&$sURL_friendly
            ;create IE window
            $search_1 = _IECreate ("www.google.com")
            Sleep(1000)
            ;navigate there
            _IENavigate ($search_1, $searchURL)
        Case "Input2"
            $search_2 = ""
            Local $sURL_friendly = StringReplace(StringStripWS(GUICtrlRead($Input2), 7)," ", "+")
            Local $searchURL = "http://www.google.com/search?q="&$sURL_friendly
            $search_2 = _IECreate ("www.google.com")
            Sleep(5000)
            _IENavigate ($search_2, $searchURL)
    EndSwitch
EndFunc

Thanks enaiman,

Really excellent post I really appreciate it.

But just want to make some brush ups,

I opened the (IE Google search Autoit GUI), typed food and there was a first IE window a blank one but smaller. The second IE, shows the Google search page after that there's a pop up message saying, "Internet Explorer cannot open the Internet site http://www.google.com/sg. operation aborted"

After staying quite awhile another Internet Explorer window pops up showing my food search results.

Okay my questions:

What's the cause of this "operation aborted"?

Should I delete this part, it's kinda bringing in the aborted situation here?:

;create IE window

$search_1 = _IECreate ("www.google.com")

Please any suggestions.

Thank You.

Share this post


Link to post
Share on other sites

If you remove that, it won't work at all.

No idea why is doing that on your computer - tested it on mine and it worked. I'm afraid you will need to fix the script from here, to make it work on your system.

Have fun for the weekend :)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

How do you click two links at the same time?

when i go to Google and type "food" i see these 10 link list about foods and i want to click two(2) links at the same time. i thought about _IENavigate but it opens one page at a time.

Is it _IETagNameAllGetCollection?

Really have no idea how to go about doing this.

Any help please

Thank You.

Share this post


Link to post
Share on other sites

"At the same time" is not possible; there will be always a delay because these functions (instructions) are executed in order.

I guess you didn't look at the _IENavigate function - look now. There is a parameter whose default value is telling AutoIt to wait until the page is loaded. If you change that value, it won't wait anymore and it will go straight to the next page.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Please bare with me just want to identify something here.

Who is faster when loading like when you use

this,

which is invisible:

#include <IE.au3>

$oIE = _IECreate ("http://www.google.com", 0, 0)

and

compared to this, which is visible:

#include <IE.au3>

$oIE = _IECreate ("www.google.com")

And how can i make a AutoIt software faster to automate any suggestions or functions or maybe techniques in Autoit that can make the script read faster to execute?

Thank You.

Share this post


Link to post
Share on other sites

_IENavigate was just an example, You can open directly the page with _IEOpen and you'll miss a step.

Just try multiple ways and see what is the best for you.

And a side-note - you can't make this faster than the time IE needs to open a page; no matter what you do, you are limited by the browser's speed (IE, FireFox, Chrome...)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

i want to put this ***** characters in my input box to use it as a password.

i can't find a way to go about doing it.

any help please.

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