Asked — Edited
Resolved Resolved by VGosine!

Script Help - Give Key Control Foreground

I have a "Key Control" in my project to provide shortcuts to numerous actions and scripts. Upon connection, I would like to give the "Key Control" focus so that I can control the robot from a BT keyboard without necessarily seeing the computer or using a mouse to select the control the first time.

I thought adding this line to my init script would do what I want:

ControlCommand("Key Control",ShowControl)

but it displays an error in the debug window and doesn't perform the requested action:

"11/29/2014 11:13 AM - Error on line 1: Unknown Window Control Command: ShowControl"

Am I missing something? Is there another way to do this>

Alan


ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

#1  

Note: I also tried

ShowControl("Key control")

even though the documentation says that is only for the mobile interface.

Alan

#2  

Hmm.. I may be answering my own question. It looks like even if I give the control focus, it won't provide the desired effect. I need to click the mouse in the control in order to activate it. This may be the trigger for me to learn AutoHotKey.

Alan

#3  

Interesting note on the keyboard control, if you have a Movement Panel open, and click on your keyboard control it activates the cursor arrows used for navigation by the movement panel. It doesn't work the other way around though.

Trinidad/Tobago
#4  

I believe there aren't any controlcommands that are possible with the key control panel.

The easiest way i can think of to do this is to setup a mouse recorder that will click the mouse where the key control is on the screen when the project is loaded.

@Antron007 that happens since the arrow keys are automatically defined in a similar manner to run the forward(), reverse(), left(), right() commands that's why the key control would have the arrow keys working:)

#5  

I have had some success using Autohotkey. I haven't learned the whole command syntax in a day, but it has a script recorder function, so that made it fairly simple to script hitting F10 to make sure I am on virtual desktop 1 and then clicking the mouse in the right place. Only outstanding issue is that I use ARC on a couple of different computers that have different resolution, so I re-arrange the objects to best fit the screen I am using. Since the mouse click is by position, I need to have different versions of the script for each machine and make sure the key Control object is always in the same position.

I suspect autohotkey may be powerful enough to find the object and select it, but I am not sure it can then do a mouse click within it by relative vs absolute position. But that is a fairly minor nit. The fact that I have a solution is what counts.

Alan

United Kingdom
#6  

AHK may be able to find the control window however I don't know if the controls within ARC are reported as windows which AHK can find. You could take the details from the project file, it's an XML file with the locations of controls etc. held in there.

#8  

Just a quick follow-up on this. I got a new computer running Windows 8.1 x64 and was having trouble with Autohotkey. A little research found that autohotkey.com is no longer owned by the developers and the version you can download from there hasn't been updated in 5 years. The current site for downloads of a version under active development is http://ahkscript.org/ and I am back in business (well, still some work to do to make my scripts work on the new machine, but at least the same script can be edited now, which it couldn't before.

(although the sample script created on first run still points to www.autohotkey.com when you hit Win+z so that can add to the confusion).

Alan

#9  

Keep up the good work Alan. AHK is one thing I want to use soon. Thanks for the ground breaking. :)