0

I want to if it possible to copy (retrieve) the names of a control of a specific window or application using AutoHotkey?

For example calculator is opened on my screen and now I want that:

  • when I press f1 hotkey then it should copy the calculator’s menus name i.e. View, Edit and Help and

  • when I press f2 hotkey it should paste or send the name of these controls i.e. View, Edit and Help.

  • Similarly further I want to copy the option’s names in view menu of calculator. For this I want when I press f3 it should copy view menu’s options i.e. ‘Standard’, ‘Scientific’, ‘Programmer’ and so on and

  • when I press f4 it should paste or send the options of view menu.

Is it possible to do that?

Look at this snapshot:

the image of calculator

3
  • It might help if you tell us what you want to accomplish. Because maybe you do not actually need to know these names in order to accomplish this.
    – LPChip
    Oct 10, 2015 at 18:51
  • Dear @LPChip i have an online form whose control keep changing. So i want to copy the names of these controls and save them in some file for future reference. currently i do not have the snapshot of that online form whose control keep changing. that's why i am in the need of something which can copy the name of particular application's control.
    – ramji
    Oct 10, 2015 at 19:03
  • An online form can be processed by its HTML code, but do note that this is highly illegal, and SuperUser is not helping to commit fraude or cheating. They change these controls to combat spammers or cheaters and ensure that a human performs the actions.
    – LPChip
    Oct 10, 2015 at 20:13

1 Answer 1

0

While it's likely possible to grab the contents of a menu from an application like the Windows Calculator, any comparable code I can locate is enormous and would be difficult if not impossible to modify or upkeep for most. As such, I propose a simpler option.

Firstly, the options menus for such an application are not given to change, so binding keys to copy them on the fly seems overkill. Instead, we can set them up once in AHK for recall.

A MsgBox can accomplish this as shown below:

enter image description here

The code used for this:

F4::

MyMenu =
(
=================
Calculator Menu
=================
Standard`t`tAlt+1
Scientific`t`tAlt+2
Programmer`tAlt+3
Statistics`t`tAlt+4
-----------------
History`t`tCtrl+H
Digit grouping
-----------------
Basic`t`tCtrl+F4
Unit conversion`tCtrl+U
Date calculation`tCtrl+E
Worksheets

)
MsgBox, 4160, Calculator Menu, %MyMenu%

The "`t" is for tab, which allows some form of text alignment within a MsgBox.

Otherwise you can bind F4 (or whatever) to output a text menu equivalent. This:

F4::

SendInput `
(
=================
Calculator Menu
=================
Standard`t`tAlt{+}1
Scientific`t`tAlt{+}2
Programmer`t`tAlt{+}3
Statistics`t`tAlt{+}4
-----------------
History`t`t`tCtrl{+}H
Digit grouping
-----------------
Basic`t`t`tCtrl{+}F4
Unit conversion`t`tCtrl{+}U
Date calculation`tCtrl{+}E
Worksheets
)
return

Gets you this:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .