The No.1 Website for Pro Audio
Gearslutz Safari Applescript wot i wrote
Old 26th April 2003
  #1
Mindreader
 
BevvyB's Avatar
 

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 "https://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 "https://www.gearslutz.com/board/" & this_item

else


set this_URL to "https://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
Old 26th April 2003
  #2
Nice one, Bev! thumbsup
Old 26th April 2003
  #3
Lives for gear
 
drew's Avatar
Not working for me.
Old 26th April 2003
  #4
Mindreader
 
BevvyB's Avatar
 

You must have the newest version of Safari which suports tabbed browsing
Old 26th April 2003
  #5
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?
Old 26th April 2003
  #6
Mindreader
 
BevvyB's Avatar
 

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.
Old 27th April 2003
  #7
Mindreader
 
BevvyB's Avatar
 

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!
Old 27th April 2003
  #8
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!!
Old 27th April 2003
  #9
Mindreader
 
BevvyB's Avatar
 

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.
Old 27th April 2003
  #10
Mindreader
 
BevvyB's Avatar
 

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
Old 27th April 2003
  #11
Lives for gear
 
drew's Avatar
I get this when I run it.
Attached Thumbnails
Gearslutz Safari Applescript wot i wrote-snapz-pro-xscreensnapz001.jpg  
Old 27th April 2003
  #12
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.
Old 27th April 2003
  #13
Mindreader
 
BevvyB's Avatar
 

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.
Old 27th April 2003
  #14
Lives for gear
 
pounce's Avatar
 

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.
Old 27th April 2003
  #15
Alright, Bev, should we try this again??!

Email it to me one mo' time and see if we can get this thing to fly!heh
Post Reply

Welcome to the Gearslutz Pro Audio Community!

Registration benefits include:
  • The ability to reply to and create new discussions
  • Access to members-only giveaways & competitions
  • Interact with VIP industry experts in our guest Q&As
  • Access to members-only sub forum discussions
  • Access to members-only Chat Room
  • Get INSTANT ACCESS to the world's best private pro audio Classifieds for only USD $20/year
  • Promote your eBay auctions and Reverb.com listings for free
  • Remove this message!
You need an account to post a reply. Create a username and password below and an account will be created and your post entered.


 
 
Slide to join now Processing…
Thread Tools
Search this Thread
Search this Thread:

Advanced Search
Forum Jump
Forum Jump