Use Control Send and Control Click In AutoIT to Automate Background Processes - automation

I'm having Issue getting AutoITv3 to send a Control Down key stroke to a background program using the ControlSend function. I've been successful in getting the ControlClick function to work as shown below.
I've tried using both the ClassnameNN and the Class as the Control ID, both Failed. I've also attempted to add the "0 flag" as the last argument just in case the default was somehow changed.
Current Script
$wPos = WinGetPos("[Conquer] Raiding Clans")
WinActivate("[Conquer] Raiding Clans")
Sleep(2000)
ControlSend("[Conquer] Raiding Clans","","[CLASS:#32770]","{CTRLDOWN}")
ControlClick("[Conquer] Raiding Clans","","[CLASS:#32770]","left",1,$wPos[0] + 60 , $wPos[1] + 150)
AutoItv3 Window Info Tool Summary
>>>> Window <<<<
Title: [Conquer] Raiding Clans
Class: Afx:400000:0:10007:0:0
Position: 160, 136
Size: 1600, 768
Style: 0x94000000
ExStyle: 0x00000000
Handle: 0x019B16EE
>>>> Control <<<<
Class: #32770
Instance: 1
ClassnameNN: #327701
Name:
Advanced (Class): [CLASS:#32770; INSTANCE:1]
ID:
Text:
Position: 0, 0
Size: 1600, 768
ControlClick Coords: 105, 295
Style: 0x50000044
ExStyle: 0x00040000
Handle: 0x00381172
>>>> Mouse <<<<
Position: 265, 431
Cursor ID: 0
Color: 0x9FA8AA
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<
??
CSConceal
Prefix1
Prefix2
Prefix3
Prefix4
Prefix5
Prefix6
Prefix7
Prefix8
Prefix9
Prefix10
Prefix11
Prefix12
Prefix13
Prefix14
Prefix15
Prefix16
Prefix17
Prefix18
Prefix19
Prefix20
Prefix21
OpenVip
????
Close
OUTCHAT
OK
S
C
C
A
L
LOG
A
??
??
??
??
??
?
??
??
??
??
??
PK
???
?
??
?
btn
Equipment
Draw
CSMore
>>>> Hidden Text <<<<
XP1
XP2
XP3
XP4
XP5
XP6
XP7
XP8
XP9
XP10
U
D
Progress1
?
Progress3
Progress1
Progress2
Progress1
The expected function of this script would be for the script to hold down control and then click at a given set of coordinates.

Related

CreateJS : MovieClip.children doesn't update after gotoAndStop()

CreateJS (2015.11.26) via Animate CC (16.0.0.112)
Structure :
root
- myContainer
- frame 0 -> btn_0
- frame 1 -> btn_1
First frame of root contains following code :
var self = this;
createjs.Ticker.addEventListener("tick", initScreen);
function initScreen() {
createjs.Ticker.removeEventListener("tick", initScreen);
self.myContainer.gotoAndStop(1);
}
this.myContainer.addEventListener("click", function(e) {
console.log("Button 0 : "+self.myContainer.btn_0);
console.log("Button 1 : "+self.myContainer.btn_1);
});
The result is :
[Log] Button 0 : [MovieClip]
[Log] Button 1 : undefined
And when iterating through self.myContainer.children, only btn_0 exists.
So self.myContainer.children is not being updated when playing through the frames.
Seems like a bug, as I can't find any documentation around this... but I'm surprised that I can't find anyone else who's had this issue.
Any help much appreciated.
(Issue raised here : https://github.com/CreateJS/EaselJS/issues/848)
I believe this is because both buttons use the same symbol.
In AnimateCC, choose btn_1 and change its "instance of", by swapping-duplicating to a new symbol.
This logged for me:
Button 0 : [MovieClip (name=null)]
Button 1 : [MovieClip (name=null)]

Robotframework RIDE AutoIt control to press Stop

I am trying to use AutoIt to activate a running RobotFramework RIDE window and press the stop button. When using the AutoIt info tool I find that the Stop button is located within a toolbar. I have pasted the output from that tool here:
>>>> Window <<<<
Title: RIDE - Security
Class: wxWindowClassNR
Position: 665, 0
Size: 935, 860
Style: 0x16CF0000
ExStyle: 0x00000100
Handle: 0x0002052E
>>>> Control <<<<
Class: ToolbarWindow32
Instance: 1
ClassnameNN: ToolbarWindow321
Name:
Advanced (Class): [CLASS:ToolbarWindow32; INSTANCE:1]
ID:
Text:
Position: 304, 79
Size: 615, 28
ControlClick Coords: 45, 14
Style: 0x52001101
ExStyle: 0x00000000
Handle: 0x0003047A
>>>> Mouse <<<<
Position: 1022, 143
Cursor ID: 0
Color: 0xB6DBEE
>>>> StatusBar <<<<
1:
>>>> ToolsBar <<<<
1: 145 Start
2: 146 Stop
3: 147 Pause
4: 148 Continue
5: 149 Next
6: 150 Step over
From this output it can be seen that the Stop button has a Command ID 146.
In terms of an AutoIt script I am trying the following:
WinActivate("RIDE - Security")
ControlClick("[CLASS:wxWindowClassNR]", "", "[CLASS:ToolbarWindow32; INSTANCE:1]", "Start")
What am I missing or doing incorrectly?
Thanks!
On ToolbarWindow32 controls you usually have to use ControlCommand with the SendCommandID option. This should work for you.
$hWinHandle = WinGetHandle("RIDE - Security")
;make sure we have focus
ControlFocus($hWinHandle, "", "[CLASS:ToolbarWindow32; INSTANCE:1]")
;uses the ControlCommand to access the stop
ControlCommand($hWinHandle, "", "[CLASS:ToolbarWindow32; INSTANCE:1]", "SendCommandID", "146")

REBOL Change the backdrop image and text

REBOL
I currently trying to redo a small app I made in Delphi.
This application displays a background image among n and a text among n, but I cannot change the image or the text, the change of image and text is done by the button >>.
This is the simplified code without the random part because I found out about it:
Rebol[
Title: "You have a message !"
Version: 1.0.0
Needs: [1.2.115]
]
the-imag1: load %"/C/MyFile/Cours CD/Affiche/Images/Vague9.jpg"
the-imag2: load %"/C/MyFile/Cours CD/Affiche/Images/Vague3.jpg"
the-image: the-imag1
text1: "Your banner text here"
view xx1: layout [
size the-image/size
b1: backdrop the-image
at b1/offset + 110x120
box 350x150 font-size 20 font-color black [align: 'center] text1
at b1/offset + 530x370
btn ">>" [the-image: the-imag2 ; new image
text1: "Hello" ; new text
show xx1] effect [multiply 90]
]
You are redefining the face, not just the content. Just redefine the field you need. Try this:
Rebol[
Title: "You have a message !"
Version: 1.0.0
Needs: [1.2.115]
]
the-imag1: load %"/C/MyFile/Cours CD/Affiche/Images/Vague9.jpg"
the-imag2: load %"/C/MyFile/Cours CD/Affiche/Images/Vague3.jpg"
the-image: the-imag1
text1: "Your banner text here"
view xx1: layout [
size the-image/size
b1: backdrop the-image
at b1/offset + 110x120
t1: text text1
at b1/offset + 530x370
btn ">>" [
b1/image: the-imag2 ; new image
t1/text: "Hello" ; new text
show xx1
] effect [multiply 90]
]

How to make a window return value when closed in Tcl/Tk

I have a proc that creates a new window, asking the user to give a database name.. And I want the function, after it's closed to return a value.
How do I make a window to return a value to it's calling proc? I tried calling it using:
puts "dbug:: [set top [new_db_window]]"
The puts is to see the result. It doesn't work. Prints an empty sting ("dbug::") as the window is created and an error "can't read "::new_db_window": no such variable" when I hit the 'ok' button.
The code for the proc is:
proc new_db_window {} {
toplevel .new_db_menu
wm title .new_db_menu "New Data Base"
# Main Frame
frame .new_db_menu.frm -relief "groove" -bd 2
grid .new_db_menu.frm
if {[info exists db_name]} {
unset db_name
}
set ::new_db_window:db_name "Data_Base"
# The Name Entry
set frm_top [frame .new_db_menu.frm.top]
set lbl [label .new_db_menu.frm.top.label -text "Database Name:" -width 15]
set entr [entry .new_db_menu.frm.top.entry -textvariable ::new_db_window:db_name -width 15]
# The buttons
set b_ok [button .new_db_menu.frm.ok -image icon_v -command {return [new_db_ok_button]}]
set b_no [button .new_db_menu.frm.cancel -image icon_x -command {new_db_cancel_button}]
set sep_w [label .new_db_menu.frm.sep_w -text "" -width 1]
set sep_e [label .new_db_menu.frm.sep_e -text "" -width 1]
grid $lbl -row 1 -column 1 -sticky w
grid $entr -row 1 -column 2 -sticky w
grid $frm_top -row 1 -column 1 -columnspan 4
grid $sep_w -row 2 -column 1 -sticky w
grid $b_ok -row 2 -column 2 -sticky w
grid $b_no -row 2 -column 3 -sticky e
grid $sep_e -row 2 -column 4 -sticky e
bind .new_db_menu <Key-KP_Enter> {return [new_db_ok_button]}
bind .new_db_menu <Return> {return [new_db_ok_button]}
bind .new_db_menu <Escape> {new_db_cancel_button}
# catch presses on the window's `x` button
wm protocol .new_db_menu WM_DELETE_WINDOW {
new_db_cancel_button
}
# make the top window unusable
focus $entr
grab release .
grab set .new_db_menu
}
proc new_db_ok_button {} {
new_db_cancel_button
return "$::new_db_window:db_name"
}
proc new_db_cancel_button {} {
grab set .
destroy .new_db_menu
}
One way would be to just use tkwait window $yourwindow to wait until the user closes the window. The window itself should probably use some variable passed to it by the client code to manage user input. For instance, if you need the user to input a database name, use the entry widget and bind it to a variable using its -textvariable option. After the window is closed, and tkwait in the client code returns, read the value of that variable.
Another approach is to not use modal windows and turn into event-driven control flow. That is, make your inquiry window to receive the name of a procedure which should be called when the user accepts its input (and that input is validated) and do any further processing there instead of posting a window and waiting until the user deals with it.
The relevant manual pages are: tkwait and options (for -textvariable).

Fade-to certain opacity using dojo

I'm using dojo toolkit. (version 1.6)
I'm unable to stop the fading effect at certain opacity (say 0.5)
Here is the code I'm using
var fadeArgs = {node: "disabled_div", duration: 3000};
dojo.style("disabled_div", "opacity", "0");
dojo.fadeIn(fadeArgs).play();
But the above code is fading the element's opacity from 0 to 1.
My requirement is to stop fading effect at 0.5 opacity.
Please help me out
Thanks in advance!
SuryaPavan
you may try like this:
var w = dojo.animateProperty({
node:"disabled_div",
duration: 3000,
properties: {
opacity: 0
},
onAnimate:function(a){
if(a.opacity <= .5)
w.stop();
}
})
OR
dojo.style("disabled_div", "opacity", "1");
var fadeArgs = {node: "disabled_div", duration: 3000,onAnimate:function(o){
if(o.opacity <= .5){
anim.stop()
}
}};
anim = dojo.fadeOut(fadeArgs);
anim.play();
You could use fadeTo from the DojoX extensions