Jump to content

ControlCommand/ControlSend


Recommended Posts

hi

i created a simple macro with tab jumps for a website. this macro run ~4 hours daily.

in the time where the script run i want do other things like playing games  :(

i want use @SW_HIDE or @SW_MINIMIZE

but when the window is hidden/minimized i can´t send controlls how a tab jump, copy text or click a button/link.

i tried this but there is no effect.

ControlSend("Mozilla Firefox", "", "", "{TAB}")

ControlSend("Mozilla Firefox", "", "", "{ENTER}")

ControlSend("Mozilla Firefox", "", "", "{CTRLDOWN}c{CTRLUP}")

pleaseeeee... help me  :(

<{POST_SNAPBACK}>

I believe that if you include the ControlID in the third parameter that this should work for you. From a previous investigation, I believe that the ControlID for the main window for FireFox is '1'. If it is not that that you are trying to send info to, use the AutoIt Window Info tool to find the control ID.

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

here is my next problem... LOL :(

Sleep (5000)
ControlSend("Google - Mozilla Firefox", "", "MozillaWindowClass7", "{TAB 11}{F6}www.test.com{ENTER}")

when i try this the browser make {tab} and jump with "F6" to the url field but no more.

how can i enter a test and send it?

Link to comment
Share on other sites

I have a problem with this also, i tried this:

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
Sleep(2500)
ControlSend("Internet Explorer", "Edit1", 41477, "aBcDe");41477 is the control ID for the URL/adress bar in IE

and this

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
Sleep(2500)
Opt("WinTitleMatchMode", 4)
$appWindowa = WinGetHandle("classname=Internet Explorer_Server1")
ControlSend($appWindowa, "", "Edit1", "aBcDe")

and this..

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
Sleep(2500)
Opt("WinTitleMatchMode", 4)
$appWindowb = WinGetHandle("classname=Edit1")
ControlSend($appWindowb, "", "Edit1", "aBcDe"); i also replaced "Edit1"with 41477

And i tried many many more combinations... All of them doing absoluly nothing.

All i want is to do, is open IE and let AutoIt type a http adres in the url-adress bar :

(Without using the mouse pointer :( )

Who can help me, please ?

/Edit

This could be the Internet Explorer / FireFox ControlSend nooby thread :(

Edited by WhiteCrow
Link to comment
Share on other sites

I have a problem with this also, i tried this:

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
Sleep(2500)
ControlSend("Internet Explorer", "Edit1", 41477, "aBcDe");41477 is the control ID for the URL/adress bar in IE
The second parameter of ControlSend is text of the window you're trying to access. This should work:

Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
Sleep(2500)
ControlSend("Internet Explorer", "", "Edit1", "aBcDe")
Link to comment
Share on other sites

ChiDragon.

I tried your code on the Beta AutoIt and the non-beta.

Agh, feel like such a noob, i can't bend my tiny brain around it :(

And your code should work.. but it doesn't :(

But, still thanks for the fast reply

Can anyone make it work ?

Edited by WhiteCrow
Link to comment
Share on other sites

THX ChiDragon!

@WhiteCrow

does it work?

hehe.. i think here is my last problem :(

when i start the browser with @sw_minimize firefox is minimized.

Run('C:\Programme\Mozilla Firefox\firefox.exe',"",@sw_minimize)

but when the first ControlSend start the browser is maximized and not all clicks are done :

how can i minimize the window all the time?

edit\\

i wrote on the end of every ControlSend line @sw_minimize.

but commands like {TAB} {ENTER}.... are written in the url field of the browser, too.

i hope you can understand me :(

Edited by Ultra
Link to comment
Share on other sites

Opt("WinTitleMatchMode", 2)
Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
Sleep(2500)
ControlSend("Internet Explorer", "", "Edit1", "aBcDe")

This doesn't do anything at all.

I've got a pretty fast computer. 2,5 seconds is more then enough to start IE.

And you and i followed the syntax.

But this doesnt work. :(

This is what AutoIt Window Info has to say about the IE adress bar.

Control ID: 41477

ClassNameNN: Edit1

Edited by WhiteCrow
Link to comment
Share on other sites

For me it works but it puts the text before "http://www.google.ca" (my homepage) instead of replacing it. I forgot that you were using ControlSend instead of ControlSetText. Just replace ControlSend with ControlSetText and see what happens.. the syntax is the same.

Link to comment
Share on other sites

when i use this code it write the keys as text.

i don't know why :(

ControlSend("Internet Explorer", "", "Edit1", "{TAB}http://www.test.com{ENTER}",@sw_minimize)

what can i do to use ENTER when the code is "...... {ENTER}" ?

Link to comment
Share on other sites

when i use this code it write the keys as text.

i don't know why  :(

ControlSend("Internet Explorer", "", "Edit1", "{TAB}http://www.test.com{ENTER}",@sw_minimize)

what can i do to use ENTER when the code is "...... {ENTER}" ?

<{POST_SNAPBACK}>

It should be doing that... What if you remove the @sw_minimize? That's not a valid parameter according to the help file.
Link to comment
Share on other sites

when i remove @sw_minimize from the ControlSend lines the script work without problems.

but the browser-window is maximized :

edit:

i start the browser with with

Run('C:\Programme\Internet Explorer\IEXPLORE.EXE',"",@sw_minimize)

and the browser-window is minimized.

at the first ControlSend line the window is maximized :(

ControlSetText("Internet Explorer", "", "Edit1", "http://www.text.com")
    ControlSend("Internet Explorer", "", "Edit1", "{ENTER}")

i don't know why *cry*

i used the search & help-file... i am to stupid for auto-it :(

edit2:

here is the complete script

opt("WinTitleMatchMode", 2)
Run('C:\Programme\Internet Explorer\IEXPLORE.EXE',"",@SW_MINIMIZE)
Sleep(3000)
For $i = 400 to 1 Step -1
    ControlSetText("Internet Explorer", "", "Edit1", "http://login:pass@test.com")
    ControlSend("Internet Explorer", "", "Edit1", "{ENTER}")
    Do
    Sleep(1000)
    Until StatusbarGetText("Internet Explorer") = "Done"
    ControlSend("Microsoft Internet Explorer", "", "Internet Explorer_Server1", "{TAB 5}{ENTER}")
    Do
    Sleep(10)
    Until StatusbarGetText("Internet Explorer") = "Done"
    ControlSend("Microsoft Internet Explorer", "", "Internet Explorer_Server1", "{TAB 5}^c")
    ControlSetText("Microsoft Internet Explorer", "", "Edit1", "http://www.test2.com")
    ControlSend("Microsoft Internet Explorer", "", "Edit1", "{ENTER}")
    Do
    Sleep(1000)
    Until StatusbarGetText("Internet Explorer") = "Done"
    Sleep(5000)
    ControlSend("Microsoft Internet Explorer", "", "Internet Explorer_Server1", "{TAB 2}^v{ENTER}")
    Do
    Sleep(1000)
    Until StatusbarGetText("Internet Explorer") = "Done"
    Sleep(10000)
Next
Edited by Ultra
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...