0
votes

I want use Applescript to repeat the processing of export markdown to HTML on app typora

I think it can be two-part

first: click export to HTML second: choose the target directory and click save

but I have a problem with first step

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

this code doesn't work. no window popped up (ask me to choose target directory) after I run this script

1

1 Answers

0
votes

This works for me:

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

A useful command for finding more UI elements is: entire contents of window 1