Jump to content

ControlSend BUG


geww
 Share

Recommended Posts

Hello everyone,

I am in touch with Autoit over 2 years and I like simplicity and our lovely forum. However today I am fighting with AutoIt BUG. About 4-5 weeks ago I decided to make small tool for my server, unlucky is necessary to use ControlSend or any kind of function which can send data(text) to inactive window and can handle special characters like ( and & . My tool is nearly finished, but I can't make it work with ControlSend. If I am using Send everything working very well. If I use ControlSend instead of ( and & I get 9 and 7. It look like ControlSend fail at sending SHIFT + key. I tried many things what I found on the forum. but it's working bad or it don't work at all.

Example

= What I get

Send("( &")
= ( &   *This is working
-
ControlSend ( "", "", $GwinWnd, "( &", 1)
=  9 7   *This is not working
-
ControlSend ( "", "", $GwinWnd, "( &")
=  9 7  *This is not working
-
ClipPut("( &")
ControlSend ( "", "", $GwinWnd, "{CTRLDOWN}")
ControlSend ( "", "", $GwinWnd, "^{v}")
ControlSend ( "", "", $GwinWnd, "{SHIFTUP}")
= ( &v  *This is working, but I get v at the end of string
-
ClipPut("( &")
ControlSend ( "", "", $GwinWnd, "{CTRLDOWN}")
ControlSend ( "", "", $GwinWnd, "^{v}", 1)
ControlSend ( "", "", $GwinWnd, "{SHIFTUP}")
=[ 9 7]v    *This is not working
-
ControlSetText isn't usable in my case
{ASC xxxx} don't work too

I spent over 50 hours to get it where is it now. So I am too far to abandon it now and also my skill in the others programming languages are too low. :)

However I think I may solve my problem via some WinApi function via ClibBoard paste. But I am completely out of clue how to make it.

Exactly same problem as here:

If anyone have clue how to make WinApi or how to fix that frikinn bug, please don't hesitate post a comment.

Thanks :]

Edited by geww
Link to comment
Share on other sites

Several things about your code:

- ControlSend should be used with a window title at least in oder for it to work with inactive windows (you can use WinTitleMatchMode option to allow partial match)

- When you try to paste the clipboard content, you are sending CTRLDOWN, then Ctrl+v then SHIFTUP - nothing odd here??? (try sending only "^v" and nothing else.

But I think, if you get the correct title in the controlSend, you won't need any copy/paste.

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 :)

Link to comment
Share on other sites

Several things about your code:

- ControlSend should be used with a window title at least in oder for it to work with inactive windows (you can use WinTitleMatchMode option to allow partial match)

- When you try to paste the clipboard content, you are sending CTRLDOWN, then Ctrl+v then SHIFTUP - nothing odd here??? (try sending only "^v" and nothing else.

But I think, if you get the correct title in the controlSend, you won't need any copy/paste.

At first I would make it clear. Code What I posted is little messed up, because I made this post when I was sleepy :)

Here is correct version:

Send("( &")
= ( &   *This is working
-
ControlSend ( $GwinWnd, "", "", "( &", 1)
=  9 7   *This is not working
-
ControlSend ( $GwinWnd, "", "", "( &")
=  9 7  *This is not working
-
ClipPut("( &")
ControlSend ($GwinWnd, "", "", "{CTRLDOWN}")
ControlSend ($GwinWnd, "","", "{v}")
ControlSend ( $GwinWnd, "","", "{CTRLTUP}")
= ( &v  *This is working, but I get v at the end of string
-
ClipPut("( &")
ControlSend ($GwinWnd, "", "", "{CTRLDOWN}")
ControlSend ($GwinWnd, "", "", "{v}", 1)
ControlSend ( $GwinWnd, "", ""d, "{CTRLUP}")
=[ 9 7]v    *This is not working
-
ControlSetText isn't usable in my case
{ASC xxxx} don't work too

Anyway I didn't figured how fix this friking bug, so I leaving autoit forever :/ C++ rulz

Link to comment
Share on other sites

  • Developers

Anyway I didn't figured how fix this friking bug, so I leaving autoit forever :/ C++ rulz

Cya :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

geww,

newest version is also bugged + I probably discover new ddlcall bug

Have you opened a Trac ticket for these bugs? If not, then you can hardly complain. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

No better way to ensure you won't receive any help than to complain about the language in your first post :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 6 years later...

OK I am experiencing this same issue.

I had a script working well and then found the ControlSend and thought Oh that's even better to have it only send to a specific window instead of crossing my fingers and using send to throw commands at an active window.

I went through and changed all of my Send commands to ControlSend commands and now I'm fighting all this mayhem!

And now to top everything off I tried to go back to my last version and now that doesn't work either????

Strange behaviour to say the least.... 

Samples attached for the Send and ControlSend Versions.

 

HELPPPPP!

 

ControlSendVersion.txt

SendVersion.txt

Link to comment
Share on other sites

OK so a slight update to this.  The original Send function which worked and is not failing after my changes to go to ControlSend was resolved by increasing the     AutoItSetOption('SendKeyDelay', 400)  original delay was 300 - now Send is working again with the delay increase.  I'm going to try to run the Control send with the delay increased and see if that resolves it as well!!!

 

Fingers crossed.

Link to comment
Share on other sites

  • Developers

I am seriously wondering what you are expecting as reply to your posts as they don't contain any information what you are doing other than screwing a working script?

When you want any serious assistance you open a new thread in the support forum providing enough details about what you are doing and where things go wrong.

Jos

 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Send is one have the hackiest ways to automate something.  how can you expect to automate something reliably if you can't verify your action was received (rhetorical).  maybe your window was not ready to accept input, maybe your network went down temporarily, maybe a popup became active.   there is too many what ifs in a windows environment to ever use ONLY *send reliably.  this is not a bug, it's a flaw in your scripting

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Ouch - gees guys I provided plenty of info in my post and it does track to exactly what is represented in the thread.

I realise that using Send is a hacky way to script this which is why I am trying to sure up my scripting by using a more reliable way to send commands to the window i am attempting to work with.  I was trying to implement ControlSend but obviously failed here.  Instead of trashing my post or how I post maybe you could let me know if the two files I attached are remotely close to what would work using ControlSend or if I am way out in left field.

Did anyone even look at the attachments or was it a cursory rag on the new guy day?

 

Link to comment
Share on other sites

I was able to make some progress.  I found that ControlSend doesn't seem to like the abbreviation of a command.  What I mean by this is I have a ControlSend with {TAB 3} and when I tested this using single commands it worked so then I bumped it up to {TAB 2} and this worked but once I went over 2 if failed.  So I was able to rewrite with my new found solution and the second phase it has to tab 6 times to get back to the Address line but no matter what I do it just seems to hang.  I attempted to use [CLASS:ToolbarWindow32; INSTANCE:3]   and also attempted to use the handle from a WinWait but nothing got it to progress past selecting the current entry and then it wouldn't paste in the new address. 

Sure I've attached the summary info from file explorer window where it is getting hung up at I see it tab through and then it doesn't seem to want to do the

    ControlSend($xTitle, "", "", "{ENTER}^v{ENTER}")
or even it I try it using individual statements:

    ControlSend($xTitle, "", "", "{ENTER}")

    ControlSend($xTitle, "", "", "^v")

    ControlSend($xTitle, "", "", "{ENTER}")

I feel like it's got to be something simple I am missing but I'm just over tired I guess - I'm not seeing my mistake.

Can you navigate file explorer using ControlSend to access the Address Line?

Any assistance would be appreciated.  Thanks jdelaney

AutoIT v3 Summary info.txt

Link to comment
Share on other sites

I don't open files from the interwebs.  Someone else will help you out, or please edit your comment and include the text.

 

For toolbar controls use functions like:

_guictrltoolbar_*

or ControlCommand

Check the help file on those.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

8 hours ago, MovieScreener2013 said:

I was able to make some progress.  I found that ControlSend doesn't seem to like the abbreviation of a command.  What I mean by this is I have a ControlSend with {TAB 3} and when I tested this using single commands it worked so then I bumped it up to {TAB 2} and this worked but once I went over 2 if failed.  So I was able to rewrite with my new found solution and the second phase it has to tab 6 times to get back to the Address line but no matter what I do it just seems to hang.  I attempted to use [CLASS:ToolbarWindow32; INSTANCE:3]   and also attempted to use the handle from a WinWait but nothing got it to progress past selecting the current entry and then it wouldn't paste in the new address. 

Sure I've attached the summary info from file explorer window where it is getting hung up at I see it tab through and then it doesn't seem to want to do the

    ControlSend($xTitle, "", "", "{ENTER}^v{ENTER}")
or even it I try it using individual statements:

    ControlSend($xTitle, "", "", "{ENTER}")

    ControlSend($xTitle, "", "", "^v")

    ControlSend($xTitle, "", "", "{ENTER}")

I feel like it's got to be something simple I am missing but I'm just over tired I guess - I'm not seeing my mistake.

Can you navigate file explorer using ControlSend to access the Address Line?

Any assistance would be appreciated.  Thanks jdelaney

AutoIT v3 Summary info.txt

Try using the control ID and not the title. Look at the examples in the help file and you will see how it works. 

Link to comment
Share on other sites

jdelaney - I just noticed you updated your comment.  I will take a look at those options later today.  Thanks for the suggestions.

 

 

Hey Bert - (That's a funny image of him BTW. ) 

Correct me if I'm wrong but I believe I tried that by using the  [CLASS:ToolbarWindow32; INSTANCE:3] option.

This failed to work as well:

    ControlSend("", "", "[CLASS:ToolbarWindow32; INSTANCE:3]", "{TAB 4}^v{ENTER}")

I also tried using the handle:

    ControlSend($hWnd, "", "", "{TAB 4}^v{ENTER}")

It seems like any complex send commands in conjunction with ControlSend hang.

 

Edited by MovieScreener2013
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...