3. 改变档案辩证的夹:
try
try -- this would result in an error when there s no clipboard
set old to the clipboard
end try
-- delay 1 -- for testing
-- activate application "Safari"
tell application "System Events"
keystroke "s" using command down
keystroke "g" using {shift down, command down}
delay 0.1
set the clipboard to "~/Movies/"
delay 0.1
keystroke "av" using command down
delay 0.1
keystroke return
delay 0.1
end tell
set the clipboard to old
end try
a. 向特定文件夹提供部分编码的URL作为档案名称:
tell application "Safari"
set x to URL of document 1
set r to do shell script "echo " & quoted form of x & " | sed s|/$||;s|:|%3A|g;s|/|%2F|g "
do shell script "curl " & x & " > " & quoted form of ((system attribute "HOME") & "/Desktop/" & r & ".html")
end tell
a. 向特定文件夹投稿,但手工选择文件名称:
tell application "Safari"
set x to URL of document 1
set answer to text returned of (display dialog "" default answer ".html")
do shell script "curl " & x & " > " & quoted form of ((system attribute "HOME") & "/Desktop/" & answer)
end tell