Jump to content

ControlSend won't send strings


Recommended Posts

Hi I'm trying to write a script that will send "3" to a few handles that their windows have the same titles, the windows have no control and I don't know if its needed.

So my script looks like this:

HotKeySet("+x","Terminate")
$appslist=WinList("app")
    While 1
        For $i = 1 To $appslist [0] [0]
            ControlSend($appslist [$i] [1],"","","3")
        Next
    WEnd
Func Terminate ()
    Exit 0
EndFunc

I tried to msgbox the handles to see if maybe the problem is with the handles, and the results are good.

I do get the handles of the windows, I compared them with the AutoIt Windows Info tool.

If anyone have any idea about what is the problem please reply,

Thanks.

Link to comment
Share on other sites

Without a control ID I don't know what it's sending the '3' to... I tried this, a little modified with a notepad document, and without the control ID of the text area, I didn't see it send the 3 to it (visibly, at least) but with the control ID it was sending it fine.

So, if there really is no control IDs... I dunno. You could try finding the place where the '3' is suppose to go, then do ControlClick on that coord, then send, or something. Be creative.

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Thanks for the reply but the whole idea of the script is working in the background and not disturbing other program so ControlClick won't help me here and about the Control ID I guess your right but I have read in another thread someone saying its not necessary to send strings.

Hope to here some more thoughts or ideas.

Link to comment
Share on other sites

Could you do something like

hotKeySet("+x","Terminate")
$appslist=WinList("app")
    While 1
    For $i = 1 To $appslist [0] [0]
    WinActivate($appslist [$i] [1])
    Send("3")
    Next
    WEnd
Func Terminate ()
    Exit 0
EndFunc

?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Well, ControlClick() can be sent to minimized windows, and you don't need a control ID to use it, just control coords ( relative to the window size, instead of client if the windows are in different places). I've made a program to do things on the internet while it was minimized, and I was doing other stuff. ControlClick won't disturb whatever you're doing. Or it shouldn't...

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

@martin

It would work but the whole point is not using Send() because it needs the windows to be active and it disables everything else.

@mistersquirrle

if it really does work this way well then I guess this is my solution,I don't necessary have to ControlSend "3" I can press on a cord with a button in there instead.

I'll try it now.

Thanks to both of you.

Edited by Its2l82die
Link to comment
Share on other sites

Ok, the ControlClick does work but now comes another problem, sometimes I resize the application and certain buttons change cords in there so the ControlClick is not a permanent.

if anyone have some more solutions,ideas or maybe even a way to get a Control ID aside from the Window info tool please reply here.

Link to comment
Share on other sites

I don't know if this would work, but I know with the _IE.au3 functions, to poll ID's of items from a webpage, it takes a little complicated list looping thingy >_> and it polls like all the controls on the page, then you take an aspect of it (like the name, of text or something) and in another loop, search for the ID with that name, etc... you might be able to try something like that to find these control IDs. Again, though, I don't know if this would really work. I don't see any (good) functions for doing this, but you could experiment.

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Thanks again for the reply now what I have discovered is that this "app" won't receive Send functions whatsoever even using Winactivate and then Send won't work.

I think the app has some kind of protection, so is there anyway around this maybe mask the Send functions somehow so that the app won't know its receiving a Send function?

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...