tell application "Safari"
try
set Title to name of window 1
set URL to URL of document 1
end try
end tell
However, in Firefox this code below fails about 20% of the time (URL NOT CAPTURED)...
Q: is there a better, quicker way to capture the Title and URL in Firefox that works 100% of the time?
tell application "Firefox" to activate
delay 0.5
tell application "Firefox"
set Title to name of front window
end tell
delay 1
tell application "System Events"
keystroke "l" using {command down} -- Highlight the URL field.
keystroke "c" using {command down}
end tell
delay 1
set theURL to the clipboard
Assuming that those variables exist, I think the incantations should have this kind of shape:
tell application ("Keyboard Maestro Engine")
set strTitle to value of (get variable ("kmVarTitle"))
set strURL to value of (get variable ("kmVarURL"))
end tell
WOW ComplexPoint - Both Your suggestions worked GREAT! - Now the Firefox page is getting captured EVERY Time (no misses) and I was able to transfer the 2 KM vars to AppleScript no problem!!!
Can someone share an example of this working, I tried it out, and it seems a bit slow and bumpy.
I was thinking about using Grease Monkey or something to Grab the URL of a webpage, and
push that to Key Board Maestro, but it seems to throw a CORS Violation. I'm trying to think
of a better way to do this.
There are some Firefox Plugin's that change the Title of the Window to a URL, they seemed to
work,