Jump to content
Gadoz

Controlsend to many windows with the same title

Recommended Posts

Gadoz

Hello,

I've already tried myself to create a autoit script, which can send through controlsend keys (like Shift + S for save) or (just pressing Spacebar).

The problem is, I can't send keys in the background special to this window. Because I have open this editor to work on it and this script should doing this steps on the background, while I can work on the same editor on a new document. If I have opened this script, this script is just pressing shift + s or just pressing the spacebar till I paused this. On a another editor, I need to send "." after every 30 seconds and save it (with shift+s) .

I've already tried this with handle ($handle):

https://stackoverflow.com/questions/14783920/autoit-controlsend

 

This worked only to active windows and I also put the handle id (autoit windows info tool) between the gaps, but its not working.

I'm just wondering, why this won't work, because if $handle is working on a active window, this should working on active window aswell?

HotKeySet("{S}", "Starting")
HotKeySet("{P}", "Paused")
HotKeySet("{ESC}", "Exit")

While 1
Sleep(300)
WEnd

Func Starting ()
While 1
ControlSend(0x00000000001111FE, Default, 0x00000000001111FE, "{SPACE}")
ControlSend(0x00000000001110EF, Default, 0x00000000001110EF, "{.}")
WEnd
EndFunc

Func Paused ()
While 1
Sleep(10)
WEnd
EndFunc

Func Exit ()
Exit
EndFunc

 

I hope, someone can understand and help me.

Share this post


Link to post
Share on other sites
JLogan3o13

@Gadoz welcome to the forum. First and foremost, what type of window are you dealing with? And why do you need to have so many of them? The more info you can provide the better suited we are to assist. Screenshots of the window(s) and the field where you're trying to send the text or space would be helpful as well.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Gadoz

Hey!

It's just a editor like notepad, which is used on my job. This editor is developed by our IT.

It's compared with the notepad.exe with some additional extras, so if someone can help me, you can demonstrate it with notepad.exe.

Every notepad.exe has different PID, different handle.

We are don't using autoit yet, but for a new project, we need a tool/script, which can save and sending "spacebars" and dots every 30 seconds in a 2-3 documents on our editor. A databank is loading this .txt file every after 30 seconds and put it on a form.

We are spending so much time to do this manual, a script will saves a lot of time...

 

I'm sorry, If I can't write more, because I'm working in a data protection area and any names / screenshots aren't allowed..

 

 

Share this post


Link to post
Share on other sites
jdelaney

WinList returns an array, loop through that.  Use CLASS as the identifier, or something else that's common between each window.

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.

Share this post


Link to post
Share on other sites
Gadoz
7 minutes ago, jdelaney said:

WinList returns an array, loop through that.  Use CLASS as the identifier, or something else that's common between each window.

I have checked the editor, every editor has the same CLASS (NEFeditorh)

Share this post


Link to post
Share on other sites
JLogan3o13

So there you go, look at the helpfile for WinList, as jdelaney suggests. You can use the classname to narrow your search.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Gadoz
3 minutes ago, JLogan3o13 said:

So there you go, look at the helpfile for WinList, as jdelaney suggests. You can use the classname to narrow your search.

Alright, I will try and post my result. Thanks.

Share this post


Link to post
Share on other sites
Gadoz
On 5.12.2017 at 9:18 PM, Gadoz said:

Alright, I will try and post my result. Thanks.

First of all, I want try to send just spaces, till this script is paused, to test if this works.

HotKeySet("{S}", "Starting")
HotKeySet("{P}", "Paused")
HotKeySet("{ESC}", "Exit")

While 1
Sleep(300)
WEnd


Func Starting ()
While 1
   $handle = 0x000000000007126F ;handle ID from from this editor window, every new window of this editor has a unique handle ID (autoit v3 window tool)
   $handle2 = 0x0000000000060170
ControlSend($handle, Default, $handle, "{SPACE}")
ControlSend($handle2, Default, $handle2, "{.}")
WEnd
EndFunc

Func Paused ()
While 1
Sleep(10)
WEnd
EndFunc

Func Exit ()
Exit
EndFunc

 

On 5.12.2017 at 9:03 PM, jdelaney said:

WinList returns an array, loop through that.  Use CLASS as the identifier, or something else that's common between each window.

 

#RequireAdmin

HotKeySet("{S}", "Starting")
HotKeySet("{P}", "Paused")
HotKeySet("{ESC}", "Exit")

While 1
Sleep(300)
WEnd



Func Starting ()
   Func array()
   while 1
    
    Local $aList = WinList()

    
    For $i = 1 To $aList[0][0]
        If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then
           ControlSend($aList, Default, $aList, "{SPACE}")
        EndIf
    Next
EndFunc   ;==>Example
While 1


WEnd
EndFunc

Func Paused ()
While 1
Sleep(10)
WEnd
EndFunc

Func Exit ()
Exit
EndFunc

This doesn't work aswell.

Share this post


Link to post
Share on other sites
Jos

I am not so surprised these scripts don't work.
For starters: Install the full version of SciTE4AutoIt3 which will run au3check for you telling you about all syntax errors.
Fix those errors and while you are at it: what is your idea around using all these While 1 loops?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Gadoz

I've installed SciTE4AutoIt3  but where I can see, that I have a syntax error?

 

Oh, the first while can be removed,

 

the other while after array (for the loop) as jdelaney mentioned .

 

I just don't understand this file.

Is here a marketplace, where I can post a order, that someone can do it for me, for some $?

I just don't want waste time anymore, since we will working only for one month to this project.

Share this post


Link to post
Share on other sites
Jos
1 minute ago, Gadoz said:

I've installed SciTE4AutoIt3  but where I can see, that I have a syntax error?

 

have you run the script from scite?
All information will show in the bottom part of the screen.

Jos

2 minutes ago, Gadoz said:

I just don't understand this file.

Is here a marketplace, where I can post a order, that someone can do it for me, for some $?

I just don't want waste time anymore, since we will working only for one month to this project.

Not in these forums.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.