如何使用Automator将窗口置于前面?
我使用的是 Mac OSX 10.6,并且我想在桌面应用程序中实现一个自动化功能。我手动按 Command+R 等待应用程序从物理设备读取一些数据 1 分钟,然后再次按 Command+R 进行另一次读取(此时它询问我是否要保存数据,所以我按选项卡,选项卡然后空格键选择保存数据我总共执行了3次,所以我想自动化这3次,这样我就可以离开计算机,它会自动读取3次
。最好的方法是什么?
我已经尝试通过使用“看我做”功能来执行此操作,这从“将无标题窗口置于前面”开始,然后第二个命令是按 command+R。然后,我找到一小段苹果脚本等待 1 分钟,然后将第一个操作插入等待函数中,
但是,当我单击运行或步骤时,而不是打开正确的窗口(“无标题”),光标移动到自动机中的“媒体”按钮,然后单击该按钮!但该应用程序绝对被列为正确的应用程序。
感谢任何帮助,但也许自动化是错误的方法?
I'm using a Mac, OSX 10.6 and I have a function in a desktop application that I want to automate. Manually I press Command+R wait for the application to read some data form a physical device for 1 minute, then press command+R again to take another reading (at this point it asks me if I want to save the data, so I press tab, tab and then space bar to select to save the data. I do this 3 times in total, so I want to automate the 3 times, so I can walk away from the computer and it will read 3 times automatically.
Is automator the best way to do this?
I've tried to do this already in automator by using the 'watch me do' function. This starts with the 'bring window Untitled to the front', and then the second command is press command+R. I then found a little piece of apple script to wait 1 minute and I plug the first action into that for the wait function.
However, when I click run or step, instead of going and opening up the correct window ("Untitled"), the cursor moves to the Media button in automator, and clicks that instead! But the application is definitely listed as the correct one.
Any help appreciated, but maybe automator is the wrong way to go?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Apple Script 是处理不需要任何“特殊处理”的事情的最佳方式,这些“特殊处理”需要由一系列不同的应用程序来完成。
1) 使用 AppleScript 实用程序
确保您在“AppleScript Utility”中启用了 GUI 脚本
2)使用脚本编辑器选择“文件”>“打开库”,然后查看您的应用程序是否具有任何可编写脚本的函数...这些可能是更好的方法。
3)创建一个新脚本并放入类似这样的内容...
我使用Firefox来测试它....应该适合您....
一旦您获得了脚本,您可以使用另存为将其保存为应用程序或将其另存为 ~/Library/Scripts 文件夹中的脚本,或将其粘贴到自动化工作流程中并使用 iCal 进行安排。
Apple Script is the best way to go for things that don't require any "special processing" that would need to be done by a chain of different applications.
1) uging the AppleScript Utility
make sure that you have GUI scripting enabled in the "AppleScript Utility"
2) using the Script Editor choose File>Open Library and see if your application has any scriptable functions ... these may be a better way to go.
3) Create a new script and put in something like this ...
I used Firefox to test it .... should work for you ....
Once you've got the script you can use the save as to make it into an app or save it as a script in your ~/Library/Scripts folder or paste it into an automator workflow and schedule it with iCal.
我不认为自动化是一条出路。您可以使用 applescript,但您应该查看 sikuli。您需要自己编写 Sikuli 脚本,但您所描述的内容应该不难
I don't think automator is the way to go. You could use applescript, but you should take a look at sikuli. You will need to write the Sikuli script yourself, but what you describe shouldn't be difficult