Skip to content

Instantly share code, notes, and snippets.

@patricorgi
Created February 20, 2019 18:10
Show Gist options
  • Save patricorgi/73f18da3d80b5e81acf9c7ebdb4c5d13 to your computer and use it in GitHub Desktop.
Save patricorgi/73f18da3d80b5e81acf9c7ebdb4c5d13 to your computer and use it in GitHub Desktop.
tell application "Money Pro" to activate
set dialogResult to display dialog "请输入金额:" default answer "" with icon file "Applications:Money Pro.app:Contents:Resources:AppIcon.icns" buttons {"Cancel", "Continue"} default button "Continue"
if button returned of dialogResult is "Cancel" then return
set theCost to text returned of dialogResult
if theCost is equal to "" then
display notification "因为你他喵的啥也没输入……" with title "AppleScript 已停止"
return
else
try
set theCostNumber to theCost as number
on error
display notification "你必须输入数字才行!" with title "AppleScript 已停止"
return
end try
end if
set theNote to text returned of (display dialog "请输入项目内容:" default answer ¬
(linefeed & linefeed & linefeed) with icon file "Applications:Money Pro.app:Contents:Resources:AppIcon.icns")
tell application "System Events"
tell process "Money Pro"
click button 2 of group 1 of group 1 of group 1 of window 1
delay 0.3
click pop up button 1 of UI element 1 of row 1 of table 1 of scroll area 1 of window 1
click (first menu item whose title contains "Discover") of menu 1 of pop up button 1 of UI element 1 of row 1 of table 1 of scroll area 1 of window 1
delay 0.1
click pop up button 1 of UI element 1 of row 2 of table 1 of scroll area 1 of window 1
click menu item "买买买" of menu 1 of pop up button 1 of UI element 1 of row 2 of table 1 of scroll area 1 of window 1
click menu item "软件" of menu 1 of menu item "买买买" of menu 1 of pop up button 1 of UI element 1 of row 2 of table 1 of scroll area 1 of window 1
set value of text field 1 of UI element 1 of row 2 of table 1 of scroll area 1 of window 1 to theCost
click button 1 of UI element 1 of row 5 of table 1 of scroll area 1 of window 1
delay 0.2
set value of text area 1 of scroll area 1 of UI element 1 of row 6 of table 1 of scroll area 1 of window 1 to theNote
click button "保存" of window 1
end tell
end tell
@cnaron
Copy link

cnaron commented Feb 22, 2019

Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment