code_junkie

Using AppleScript to grab the URL from the frontmost window in web browsers: The definitive list

Nov 12th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. tell application "Safari"
  2. return URL of front document as string
  3. end tell
  4.  
  5. tell application "Firefox"
  6. set myFirefox to properties of front window as list
  7. return item 3 of myFirefox
  8. end tell
  9.  
  10. tell application "Firefox" to activate
  11.  
  12. tell application "Firefox" to activate
  13. tell application "System Events"
  14. keystroke "l" using command down
  15. keystroke "c" using command down
  16. end tell
  17.  
  18. tell application "Firefox" to activate
  19.  
  20. tell application "Firefox"
  21. if (front window) exists then do_something()
  22. end tell
  23.  
  24. tell application "System Events"
  25. tell process "Firefox"
  26. set frontmost to true
  27. set xsist to (front window) exists
  28. (* keep xsist value to test later on *)
  29. end tell
  30. end tell
  31.  
  32. tell application "Camino"
  33. return URL of current tab of front browser window as text
  34. end tell
  35.  
  36. tell application "Firefox"
  37. set myURL to «class curl» of window 1
  38. return myURL
  39. end tell
  40.  
  41. tell application "Camino"
  42. set p to properties of front tab of front window
  43. return |currentURI| of p as string
  44. end tell
  45.  
  46. tell application "OmniWeb"
  47. set myInfo to GetWindowInfo
  48. return item 1 of myInfo
  49. end tell
  50.  
  51. tell application "Opera"
  52. return URL of front document as string
  53. end tell
  54.  
  55. tell application "Flock"
  56. set p to properties of front window as list
  57. return item 3 of p
  58. end tell
  59.  
  60. tell application "Google Chrome"
  61. get URL of active tab of window 1
  62. end tell
Add Comment
Please, Sign In to add comment