使用 AppleScript 更改对话框文本?
简单地说,是否可以更改 Apple 系统对话框中的“静态文本”字段?具体来说,我正在考虑更改密码弹出窗口的一些标签文本。我尝试通过 GUI 脚本使用 AppleScript:
tell application "System Events"
try
tell window 1 of process "loginwindow"
repeat until not (value of static text 4 is equal to "")
set value of static text 4 to "this is a test"
delay 0.5
end repeat
end tell
end try
end tell
尽管这似乎根本不起作用。还有其他方法吗?也许是脚本桥或其他?我不想从头开始编写自己的对话框(不是因为困难的原因,我可以轻松做到,我只是更喜欢接口而不是模拟。)
谢谢!
Simply, is it possible to change a "static text" field in an Apple system dialog box? Specifically I am looking into changing some label text of a password popup. I have tried using AppleScript via GUI scripting:
tell application "System Events"
try
tell window 1 of process "loginwindow"
repeat until not (value of static text 4 is equal to "")
set value of static text 4 to "this is a test"
delay 0.5
end repeat
end tell
end try
end tell
Although this does not seem to work at all. Any other methods? Perhaps Scripting Bridge or other? I'd prefer not to code my own dialogs from scratch (not for difficulty reasons, I could easily do it, I'd just prefer to interface rather than emulate.)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个想法...我认为您不能更改登录窗口文本本身,但您可以更改登录窗口的背景图片。因此,您可以设置一些图像,然后在登录过程中使用这些图像来显示您想要的内容。
我从未尝试过,但这篇文章展示了如何做到这一点... 此处 。
Here's an idea... I don't think you can change the login window text itself but you can change the background picture of the login window. Therefore you may be able to setup some images, and then use those images during the login process to display what you want.
I never tried it but this post shows how to do this... here.
经过大量研究,我不确定这是否可能 - 最好编写一个屏幕保护程序,实现它自己的密码保护,并允许从屏幕保护程序后面修改该对话框。
After much research, I'm not sure that this is possible - it would be best to write a screen saver, implement it's own password protection, and enable that dialog to be modified from behind the screen saver.