The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Get URL and Title in OmniWeb Thread Tools Search this Thread Display Modes
I'm trying to reproduce this:
Code:
tell application "Safari"
	set thisPage to do JavaScript "document.URL" in document 1
	set thisTitle to do JavaScript "document.title" in document 1
end tell
In OmniWeb. I've opened OmniWeb in AppleScript, but I'm too much of a novice to puzzle it out. I found "GetWindowInfo," but haven't figured out how to assign the proper values to the "thisPage" and "thisTitle" variables.

This is the first half of an AppleScript by Scott Haneda at osxhelp.com for quickly sending off an email with URL and Title, but I want a version for OmniWeb since I'm moving back to OmniWeb full time.
 
This should accomplish the same thing:

Code:
tell application "OmniWeb"
	set windowID to id of front window
	set windowInfo to GetWindowInfo windowID
	set thisURL to first item of windowInfo
	set thisPage to second item of windowInfo
end tell
 
By the way, not that learning how to do this with a script is a bad thing, but what's wrong with File->Mail Link to This Page?
 
That solution works perfectly. Thanks.

Quote:
Originally Posted by whpalmer4 View Post
By the way, not that learning how to do this with a script is a bad thing, but what's wrong with File->Mail Link to This Page?
The way I have it set up, now, the second half of the script inserts those variables into an email template in Mail.app and sends it to a pre-set address. The script resides in my Scripts folder, and is accessible from the AppleScript menu bar item. So the current procedure is to browse to a page I want to send (I have multiple copies of the script for a couple different receiver addresses), select the appropriate script from the menu, and go back to browsing. Pull-down a menu, click a menu item. Done. The "Mail Link to This Page could do the same thing, but adds a couple of steps because I still have to start typing the recipient's name, then click "send." It's a nice functionality, and I'm sure I'll use it if I'm sending a page to somebody I don't already have a script for, but I'm used to my way and my way still saves a few seconds.

The final script:
Code:
-- Based on script made by Scott Haneda
-- http://osxhelp.com
-- 02/13/2008

-- Get the current URL
tell application "OmniWeb"
	set windowID to id of front window
	set windowInfo to GetWindowInfo windowID
	set thisPage to first item of windowInfo
	set thisTitle to second item of windowInfo
end tell

-- Create a new email message in mail.app
tell application "Mail"
	set this_message to make new outgoing message at beginning of every outgoing message
	tell this_message
		make new to recipient at beginning of to recipients ¬
			with properties {address:"example@example.com", «class rdsn»:"FirstName LastName"}
		set the subject to "URL from Moof"
		set the content to "This is an URL sent from an AppleScript for speed's sake: 
		
" & thisTitle & "
" & thisPage & "

--
Moof"
	end tell
	send this_message -- Send the email message
end tell
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clipping Title ckennedy OmniFocus 1 for Mac 0 2011-08-24 08:15 AM
RSS title in collections hardcoreUFO OmniWeb Bug Reports 2 2009-04-20 09:23 AM
Title of Clippings iBsteve OmniFocus 1 for Mac 4 2007-12-17 05:56 PM
Extracting title and URL Doug Pinkerton OmniWeb General 2 2007-09-17 03:36 PM
Window title always says "OmniWeb" madler OmniWeb Bug Reports 5 2006-06-24 07:00 PM


All times are GMT -8. The time now is 03:53 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.