Jump to content

Best way to handle 2 different active windows with Logitech Nulooq controller


Recommended Posts

Hi,

New user to AutoIT and I'd like to seek some advise as to how the best way to handle this situation. I have a carPC in which I'm using these software:

Centrafuse front end software

iGuidance

Skinbedder to over iGuidance on Centrafuse window

Logitech Nulooq to control these using keyboard shortcuts. I do have a touchscreen but it would be great to use the Logitech to skip a song rather than looking down at the screen.

My problem is, I can't control the 2 things simultanously. If I want to skip a song and zoom in the map, I have to click on different window to activate.

Skipping a song has a keyboard shortcut of "CTRL+F". Zooming in is just key "Up". I'm thinking of using ControlSend so as long as one window is active, it should be able to handle the background process. I can set the Logitech to launch a program (i.e. AutoIT script).

Or do you have any other suggestions? I have included a screen of how the screen looks like. Thanks a lot for your help.

The top portion of the screen in blue belongs to Centrafuse application, the map screen is iGuidance.

post-25503-1185381635_thumb.jpg

Link to comment
Share on other sites

I'm probably the least qualified to suggest an idea muchless provide the code to accomplish the idea, but I know your pain in trying to figure things out you know should be pretty easy. Based on what I read your problem was:

.... My problem is, I can't control the 2 things simultanously. If I want to skip a song and zoom in the map, I have to click on different window to activate.

Skipping a song has a keyboard shortcut of "CTRL+F". Zooming in is just key "Up". .....

I'm thinking if you get the handles for each of the 2 windows and set up hotkeys in your script that would call functions and activate the correct window before sending the key combination ... that could work. That way no matter what window is active, pressing CTRL+F or the UP key will ensure those commands are sent to the right window. Here's what I think it might look like if you were trying to send to two notepad windows. This should work for you and you could even use the ControlSend ( "title", "text", controlID, "string" [, flag] ) if you'd rather. Good luck hope it helps!

Opt("WinTitleMatchMode",4)

HotKeySet("^F", "SkipSong")
HotKeySet("{UP}", "ZoomIn")

$handle_Skip = WinGetHandle("classname=Notepad", "SkipSong Window")
$handle_Zoom = WinGetHandle("classname=Notepad", "ZoomIn Window")

MsgBox(0,"status","Skip handle = " & $handle_Skip & @CR & "Zoom handle = " & $handle_Zoom)  ;; <==== Remove - used for seeing handle values

While 1
    Sleep(100)  
WEnd

Func SkipSong()
    WinActivate($handle_Skip)
    Send("Pressing CRTL+F Skips Song" & @CR)  ;; <==== Remove - used for testing
    ; Send("^F")  ;; <==== note that au3 is case sensitive so this will be sending CTRL+<capital f>
EndFunc

Func ZoomIn()
    WinActivate($handle_Zoom)
    Send("Pressing the UP key Zooms In" & @CR)  ;; <==== Remove - used for testing
    ; Send("{UP}")
EndFunc
Edited by ssubirias3
Link to comment
Share on other sites

Thank you ssubirias3, unfortunately, this is too advance for me! Right now, I'm trying to figure this one out by using ControlSend:

ControlSend("iGuidance","","Afx:400000:b:10011:6:01","r")

Here's the dump from the Info Window:

>>>> Window <<<<

Title: iGuidance

Class: IntellinavWCls

Position: 5, 44

Size: 838, 432

Style: 0x1400C000

ExStyle: 0x00000000

>>>> Control <<<<

Class: Afx:400000:b:10011:6:0

Instance: 1

ID: 59648

Text:

Position: 5, 63

Size: 838, 413

ControlClick Coords: 444, 197

Style: 0x50000000

ExStyle: 0x00000200

>>>> Mouse <<<<

Position: 449, 260

Cursor ID: 15

Color: 0xFFDC80

>>>> StatusBar <<<<

1: Ready

2: CAP

3: NUM

4: SCRL

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Ready

When I execute, the window does nothing. But if I hit "r" on the keyboard the iGuidance screen changes. Anywhere else I might be doing something wrong?

Thanks for your help.

Link to comment
Share on other sites

ControlSend("iGuidance","","Afx:400000:b:10011:6:01","r")

Here's the dump from the Info Window:

>>>> Window <<<<

Title: iGuidance

Class: IntellinavWCls

Position: 5, 44

Size: 838, 432

Style: 0x1400C000

ExStyle: 0x00000000

>>>> Control <<<<

Class: Afx:400000:b:10011:6:0

Instance: 1

ID: 59648 ..............

When I execute, the window does nothing. But if I hit "r" on the keyboard the iGuidance screen changes. Anywhere else I might be doing something wrong?

1 - In your first message you didn't say anything about sending the "r" key to any window. You said "CTRL+F" to skip songs and the "UP" key to zoom in on a different window. What is the "r" key suppose to do when the IGuidance window is active?

2 - I remember the days (not too long ago) when the code I gave you would have been greek to me too. If you want to see what the script actually does you'll need to have the following set up before running the script. a. open two notepad windows, b. in one notepad window type "SkipSong Window" and the second type "ZoomIn Window", c. run the script.

What you should see is anytime you press "CTRL+F" (that's a capital f; btw) you'll see the notepad window containing the text "SkipSong Window" type the text assigned to that hotkey. Same thing when you press the arrow "UP" key.

3 - Your ControlSend syntax looks correct. If its not working for you make sure you have Opt("WinTitleMatchMode",4) set correctly within your script. The other thing could be the "r" key is working correctly the first time but not after that, then your problem is you don't have a loop set up. That what the While...WEnd is for in the script I gave you earlier.

Beyond that I'm not sure if I can help you any further. Remember I'm still new at this stuff. Good luck.

-ss3

...

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