xulihang Well-Known Member Licensed User Longtime User Jan 24, 2019 #1 I want to automate Microsoft Word to replace text. It needs the following steps: CTRL+H to open the search and replace dialog ALT+P to switch to replace tab ALT+N to switch to "find" and input the text ALT+I to switch to "replace" and input the text ALT+F to find a match ALT+R to replace I tried JAWTRobot, but it does not seem to work. Is this because AWTRobot is for java programs and I should use Autoit or VBA to do this?
I want to automate Microsoft Word to replace text. It needs the following steps: CTRL+H to open the search and replace dialog ALT+P to switch to replace tab ALT+N to switch to "find" and input the text ALT+I to switch to "replace" and input the text ALT+F to find a match ALT+R to replace I tried JAWTRobot, but it does not seem to work. Is this because AWTRobot is for java programs and I should use Autoit or VBA to do this?
xulihang Well-Known Member Licensed User Longtime User Jan 24, 2019 #2 I plan to use Python with https://github.com/asweigart/pyautogui. Maybe BAnano can be used to write a web front end as developing GUI program with Python is not easy. Upvote 0
I plan to use Python with https://github.com/asweigart/pyautogui. Maybe BAnano can be used to write a web front end as developing GUI program with Python is not easy.
Daestrum Expert Licensed User Longtime User Jan 24, 2019 #3 You can use JAWTRobot to interact with MS Word. I have used it to edit files in the B4J IDE, the program it interacts with doesn't have to be a java program. Upvote 0
You can use JAWTRobot to interact with MS Word. I have used it to edit files in the B4J IDE, the program it interacts with doesn't have to be a java program.
Daestrum Expert Licensed User Longtime User Jan 24, 2019 #4 Or another thought you could use the POI lib and edit the word files directly. Upvote 0
xulihang Well-Known Member Licensed User Longtime User Jan 24, 2019 #5 Daestrum said: You can use JAWTRobot to interact with MS Word. Click to expand... I find AWTRobot partly works but combo does not work, like ctrl+h. I use the test code below. Run the B4J app and switch to Word. The dialog does not show. Code: Copy Do While True Log("combo") Sleep(1000) Dim awt As AWTRobot awt.RobotSpecialKeyCombo("ctrl_h") Loop Daestrum said: use the POI lib and edit the word files directly. Click to expand... I have thought about this. But it is a bit complicated and users cannot see the replacing process directly. And ultimately, I want to create a universal text replacer which works for word, excel, ppt, photoshop, indesign, etc. Upvote 0
Daestrum said: You can use JAWTRobot to interact with MS Word. Click to expand... I find AWTRobot partly works but combo does not work, like ctrl+h. I use the test code below. Run the B4J app and switch to Word. The dialog does not show. Code: Copy Do While True Log("combo") Sleep(1000) Dim awt As AWTRobot awt.RobotSpecialKeyCombo("ctrl_h") Loop Daestrum said: use the POI lib and edit the word files directly. Click to expand... I have thought about this. But it is a bit complicated and users cannot see the replacing process directly. And ultimately, I want to create a universal text replacer which works for word, excel, ppt, photoshop, indesign, etc.
R Roycefer Well-Known Member Licensed User Longtime User Jan 24, 2019 #6 If my recollection serves me, ctrl_h is not one of the listed combos in the comments for RobotSpecialKeyCombo. This means you will have to separately press and release the ctrl and h keys. Upvote 0
If my recollection serves me, ctrl_h is not one of the listed combos in the comments for RobotSpecialKeyCombo. This means you will have to separately press and release the ctrl and h keys.
xulihang Well-Known Member Licensed User Longtime User Jan 24, 2019 #7 Roycefer said: This means you will have to separately press and release the ctrl and h keys. Click to expand... This works. Thanks! Code: Copy Do While True Sleep(1000) awt.RobotSpecialKeyPress("control") awt.RobotKeyPress("h") awt.RobotSpecialKeyRelease("control") awt.RobotKeyRelease("h") Log("combo") Loop Upvote 0
Roycefer said: This means you will have to separately press and release the ctrl and h keys. Click to expand... This works. Thanks! Code: Copy Do While True Sleep(1000) awt.RobotSpecialKeyPress("control") awt.RobotKeyPress("h") awt.RobotSpecialKeyRelease("control") awt.RobotKeyRelease("h") Log("combo") Loop