Gearslutz Safari Applescript wot i wrote - Gearslutz.com

Gearslutz.com

All Advertisers
Go Back   Gearslutz.com > The Forums > So much gear, so little time!


Gearslutz Safari Applescript wot i wrote

New Reply New Reply Thread Tools Search this Thread
Old 26th April 2003   #1
Mindreader
 
BevvyB's Avatar
 
Joined: Jun 2002
Location: London
Posts: 2,604

Thread Starter
Send a message via AIM to BevvyB
Gearslutz Safari Applescript wot i wrote

OK

I give in

here's the code in all its glory (not)

For those of you not familiar with applescript, you open up the included software called 'Script Editor', put this code inside it by copy/paste, then press 'Save As' and then shoose 'Save As Application' or 'Run Only'

It will create a little app that executes this script.

Let me know if it works.

** ONLY WORKS IN OSX RUNNING NEW VERSION OF SAFARI

Oh, what does it do:

It opens up the main gearslutz categories in new tabs in safari

_________________________

property timeout_value : 60

tell application "Safari"
activate
try

if not (exists document 1) then
make new document at the beginning of documents
end if


set the URL of the front document to "http://www.gearslutz.com"


delay 2

if my page_loaded(timeout_value) is false then error "The page did not load in the indicated timeout value."


set the links_count to (do JavaScript "document.links.length" in document 1) as integer
set the links_list to {}
if the links_count is not 0 then
repeat with i from 0 to (the links_count - 1)
set this_link to (do JavaScript ("document.links[" & (i as string) & "].href") in document 1)
if this_link contains "forumdisplay" and this_link is not in the links_list and this_link does not contain "16" and this_link does not contain "7" and this_link does not contain "8" and this_link does not contain "20" then
set the end of the links_list to this_link
end if
end repeat
end if

close document 1

make new document at the beginning of documents

repeat with i from 1 to the number of items in links_list

set this_item to item i of links_list

if i is 1 then

set the URL of the front document to "http://www.gearslutz.com/board/" & this_item

else


set this_URL to "http://www.gearslutz.com/board/" & this_item

my new_tab()
set the URL of document 1 to this_URL

end if

end repeat


on error the error_message number the error_number

if the error_number is not -128 then
set the error_text to "Error: " & the error_number & ". " & the error_message
display dialog the error_text buttons {"Cancel"} default button 1
end if
end try
end tell

on page_loaded(timeout_value)
repeat with i from 1 to the timeout_value
tell application "Safari"
if (do JavaScript "document.readyState" in document 1) is "complete" then
return true
else if i is the timeout_value then
return false
else
delay 1
end if
end tell
end repeat
return false
end page_loaded

on new_tab()
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
end new_tab
BevvyB is offline   Reply With Quote
Old 26th April 2003   #2
Lives for gear
 
bleen's Avatar
 
Joined: Nov 2002
Location: Seattle
Posts: 2,267

Nice one, Bev! thumbsup
bleen is offline   Reply With Quote
Old 26th April 2003   #3
Lives for gear
 
drew's Avatar
 
Joined: Jun 2002
Location: Maryland,USA
Posts: 3,538

Not working for me.
drew is offline   Reply With Quote
Old 26th April 2003   #4
Mindreader
 
BevvyB's Avatar
 
Joined: Jun 2002
Location: London
Posts: 2,604

Thread Starter
Send a message via AIM to BevvyB
You must have the newest version of Safari which suports tabbed browsing
BevvyB is offline   Reply With Quote
Old 26th April 2003   #5
Lives for gear
 
bleen's Avatar
 
Joined: Nov 2002
Location: Seattle
Posts: 2,267

Hmmm...I should clarify my post. When I wrote "Nice one, Bev!", I meant cool idea. This was before trying to run it. No joy here either....

I have Safari 1.0 Beta 2 (v73) and use tabs all the time, so that's not the issue. The script is not able to be opened in the AppleScript editor as it's read-only.

Any thoughts, Bev?
__________________
don gunn
recording/mix guy
www.dongunn.com
bleen is offline   Reply With Quote
Old 26th April 2003   #6
Mindreader
 
BevvyB's Avatar
 
Joined: Jun 2002
Location: London
Posts: 2,604

Thread Starter
Send a message via AIM to BevvyB
bizarre

Mine works fine I've been using it all day and it's rather a cool thing.

I'll fix it later. I'm off to see Beck now at the Albert Hall.
BevvyB is offline   Reply With Quote
Old 27th April 2003   #7
Mindreader
 
BevvyB's Avatar
 
Joined: Jun 2002
Location: London
Posts: 2,604

