Grab URL Script Redeux

John Gruber has posted a “Grab URL” script for BBEdit, handy when working in BBEdit and you’d like to grab an existing page’s code. His script, however, requires you to enter in your own URL by hand or by copy/paste. I thought it’d be neat if it auto-magically grabbed Safari’s top-most URL instead. This could easily be written for Camino, I’m sure. Anyhoo, if you want it, get it here and drop it in your /Applications/BBEdit/BBEdit Support/Scripts folder. It’ll show up in the “Scripts” menu un BBEdit, strangely enough.

Now, this does a little bit of checking to see if Safari is actually running. If it’s not running, it just gives you the empty text field as before. This will only work correctly if Safari is somewhere (anywhere) within your /Applications directory. It was the quickest way I could think of to do it. I gotta say, I like AppleScript’s string search capability much more than the traditional Regular Expression baloney you have to wade through in PHP or JavaScript, even when you’re just doing a simple search.

The UPDATED source is below:

-- originally written by John Gruber
-- at daringfireball.net to just be an
-- empty text field
-- edited by kevin conboy at alternate.org
--to automatically take the top-most URL in safari
-- DOES NOT WORK WITH SAFARI'S TABS
-- I'm sure someone can get it to work with
-- GUI Scripting beta, though

tell application "System Events"
	set proclist to creator type of every process
	if proclist contains "sfri" then
		tell application "Safari"
			set safari_url to URL of document 1
		end tell
	else
		set safari_url to ""
	end if
end tell


tell application "BBEdit"
	set my_result to display dialog ¬
		"URL:" default answer safari_url ¬
		buttons {"Cancel", "With Headers", "Grab Source"}¬
default button 3
	set my_url to the text returned of my_result

	if button returned of my_result is "With Headers" then
		set my_text to do shell script ("curl -i " & my_url)
	else
		set my_text to do shell script ("curl " & my_url)
	end if

	make new text window with properties {contents:my_text,¬
name:my_url}
	select insertion point before character 1 of text window 1
end tell

Mix-A-Lot on Bush

Sir Mix-A-Lot on GW:

I didn’t like when George W. Bush got on TV and said “Axis Of Evil.” I knew that was going to create problems, that kind of arrogant shit. What I was trying to say with “National Anthem” was that before we go and brag and say “God Bless America”—I hate that term, because it insinuates that God blesses no place else but us—before we say that, let’s get our own house in order. That’s always been a problem with America. I didn’t realize until I went to Europe how people perceive us as bullies. They look at us as someone who’s always up in somebody else’s business. The more you look at it, the more you realize it’s true.

Protest is Patriotism

Keeps getting better and better…

“Here we are in June of 2003. Show me the weapons; where are they? What evidence did this administration have to spend $63 billion in taxpayers’ money? What evidence did this administration have to put the lives of American servicewomen and men on the line?”

-U.S. Congressman Dennis Kucinich, June 5, 2003

Photoshop 8 Screenshots

Re: Photoshon 8 Screenshots

Dear Sir or Madam::

Please find attached a copy of the above-referenced article currently posted on the Alternate website. Adobe cannot and will not confirm or deny the accuracy of any rumor posted on your site. Nonetheless, the article contains confidential information, UI designs and other artwork owned by Adobe that were either directly misappropriated by you or were provided to you by a source in breach of a confidentiality agreement with Adobe. We have not granted you permission to publish these materials and in doing so you infringe upon our trade secret rights and copyrights.

Your publication of unsubstantiated rumors and Adobe intellectual property directly damages our business interests and puts us at a disadvantage vi+his our competitors.

Adobe requests that you immediately remove the above-referenced article from your website and not further disseminate or disclose such article or its contents to any other party. This includes dissemination or disclosure to other rumor sites. Adobe also requests that you not publish or otherwise disclose any other Adobe designs or artwork without its permission, and that you not publish other information about upcoming versions of Adobe products that you know or should know is confidential and proprietary to Adobe. Please confirm your compliance with the foregoing.

Thank you for your immediate attention to this matter. You may contact me with any questions or comments you have.

Panic, Adobe, Quark, Microsoft, Macromedia, Omni and 300,000 other developers are moving to Linux. Haven't you heard?

From MS-owned Slate: Linux’s new popularity may hurt Apple more than Microsoft.

Apple still has software applications not available on Linux—such as Quark for publishing, or Photoshop for graphics—but if Salkever’s analyst buddies step forth and pronounce Linux the No. 2 platform, software companies will re-evaluate their commitments.

Right. Macromedia is going to write Flash MX for KDE/Qt. Adobe’s going to write a GNOME version of Photoshop Elements. Every developer devoted to Apple’s platform is going to automagically change development platforms, processors, coding languages and sales channels, just because Linux may be announced as the #2 desktop OS by some lame assfuck who doesn’t know shit about shit, or more importantly, shit about Apple or Linux.

The one thing he neglects to mention (actually there are many things… which distribution of Linux? Which GUI? tcsh or bash? Sawfish or WindowMaker? How many grandmothers out there run Linux as opposed to Macs?) is that software developers can make money by writing software for Apple’s platform. Perhaps not as much as they would (theoretically) for Windows, but don’t forget that the amount of competitors a developer faces within the Windows world is exponentially larger to that of the Macintosh.

Write apps for Linux and decide to charge for them? Desktop apps, no less? Good fucking luck. Did we not just watch VA/Linux and all the other Linux guys go under or combine or get purchased because it’s very difficult to sell software that’s written for a free platform?

So what do you think? If BusinessWreck (er.. Week) decides to announce Linux as the #2 desktop install, are you going to switch?

UPDATE: John Gruber responds, as well. Now of course, his response is very carefully thought-out, and doesn’t contain gratuitous use of the word ‘fuck.’ But the point is basically the same.