Skip to content

Instantly share code, notes, and snippets.

@cmin764
Created March 23, 2022 09:35
Show Gist options
  • Select an option

  • Save cmin764/73f0c2e659233bcbc1a1200ff231f79f to your computer and use it in GitHub Desktop.

Select an option

Save cmin764/73f0c2e659233bcbc1a1200ff231f79f to your computer and use it in GitHub Desktop.
`RPA.Windows` - Notepad automation
Notepad write text into a file
Windows Search notepad
Control Window subname:'- Notepad'
${ver} = Get OS Version
IF "${ver}" == "11"
Click Edit wait_time=0.5
Click Font wait_time=0.5 # for some reason this only highlitghts the button
Click Font # and this finally clicks it
Send Keys keys={TAB}{TAB}{TAB} interval=0.2 wait_time=0.3 send_enter=${True}
Click name:'Lucida Sans Unicode' wait_time=0.5
Send Keys keys={TAB}{TAB} interval=0.2 wait_time=0.3 send_enter=${True}
Click name:'26' wait_time=0.5
Click name:'Back'
ELSE
Control Window Font
Click type:MenuBar name:Application > name:Format
Click name:Font...
Select type:ComboBox id:1136 Trebuchet MS
Select type:ComboBox id:1138 28
Click type:Button name:OK
END
Control Window subname:'- Notepad'
Send Keys keys={Ctrl}a{Del}
Send Keys keys=Lets add some text to the notepad
Control Window subname:'- Notepad'
IF "${ver}" == "11"
Click File wait_time=0.3
Click Save as
Click Save as wait_time=1.5
ELSE
Click type:MenuBar name:Application > name:File
Click type:MenuItem subname:'Save As'
END
Send Keys keys=best-win-auto.txt{Enter} interval=0.1
${run} = Run Keyword And Ignore Error Control Window Confirm Save As timeout=0.5
IF "${run}[0]" == "PASS"
Click Yes wait_time=0.3
END
Minimize Window subname:'- Notepad'
[Teardown] Close Current Window
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment