FasdUAS 1.101.10 k l Q k   OY  kX Z% H l I .coredoexboolobj 4   docu m  k! I .sysodlogaskrTEXT m ,&You need to open a web location first!  btns J  ! !m" "OK#  dflt #m$ $L!%& %r&0'( 'c&.)* )l&,+ +n&,,- ,1*,  conT -4&*.  docu .m() *m,-  ctxt (o 0mysourcemySource&/0 /Z1K12 1l163 3=1645 4n1467 6124  leng 7o12 0mysourcemySource 5m45 2k9G889: 9I9D;< .sysodlogaskrTEXT ;m9:= =,&You need to open a web location first!<>?  btns >J;>@@A Am;<B BOK?C  dflt Cm?@:D DLEG0E ErLXFG FcLTHI HnLRJK J1PR  pnam K4LPL  docu LmNO ImRS  ctxt Go 0mynamemyName mMMnull߀< Safari.appǐ]~%̐@@DsfrialisL Macintosh HDH+< Safari.appWO1c Applications1S<$Macintosh HD:Applications:Safari.app Safari.app Macintosh HDApplications/Safari.app/ NO NlZZOPQ PlZZQRS ROZfTU TI`e .miscactvnullnull UmZ]VVnull߀< TextMate.app]~%̐@@DTxMtalisT Macintosh HDH+< TextMate.app*T ApplicationsT<&Macintosh HD:Applications:TextMate.app TextMate.app Macintosh HDApplications/TextMate.app/SWX WlggXYZ Yrgy[\ [Igu] 0 replace_chars]^_ ^ohk 0mynamemyName_`a `mknb b http://ac cmnqd d \o 0mynamemyNameZef erzgh gIzi 0 replace_charsijk jo{~ 0mynamemyNameklm lm~n n/mo omp p: ho 0mynamemyNamefqr qlrst sZuvw uGxy xlz zD{| {o 0mynamemyName |m} } .html yl~ ~D o 0mynamemyName m .htm vr b m /tmp/ o 0mynamemyName o 0mypathmyPath wr b b m /tmp/ o 0mynamemyName m .html o 0mypathmyPatht l I .sysoexecTEXTTEXT b m rm -f  n 1  strq o 0mypathmyPath I .sysoexecTEXTTEXT b b b m echo  n 1  strq o 0mysourcemySource m  >>  n 1  strq o 0mypathmyPath I .sysoexecTEXTTEXT b m open -a TextMate  n 1  strq o 0mypathmyPath R .ascrerr ******** l i I 0 replace_chars o 0 this_text o 0 search_string o 0replacement_string k  r l o 0 search_string n 1  txdl 1  ascr r n 2  citm o 0 this_text l o 0 item_list r  l o 0replacement_string n 1  txdl 1   ascr r c l o 0 item_list m  TEXT o 0 this_text r m  n 1  txdl 1  ascr L o 0 this_text ~}|{zy 0 replace_chars .aevtoappnull**** ~0mysourcemySource }0mynamemyName |0mypathmyPath{zyxwvu x0 replace_charswttsrq s 0 this_text r0 search_string q0replacement_stringvponm p 0 this_text o0 search_string n0replacement_string m 0 item_listlkji l ascr k txdl j citm i TEXTu!,FO-EO,FO&EO,FOhgfe h.aevtoappnull**** kddgf'Mcba"`_^]\[Z=BYXVWbdVnp}UTSRQP c docu b.coredoexboolobj a btns ` dflt_ ^.sysodlogaskrTEXT ] conT \ ctxt [0mysourcemySource Z leng Y pnam X0mynamemyName W.miscactvnullnull V0 replace_chars U bool T0mypathmyPath S strq R.sysoexecTEXTTEXTQPeS*k/j  kvk OhYhO*k/,&EO,jkvk OhYhO*k/,&E`UOa*j UO*_aam+E`O*_aam+E`O_a _aa&a_%E`Ya_%a%E`Oa_a ,%j !Oa"a ,%a#%_a ,%j !Oa$_a ,%j !WX%&h  [TxMt] Safari view source

[TxMt] Safari view source

Fred B. fredb7 at starflam.com
Tue Nov 29 22:25:14 GMT 2005


On 29 Nov 2005, at 23:09, Alec B. Beardsley wrote:

> Has anyone come up with a way to view the source of the current  
> page from safari in textmate?
>

I wrote this AppleScript:

try
	tell application "Safari"
		if not (exists document 1) then
			display dialog "You need to open a web location first!" buttons  
{"OK"} default button 1
			return
		end if
		set mySource to the source of front document as text
		if (length of mySource is 0) then
			display dialog "You need to open a web location first!" buttons  
{"OK"} default button 1
			return
		end if
		set myName to name of front document as text
	end tell
	
	
	tell application "TextMate" to activate
	
	set myName to replace_chars(myName, "http://", "")
	set myName to replace_chars(myName, "/", ":")
	
	if (myName ends with ".html") or (myName ends with ".htm") then
		set myPath to "/tmp/" & myName
	else
		set myPath to "/tmp/" & myName & ".html"
	end if
	
	do shell script "rm -f " & quoted form of myPath
	do shell script "echo " & quoted form of mySource & " >> " & quoted  
form of myPath
	do shell script "open -a TextMate " & quoted form of myPath
end try

on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars

Paste it in Script Editor.app and save as script or application.
You can then use LaunchBar, QuickSilver, etc. to launch it...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/textmate/attachments/20051129/7f69c546/attachment-0001.htm


More information about the textmate mailing list
 3[TxMt] Safari view source =#/tmp/[TxMt] Safari view source.html ascr ޭ