มีคนเคยถามไว้ใน Microsoft Comunity และก็มีคนมาตอบไว้ดีมาก
วันนี้ก็เลยมาเขียนตัวอย่างง่ายๆ ในการใส่ text, variable, expression, การกดปุ่ม และการกด shortcut ให้ดูกันด้วยคำสั่ง Send Keys
Parameter ของคำสั่ง Send keys
- Send keys to เป็นการระบุหน้าต่างที่ให้โรบอททำงาน สามารถเลือกได้ 4 แบบ คือ
- Foreground window หน้าต่างที่อยู่หน้าสุด (อาจทำงานผิดพลาดได้ ถ้ามีหน้าต่างอะไรเปิดขึ้นมาระหว่างที่โรบอททำงาน)
- UI element กด Add UI element (ถ้า Window name เปลี่ยนจะทำงานไม่ได้)
- Window instance/handle เลือก Window instance
- Title and/or class (ถ้า Title เปลี่ยนจะทำงานไม่ได้)

2. Text to Send
- Input as text, variable or expression
- Direct encrypted text input
- Insert special keys
- Insert modifier

3. Delay between keystrokes

4. Send Text as hardware keys
ระบุวิธีการใส่ key ถ้า OFF ใช้ไม่ได้ใ้หลองเปลี่ยนเป็น ON

การกด Shortcuts
แบบ 2 ปุ่ม {KeyCode1}({KeyCode2}) เช่น Ctrl+A จะเป็น
{Control}({A})
แบบ 3 ปุ่ม {KeyCode1}({KeyCode2}({Keycode3})) เช่น Ctrl+Shift+N จะเป็น
{Control}({Shift}({N}))

สามารถ copy source code ของบทความนี้ได้จาก link ด้านล่างแล้วนำไปวางที่ Workspace ของ Power Automate Desktop ได้เลย
Video


Leave a comment