Robotask cant find button in ribbon-bar of Word

Discuss RoboTask here
Post Reply
snowseals
Posts: 59
Joined: Mon Apr 11, 2016 10:17 am

Robotask cant find button in ribbon-bar of Word

Post by snowseals »

Hi,

I want to record a marco, so Robotask will click on a certain button in the ribbon bar of Word.
Since this ribbon-bar is customized, Robotasks ends with the message: cant find button.

How can I let Robotask 'click' this button?

See also:
Image
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Robotask cant find button in ribbon-bar of Word

Post by Oleg »

You can do this by using Send keystrokes action
Activate the window of MS Word and send these keys sequentially:
Alt, N, V

Pay attention, these keys for my MS Word with English localization.
For your Work maybe another keys. Press and release Alt -key in the word and you see keys in hints on the ribbon.

See my example below
The sequence "%()" is ALT-key simulation.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task119"
Hide=INTEGER|0
ID=INTEGER|-2020470416
LogOnAsUser=INTEGER|1
Name=STRING|"MS Word Ribbon"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_WINDOW_COMMAND"
Enabled=INTEGER|-1
Name=STRING|"Focus window ""- Microsoft Word"""
Params=FOLDER

[Actions\Action1\Params]
action=STRING|"0"
caption=STRING|"1"
child=STRING|"0"
class=STRING|"0"
classexact=STRING|"0"
exact=STRING|"0"
findmode=STRING|"0"
hidden=STRING|"0"
processall=STRING|"0"
wincaption=STRING|"- Microsoft Word"

[Actions\Action2]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 200 ms"
Params=FOLDER

[Actions\Action2\Params]
delay=STRING|"200"
dimension=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER

[Actions\Action3\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"0"
keylayout=STRING|"0"
keys=STRING|"%()NV"
pause=STRING|"20"
release=STRING|"1"
sendkind=STRING|"0"
wincaption=STRING|"- Microsoft Word"
Also see another example.
I just recorded the mouse by using MacroRecorder.
Next I changed "Windows caption" parameter in the steps #2, #5, #8 to "- Microsoft Word"
This is important, because the caption of the window may be changed.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task121"
Hide=INTEGER|0
ID=INTEGER|1862870897
LogOnAsUser=INTEGER|1
Name=STRING|"MS Word Ribbon (1)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Begin of MacroRecoder block"
Params=FOLDER

[Actions\Action1\Params]
comment=STRING|"Begin of MacroRecoder block"

[Actions\Action10]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//End of MacroRecoder block"
Params=FOLDER

[Actions\Action10\Params]
comment=STRING|"End of MacroRecoder block"

[Actions\Action2]
ActionID=STRING|"A_MOUSE_MOVETO"
Enabled=INTEGER|-1
Name=STRING|"Move To Object"
Params=FOLDER

[Actions\Action2\Params]
bottom=STRING|"142"
controlclass=STRING|"NetUIHWND"
ctrlclassexact=STRING|"0"
ctrltextexact=STRING|"1"
left=STRING|"0"
right=STRING|"1858"
top=STRING|"0"
winclassexact=STRING|"0"
windowclass=STRING|"OpusApp"
windowtext=STRING|"- Microsoft Word"
wintextexact=STRING|"0"
x=STRING|"145"
y=STRING|"42"

[Actions\Action3]
ActionID=STRING|"A_MOUSE_CLICK"
Enabled=INTEGER|-1
Name=STRING|"Click button"
Params=FOLDER

[Actions\Action3\Params]
action=STRING|"0"
button=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay"
Params=FOLDER

[Actions\Action4\Params]
delay=STRING|"8"

[Actions\Action5]
ActionID=STRING|"A_MOUSE_MOVETO"
Enabled=INTEGER|-1
Name=STRING|"Move To Object"
Params=FOLDER

[Actions\Action5\Params]
bottom=STRING|"142"
controlclass=STRING|"NetUIHWND"
ctrlclassexact=STRING|"0"
ctrltextexact=STRING|"1"
left=STRING|"0"
right=STRING|"1858"
top=STRING|"0"
winclassexact=STRING|"0"
windowclass=STRING|"OpusApp"
windowtext=STRING|"- Microsoft Word"
wintextexact=STRING|"0"
x=STRING|"145"
y=STRING|"40"

[Actions\Action6]
ActionID=STRING|"A_MOUSE_CLICK"
Enabled=INTEGER|-1
Name=STRING|"Click button"
Params=FOLDER

[Actions\Action6\Params]
action=STRING|"0"
button=STRING|"0"

[Actions\Action7]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay"
Params=FOLDER

[Actions\Action7\Params]
delay=STRING|"13"

[Actions\Action8]
ActionID=STRING|"A_MOUSE_MOVETO"
Enabled=INTEGER|-1
Name=STRING|"Move To Object"
Params=FOLDER

[Actions\Action8\Params]
bottom=STRING|"142"
controlclass=STRING|"NetUIHWND"
ctrlclassexact=STRING|"0"
ctrltextexact=STRING|"1"
left=STRING|"0"
right=STRING|"1858"
top=STRING|"0"
winclassexact=STRING|"0"
windowclass=STRING|"OpusApp"
windowtext=STRING|"- Microsoft Word"
wintextexact=STRING|"0"
x=STRING|"24"
y=STRING|"80"

[Actions\Action9]
ActionID=STRING|"A_MOUSE_CLICK"
Enabled=INTEGER|-1
Name=STRING|"Click button"
Params=FOLDER

[Actions\Action9\Params]
action=STRING|"0"
button=STRING|"0"
Save the text of the tasks to a files and use menu Task->Import to import the tasks into RoboTask.
Oleg Yershov
snowseals
Posts: 59
Joined: Mon Apr 11, 2016 10:17 am

Re: Robotask cant find button in ribbon-bar of Word

Post by snowseals »

Tried the 2nd one.. Works!
Thank you.
Post Reply