Jump to content

Welcome the ORIGINAL FileMaker Community

Take a moment to join us, no noise, all FileMaker...We Promise

Sign in to follow this  
cwilliams10

Go to New Posts and open each post in a separate tab in Safari

Recommended Posts

cwilliams10

Here is an easy way to go to the New Posts section on FileMaker Today, open each new post in its own tab and then go to the last tab. This way you can read the post and use command-w to close the tab when finished moving you to the next new post.

 

Requirements: Safari v3, Macintosh ( Uses AppleScript )

 

Instructions:

If you do not have your scripts menu turned on then open up "/Applications/AppleScript/AppleScript Utility.app/" and select "Show Script menu in menu bar" and also check "top" for "Show application scripts at:"

 

Copy this script into Script Editor ( /Applications/AppleScript/Script Editor )

Save the script in "/Users/user_name/Library/Scripts/Applications/Safari/FileMakerCafeNewPosts.scpt"

 

You may need to create the folder structure if it does not exist.

 

Now when Safari is the frontmost application and you choose the Scripts menu in the top menu bar, FileMakerCafeNewPosts will show in the top section. Click it and a new window will open to the New Posts section and all the tabs are created.

 

Please let me know if you have questions or comments.

 

--Date:	   Saturday July 25, 2009
--Author:     Craig Williams
--Desc:	   Open a tab for each new post on FileMaker Today and go to the last tab
--Requirements: Safari v3, Macintosh

property new_posts_url : "http://www.filemakertoday.com/com/search.php?do=getnew"

set js to "function in_array (array, item) {
for (var i=0; i < array.length; i++) {
	if ( array[i] == item ) {
		return true;
	}
}
return false;
}

var a_tags = document.getElementsByTagName('a');
var href_array = new Array();

// There are a lot of links on this page
// we can narrow our selection by only getting
// ones that contain showtread in them
var reg = new RegExp(/showthread/);

for (var i = a_tags.length - 1; i >= 0; i--) {
var href = a_tags[i].href;
if ( reg.test(href)) {

	// There are several duplicate links that
	// are longer than 56 chars so we further
	// reduce the list by testing for it.
	if ( href.length < 58 ) {

		// We also test to make sure this link
		// is not already in the array
		if ( !in_array(href_array, href)) {
			href_array.push(href);
		}
	}
}
}

href_array;"

tell application "Safari"
tell document 1 to set current_url to get URL
if current_url does not contain "http://www.filemakertoday.com/com/search.php" then
	make new document at beginning with properties {URL:new_posts_url}
end if

delay 2
set flag to false
repeat 20 times
	if (do JavaScript "document.readyState" in document 1) is "complete" then
		set flag to true
		exit repeat
	end if
	delay 1
end repeat

if flag is false then
	display dialog "There was an error loading the page." buttons {"Ok"} default button 1
	return
end if

tell document 1
	set new_posts to do JavaScript js
end tell

tell window 1
	repeat with i from 1 to count of new_posts
		set new_post to item i of new_posts
		make new tab with properties {URL:new_post}
	end repeat
	set current tab to tab -1
end tell
end tell

Share this post


Link to post
Share on other sites
Jack Rodgers

In Vista and XP I simply click on the url with the right button which opens a popup with the option to open in a new tab.

 

I believe you an do the same in Safari holding the Control key down or with a two button mouse.

 

Of course this is manual and one at a time...

Share this post


Link to post
Share on other sites
cwilliams10
Of course this is manual and one at a time...

 

Exactly smiley-wink

 

If there are several new posts, let's say 5 or more, then I use this script. If only one or two then I right-click and open them one at a time.

 

It's really about having choices and personal preference.

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use