我試圖使腳本有:複製當前選擇和URL並粘貼到Excel?
- 複製當前選擇和網址在Safari
- 貼在選擇小區1 在小區2
- 粘貼URL
- 轉到下面的小區1新行在Excel中
怎麼可以這樣使用AppleScript做什麼?
我已經開始與此:
tell application "Safari"
set theURL to URL of front document
set theText to (do JavaScript "(''+getSelection())" in document 1)
end tell
tell application "Microsoft Excel"
set value of active cell to the theURL
end tell
,但我不知道該怎麼導航來使用AppleScript相鄰單元。
adamh的代碼做這個完美:
tell application "Safari"
set theURL to URL of front document
set theText to (do JavaScript "(''+getSelection())" in document 1)
end tell
tell application "Microsoft Excel"
set foundRange to find range "A:A" what "" -- finds the first empty cell in column A
set the value of foundRange to theText
-- Work out its adjacent cell in same row
set cur_col to the first column index of foundRange
set cur_row to the first row index of foundRange
set nextCell to cell cur_row of column (cur_col + 1)
set value of nextCell to theURL
select cell (cur_row + 1) of column cur_col -- select the next logical cell
end tell
爲什麼你需要這到底是什麼?將URL寫入製表符分隔的文本文件是否足以將其導入到Excel中?你有沒有你自己試過的代碼? (當你在這裏發帖時,你應該至少對編碼有最少的瞭解)。 – Mark
我需要使用源URL保存一些引號,但我無法在Excel中的單元格之間導航。 – vantage5353
請回答我的問題,如果你想得到任何幫助。 – Mark