applescript - 如何在typora中使用applescript将markdown导出到html
问题描述
我想使用 Applescript 在 apptypora 上重复将导出降价到 HTML 的处理
我觉得可以分为两部分
第一:点击导出到HTML 第二:选择目标目录,点击保存
但我的第一步有问题
tell application "System Events"
tell application "Typora"
open "path/to/my/markdown.md"
end tell
tell process "Typora"
click (menu item "HTML" of menu "export" of menu item "export" of menu "file" of menu bar item "file" of menu bar 1)
end tell
end tell
此代码不起作用。运行此脚本后没有弹出窗口(要求我选择目标目录)
解决方案
这对我有用:
activate application "Typora"
delay 1
tell application "System Events"
tell process "Typora"
click (menu item "HTML" of menu "export" of menu item "export" of menu "file" of menu bar item "file" of menu bar 1)
delay 1
click button "Save" of sheet 1 of window 1
click button "Replace" of sheet 1 of sheet 1 of window 1
end tell
end tell
查找更多 UI 元素的有用命令是:entire contents of window 1
推荐阅读
- c - 如何将char(ASCII字符)转换为科学记数法,保存在C中的字符串变量中
- c# - 如何输出从多个输入中选择和添加值的值
- kubernetes - Kubernetes HPA 是增加节点数量还是仅仅增加 Pod 数量?
- swift - PHP与swift中的Ascii值不同
- python - 浮点数和整数相加并取绝对值
- javascript - 从 PHP/Javascript 调用 R 脚本
- ios - 在 UILabel 中拟合文本 - Swift
- visual-c++ - 从 mfc 扩展 dll 导出的无模式对话框不显示
- python - KeyError 即使密钥存在
- python - 没有功能卡住的阶乘问题