Thread Starter
Send a message via AIM to BevvyB
Ok it works now

I had accidentally posted up the 'work in progress' script instead of the real one.


Duh.

Beck was good by the way. I didn't realise he was that good on harmonica!
BevvyB is offline   Reply With Quote
Old 27th April 2003   #8
Lives for gear
 
bleen's Avatar
 
Joined: Nov 2002
Location: Seattle
Posts: 2,267

Ummm...nope, no dice. Is it at the same link as before? Should I just be double-clicking the script and expecting it to open Safari?

Were the Flaming Lips backing Beck? I'd love to see that show!!
bleen is offline   Reply With Quote
Old 27th April 2003   #9
Mindreader
 
BevvyB's Avatar
 
Joined: Jun 2002
Location: London
Posts: 2,604

Thread Starter
Send a message via AIM to BevvyB
It was my frikkin iDisk screwing the file up.

It works fine when i drag it out of my idisk, but it does some kind of its own wierd compression on it when you download it from the web page.

So I stuffed it myself and stuck it up.

Now try.

Oh and it was Beck doing an acoustic set. He twiddled around on piano and a bit of rhodes, made some strange noises with a drum machine, and played a wierd wind organ thing. And sang Loser.
BevvyB is offline   Reply With Quote
Old 27th April 2003   #10
Mindreader
 
BevvyB's Avatar
 
Joined: Jun 2002
Location: London
Posts: 2,604

Thread Starter
Send a message via AIM to BevvyB
Man it STILL doesn't work.

iDisk is losing resource fork of the frikkin file and giving it the wrong attributes making it look like its an editable script.

Piece of s*** iDisk grr, etc
BevvyB is offline   Reply With Quote
Old 27th April 2003   #11
Lives for gear
 
drew's Avatar
 
Joined: Jun 2002
Location: Maryland,USA
Posts: 3,538

I get this when I run it.
Attached Thumbnails
Gearslutz Safari Applescript wot i wrote-snapz-pro-xscreensnapz001.jpg  
drew is offline   Reply With Quote
Old 27th April 2003   #12
Lives for gear
 
bleen's Avatar
 
Joined: Nov 2002
Location: Seattle
Posts: 2,267

I'm getting the same error.

Bev, email it to me (raw script, no Stuffit) and I'll put it up on my server with a link here so people can grab it.
bleen is offline   Reply With Quote
Old 27th April 2003   #13
Mindreader
 
BevvyB's Avatar
 
Joined: Jun 2002
Location: London
Posts: 2,604

Thread Starter
Send a message via AIM to BevvyB
I just emailed it myself and it worked fine

For some reason as soon as it's stuffed it loses its mind.

I'll email it to you then.
BevvyB is offline   Reply With Quote
Old 27th April 2003   #14
Lives for gear
 
pounce's Avatar
 
Joined: Dec 2002
Location: columbus, ohio
Posts: 943

Send a message via Yahoo to pounce
Quote:
Originally posted by BevvyB


For some reason as soon as it's stuffed it loses its mind.

oh how many mornings have i said this.

sorry, still in a psw kind of mood.
__________________
cheers

paul
paper street audio company
www.paperstreetaudio.com
pounce is offline   Reply With Quote
Old 27th April 2003   #15
Lives for gear
 
bleen's Avatar
 
Joined: Nov 2002
Location: Seattle
Posts: 2,267

Alright, Bev, should we try this again??!

Email it to me one mo' time and see if we can get this thing to fly!
bleen is offline   Reply With Quote
New Reply New Reply Submit Thread to Facebook Facebook  Submit Thread to Twitter Twitter  Submit Thread to LinkedIn LinkedIn 



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread starter Forum Replies Last Post
Anyone good with applescript? Or help. Chippy569 Music computers 6 9th May 2011 02:43 AM
Wot y'all using for SFX database? jahtao Post Production forum! 37 18th January 2010 12:33 PM
Wot? tags not working? Blast9 So much gear, so little time! 1 27th March 2007 01:12 PM
BSS gear: wot the...? Bob the V High end 6 16th August 2006 07:54 PM
Wots the best way to transfer Nuendo to PT HD? shipshape High end 6 7th May 2005 12:48 AM


All times are GMT +1. The time now is 11:08 AM.

Home - Search Forum - Contact Us - Terms Of Use - Advertise on Gearslutz - All Advertisers - Archive - Top
 
 
Powered by vBulletin®
Gearslutz.com LTD - UK Company Number 7597610.
Registered Office - 35 Ballards Lane, London, N3 1XW.
Hosted by Nimbus Hosting.

SEO by vBSEO ©2010, Crawlability, Inc.