I've searched high and low and cannot find the answer to this.
How do I copy and paste the URL from Chrome into Excel?
Essentially, I have a project at work where I have to copy and paste values into a search engine. I have to save the URL of the results from that search. I don't know how to do this using Applescript. This is the code I have so far. I know it's not elegant, but I'd appreciate any help!
tell application "Microsoft Excel" to activate
tell application "System Events"
tell process "Microsoft Excel"
keystroke "c" using command down
end tell
end tell
delay 0.4
tell application "Google Chrome" to activate
tell application "System Events"
tell process "Google Chrome"
keystroke "a" using command down
keystroke "v" using command down
end tell
delay 0.5
tell application "System Events"
tell process "Google Chrome"
keystroke return
end tell
end tell
delay 5.0
tell application "Google Chrome"
get URL of active tab of first window as text
end tell
delay 5.0
tell application "System Events" to keystroke "w" using command down
end tell
tell application "Microsoft Excel" to activate
tell application "System Events"
tell process "Microsoft Excel"
keystroke tab
keystroke "v" using command down
keystroke down
keystroke left
end tell
end tell