Sign in to follow this  
Followers 0
Mbee

What ctrl to ControlSend() to for app in System Tray?

10 posts in this topic

#1 ·  Posted (edited)

I've got a third-party video recording app idling away in the system tray (as it should be), just waiting for a command sequence (e.g., "CTRL+ALT+R") to begin recording.  When I'm recording manually, I simply press the command sequence on the keyboard to get it going, without having to manually activate/raise the idling process/window.

I'm writing a script to send that sequence programmatically, but I can't figure out where and how to send it!  I know I should use ControlSend(), and I can specify the third-party app's title as the first parameter, but I'm utterly baffled about what ControlID I need to use.  For a normal app, I would use Au3Info.exe to identify the control, but since the app is idling in the system tray, I can't figure out any way to use Au3Info on it.

So, how do I determine what ControlID to use in the ControlSend() call?

Thanks!

[ETA: Or perhaps I should do it some other way, one that doesn't need a controlID?]

(By the way, I found some code generously provided by poster war59312 (here), that will return the index number of the sys tray app I'm interested in, but I can't see how that would help me. I suppose that since pressing the sequence is all I need to do when doing this manually, maybe I could send it to Explorer, but I still don't know what ControlID to use.)

Edited by Mbee

Share this post


Link to post
Share on other sites



Mbee,

This app is probably monitoring the keyboard for your key sequence and has nothing to do with a particular control.  Have you tried using Send()?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Maybe you could just maximize the the app and find out with au3info what the window class is, or the controlid of the menu bar or something..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Thanks for your response, kylomas!

Maybe the app is monitoring the keyboard, but somehow that doesn't seem likely, since it's just sitting idly in the system tray and is hardly foremost.   If I open a text editor or notepad, what I type is entered there normally (and is not redirected).

And yes, I've tried Send(), but no matter which window I try to activate and send the control sequence to, it never works.

But please see my next post for a different approach (that I still need help with)...

Mbee,

This app is probably monitoring the keyboard for your key sequence and has nothing to do with a particular control.  Have you tried using Send()?

kylomas

Share this post


Link to post
Share on other sites

Thanks, somdcomputerguy.  But because of the way the third-party app was designed, it only accepts the command sequence if it's idling in the system tray.  If I raise/activate it, it switches into a different operational mode which ignores the sequence no matter how it's entered.  I'm obviously just have to give up on trying to send the sequence to a control at all.

Maybe you could just maximize the the app and find out with au3info what the window class is, or the controlid of the menu bar or something..

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

[EDITED: Since the topic has changed, I'm going to create a new thread to ask the modified question.]

See:

 

It's now clear that it's pointless trying to use either ControlSend() (because I can't specify a control) or Send() (because I can't activate the app's window and still keep it running in the only mode that works).

Instead, it's almost certainly a hotkey situation with universal (system-wide) scope.  The third-party app must do something like register a hotkey and waits in the system tray until some part of the operating system recognizes that the hotkey has been pressed and triggers the app to start recording.

So now the question becomes, how do I submit the control sequence such that it activates the hotkey?  My googling has only found posts relating to setting up and working with internal hotkeys within a given AutoIt script, and nothing about how to trigger an external, system-wide hotkey.

Or perhaps there's some way of making it look to the OS as a whole that the sequence was actually typed on the keyboard?

I'm stumped!

Edited by Mbee

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks, somdcomputerguy.  But because of the way the third-party app was designed, it only accepts the command sequence if it's idling in the system tray.  If I raise/activate it, it switches into a different operational mode which ignores the sequence no matter how it's entered.  I'm obviously just have to give up on trying to send the sequence to a control at all.

I guess I wasn't specific enough, but what I meant was to maximize/restore it so you could view it with the au3info tool, get whatever info may help you resolve this, and then send it back into the tray. Is there a forum for this application, where maybe somebody has or had a similar situation?

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Yes, somdcomputerguy, I knew exactly what you meant, thanks.  But it simply does not work!  There absolutely IS no relevant control while the window is raised that I can send anything to in that mode.

I guess I wasn't specific enough, but what I meant was to maximize/restore it so you could view it with the au3info tool, get whatever info may help you resolve this, and then send it back into the tray. Is there a forum for this application, where maybe somebody has or had a similar situation?

Share this post


Link to post
Share on other sites

Yes, somdcomputerguy, I knew exactly what you meant, thanks.

Alright bud, good luck though!


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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

  • Similar Content

    • rawkhopper
      By rawkhopper
      Hello everyone,
      I have a script that is automating a piece of sluggish software.  I want to automate it with a bit of caution and I am not sure the best way to do it.  ControlSend works great most of the time.  If I have it enter 10 into a text box every once in a while it will enter 1 or 11 and then hit enter.
      To overcome this I use MouseClick to select the text I just entered and then see if it matches the string it was supposed to put in before it hits enter.  This seems to work but what I love about ControlSend is there is less room for human interaction messing it up.  
      Yes I could block input but I prefer not to do that (permissions).
      Is there a better way of doing this?  Any Help would be much appreciated.
      Anyway here is the snippet of the script in question:
      Func KVSend () WinActivate ( "Window", "" ) Local $WindowPos = WinGetPos("Window", "") If $kV < 30 Then WinActivate ( "Window", "" ) ControlClick ("Window", "", 1001) ;Click in Accel Voltage box Sleep (100) ControlSend ("Window", "", 1001, $kV) ; \ kV Sleep (100) MouseMove($WindowPos[0]+130,$WindowPos[1]+75,1) MouseClick($MOUSE_CLICK_LEFT) MouseClick($MOUSE_CLICK_LEFT) Send ("^c") Local $clip = ClipGet () If $clip = $kV Then ControlSend ("Window", "", 1001, "{ENTER}") ;Hit ENTER if value is correct Sleep (100) ControlClick ("Window", "", 1518) ;Lens Clear Else Send ("{BACKSPACE}") KVSend() ; If value is incorrect try again EndIf EndIf  
    • magmet00
      By magmet00
      Do you have a working imagesearch.au3 with working dll?
      and how can i gethandle and send keyboard/mouse commands to hidden d3d window?
       
      i have tried imagesearch2015 but im getting dll error every time and tried older imagesearchs too in forum what i found.
      i have tried many things to send commands to hidden/background d3dwindow still nothing works.
      Can you help me please?
       
    • Guy_
      By Guy_
      Was testing ControlSend("My Window Name", "", "", "^c") vs the normal Send("^c") or _SendEx("^c") to copy selected text from a window...
      In Windows, I have a setting that when I click the Ctrl key only, my mouse pointer is "highlighted" [that I could of course disable].
      If I use Send("^c"), or do this manually, the mouse pointer is never highlighted, as I wish it to be.
      With ControlSend it *does* highlight...
      I thought that maybe the Ctrl key goes up a few ms too soon in that one and increased AutoItSetOption("SendKeyDownDelay", 5) to way higher, but it doesn't make a difference.
      As it doesn't seem possible to do "^ down", could it be prevented in some way?
      Beside the slight annoyance, it simply alerted me that these seem to work differently [and of course, they are different].
      I also get the early impression that ControlSend [to copy] seems in no way quicker to get something on the clipboard, maybe even slower?
      Thanks 
    • SkysLastChance
      By SkysLastChance
      How would I go about writing a IF Then statement if the conrol send fails?
      Run ("Notepad.exe") WinWaitActive ("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "Edit1", ("Provider Practice Record")) I have been running into lag alot. So my script has been missing input. I would like to be able to have it retry to put in "Provider Practice Record" if it misses. 
      I am assuming  a if then statement is what I need but I am not sure what ControlSend will return if it tries to send to Edit1 and it is not there. 
      Or do I need to just add a timeout? 
       
    • SkysLastChance
      By SkysLastChance
      Okay so I am not sure if I can do this or not with the code I currently have but, I would like to send lastname and the first name with a comma inbetween. 
      so it would look like "last name,first name" 
      right now I just have it sending the last name.
      any help or sugestions are appreciated. 
       
      $r = 1 Local $aArray = _Excel_RangeRead($oExcel, Default, Default) For $i = 1 To UBound($aArray) - 1 ;$i =0 Start from row A $sR1 = $aArray[$i][0] ;status $sR2 = $aArray[$i][1] ;first name $sR3 = $aArray[$i][2] ;Last name $sR5 = $aArray[$i][5] ;Email Address WinWaitActive ("[CLASS:MGUIWin]") Sleep (100) ControlSend("[CLASS:MGUIWin]", "", "Edit2", $sR3, & @CR) $r = $r + 1 If $r > $sBox Then Exit Endif Next