Jump to content

ControlFocus + SEND Command issues


Recommended Posts

All,

I need to change the behaviour of a couple of AutoIT script written by our previous System/Appliacation engineer. Thank god he did leave the Source code files behind on the shares and I'm trying to identify what the script is actually doing. There are a couple of references which I can't find back in the script. I'll list a couple below:

1. SEND("!ans{ENTER}")
2. CONTROLFOCUS("WINDOWNAMEREMOVED","","Button8")
CONTROLCLICK("WINDOWNAMEREMOVED","","Button8")
3. CONTROLFOCUS("WINDOWNAMEREMOVED","","Button7")
CONTROLCLICK("WINDOWNAMEREMOVED","","Button7")

When it does perform the code listed above under "1." It does perform 3 actions:

Within the application it goes to Transaction -> Inventory -> Series Post This is in the Menu bar of the application

Where does it get the !ans value?

Then the code listen under "2." and "3.", I know what CONTROLFOCUS and CONTROLCLICK does. What I don't understand is how it can find "Button8" and "Button7". "Button 7" is simply a CANCEL button from a screen but "Button 8" is a custom made button within the application so how does AutoIT know what "Button8" is? I don't see any references in the AutoIT Script which defines the location of these buttons. The only show up in the CONTROLFOCUS and CONTROLCLICK command.

Please help me out. Any help is appreciated.

Link to comment
Share on other sites

You should probably post all your code. That said, read the AutoIt Appendix for sendkey values. I believe "!ans{Enter} is: ALT+a+n+s+Enter. Variables in AutoIt start with "$" so that is not a variable.

The buttons are controlIds - read the functions in the manual to see the arguments: ControlFocus ( "title", "text", controlID). Look at the rest of the code for references to those controls.

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
Share on other sites

You should probably post all your code. That said, read the AutoIt Appendix for sendkey values. I believe "!ans{Enter} is: ALT+a+n+s+Enter. Variables in AutoIt start with "$" so that is not a variable.

The buttons are controlIds - read the functions in the manual to see the arguments: ControlFocus ( "title", "text", controlID). Look at the rest of the code for references to those controls.

Thanks for your reply. You were right about the !ans{Enter} I tried this command manually and that makes sence to me, did the same as the script does. About the "Button8" / "Button7" I've no idea how AutoIT does recognize the right button. Please advice. Script can be found below:

CONTROLFOCUS("Microsoft Dynamics GP","","Button8")
CONTROLCLICK("Microsoft Dynamics GP","","Button8")
;CLICK CANCEL ON REPORT DESTINATION WINDOWS
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
WINWAITACTIVE("Report Destination","",10)
CONTROLFOCUS("Report Destination","","Button7")
CONTROLCLICK("Report Destination","","Button7")
Edited by Khoneini
Blanked username and password
Link to comment
Share on other sites

Is there someone that can assist me with this. Any help is appreciated. I know what CONTROLFOCUS and CONTROLCLICK does. I just only don't understand how AutoIT does recognize what Button7 & Button 8 is. I can't find any reference in the script for these 2 buttons.

Link to comment
Share on other sites

  • Moderators

Khoneini,

I have blanked the username and password you had in the script above - not a good idea to publish them on t'InterWeb. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Khoneini,

I have blanked the username and password you had in the script above - not a good idea to publish them on t'InterWeb. ;)

M23

Thanks for that, it is a TEST account so I'm lucky with that one, I've removed some parts of the script but I still don't understand how AutoIT does know what "Button7" and "Button8" means. Is this normal? The "Button7" is a Cancel button and "Button8" is a custom-made application button, so there is no way AutoIT can know this button already...

Link to comment
Share on other sites

  • Moderators

Khoneini,

Open the AutoIt Window Info tool (you find it at C:Program FilesAutoIt3Au3Info.exe if you did a standard install) and drag the gunsight over the GUI. You will see the details of the various controls appear in the tool window - you will probably need to select the "Control" tab. See what you get when you look at the 2 buttons you mention - I imagine it will answer your question. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Khoneini,

Open the AutoIt Window Info tool (you find it at C:Program FilesAutoIt3Au3Info.exe if you did a standard install) and drag the gunsight over the GUI. You will see the details of the various controls appear in the tool window - you will probably need to select the "Control" tab. See what you get when you look at the 2 buttons you mention - I imagine it will answer your question. ;)

M23

It does! Thank you so much!!

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