add a bookmarklet to the dock

Discussion in 'Mac Basics and Help' started by tsolignani, Jan 28, 2011.

  1. tsolignani macrumors newbie

    tsolignani

    Joined:
    Jan 21, 2011
    Location:
    Vignola, Modena, Italy
    #1
    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
     
  2. Darth.Titan macrumors 68030

    Darth.Titan

    Joined:
    Oct 31, 2007
    Location:
    Austin, TX
    #2
    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?
     
  3. tsolignani thread starter macrumors newbie

    tsolignani

    Joined:
    Jan 21, 2011
    Location:
    Vignola, Modena, Italy
    #3
    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.
     
  4. tsolignani thread starter macrumors newbie

    tsolignani

    Joined:
    Jan 21, 2011
    Location:
    Vignola, Modena, Italy
    #4
    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
     

Share This Page