Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tsolignani

macrumors newbie
Original poster
Jan 21, 2011
12
0
Vignola, Modena, Italy
I have a bookmarklet to create a new gmail message in a pop-up window, which is very handy for me. To use it, I click on the bookmark menu bar into my browser (Chrome).

I would like to add it to the dock, this way I would have it available without needing to open a browser window.

I know you can drag normal bookmark (ordinary web addresses) to the Desktop and obtain a .webloc file. Then you can drag that file to the dock. Or you can drag it direclty to the dock.

Unfortunately, I cannot drag the bookmarklet to the Desktop and to the dock neither. If I try to drag to the Desktop, nothing happens. If I drag to the dock, a webloc file is added to the right part of the dock (near the trash bin), but when I click on it I get an error message stating there is not a default application to open that link.

I tried with Fluid, but when creating the app it just freezes and stops going ahead.

I tried creating a webloc on the Desktop with a normal web address and then editing it, no use.

Is there a way to link or insert a bookmarklet into the dock?

Thank you.


–
cordialmente,

tiziano solignani, da  Mac
http://bit.ly/gdi2ZX, http://bit.ly/gwjT6c, http://bit.ly/ie8rvv
 

Darth.Titan

macrumors 68030
Oct 31, 2007
2,905
753
Austin, TX
So you basically want to run a javascript outside of the browser? I don't believe you're going to be able to make that work. The OS doesn't know what to do with the javascript in the .webloc file. A browser has to run that.

At best the computer is going to have to launch your browser, open a new browser window, and then run your bookmarklet.

However, I suppose it might be possible to use the javascript in your bookmarklet in a dashboard widget. From what I understand dashboard widgets are primarily javascript. Maybe find a site or two on creating dashboard widgets and see if your code can be used that way?
 

tsolignani

macrumors newbie
Original poster
Jan 21, 2011
12
0
Vignola, Modena, Italy
But aren't .webloc files supposed to be open with a browser?

As a matter of fact, if I open a .webloc with a regular URL it opens with a new browser tab.

Anyway, what about creating an alias or shortcut to open the browser and then immediately that bookmarklet?

Maybe a shell script?

Or any other way to embed that code somewhere in the dock or in the menu bar (the dashboard would be not confortable for that).

Maybe a folder action? With Automator?

Please forgive me, I am not a developer.
 

tsolignani

macrumors newbie
Original poster
Jan 21, 2011
12
0
Vignola, Modena, Italy
I sort of found a way, this applescript works.

Now I have to see if I can pass a file to attach to it

Code:
tell application "Google Chrome"
	tell window 1
		tell active tab
			
			execute javascript "javascript:popw='';Q='';x=document;y=window;if(x.selection) {Q=x.selection.createRange().text;} else if (y.getSelection) {Q=y.getSelection();} else if (x.getSelection) {Q=x.getSelection();}popw = y.open (' https://mail.google.com/mail?view=cm&tf=0&to=&su=' ,'gmailForm','scrollbars=yes,width=680,height=510,top=175,left=75,status=no,resizable=yes');if (!document.all) T = setTimeout(' popw.focus()',50);void(0);"
			
		end tell
	end tell
	
	
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.