How to put a script in the Launchpad?

Discussion in 'OS X Mountain Lion (10.8)' started by RA23, Dec 13, 2012.

  1. RA23 macrumors newbie

    Dec 13, 2012
    I just got myself a MBPR yesterday after 15 years of only using Linux (so pls. be patient).

    I have some scripts that I use regularly and I would like to run them from the Launchpad. So in the Applications folder I created a folder and put my script SomeScript in that (like I found googling around)
    Then I assigned an icon to this folder.

    It appears to work: if I open the Applications folder in Finder, I see the icon and when I click on it, the script executes.

    But whatever I do, it does not appear on the Launchpad, also not on the 2nd page, dragging it to the Launchpad icon also does not work, neither does rm. ~/Library/Application\ Support/Dock/*.db; killall Dock

    Anyone know why it won't work? do I need more "magic" files in the Contents folder?
  2. Weaselboy Moderator


    Staff Member

    Jan 23, 2005
    Is this an Applescript? How about just save the script as an application then put it in the Applications folder. I believe that would make it appear in Launchpad.
  3. rhoydotp macrumors 6502


    Sep 28, 2006
    i saw this link via google that might help.

    it's not actually adding anything but seems like you can play around with the database if you're familiar with sql queries

    looks interesting, though. I might try when I get home tonight.
  4. RA23 thread starter macrumors newbie

    Dec 13, 2012
    @Weaselboy: No they are bash and python scripts. But how do I save a script as an application? Or is that only possible for Applescripts?

    @rhoydotp: thanks for that link, I hadn't come across that one yet. I checked the dbase and indeed, my script was not in it. I could try to manually enter it, but I am not sure if the other columns are critical, so I'll hold off on that for now.
    Incidentally, that link also spoke about spotlight. I did not know about that as an Apple newbie, so I tried entering the name of my script in the spotlight and it found the script itself (clicking on that opens it in an editor), but it did *not* find the folder in the Applications folder. Isn' t that strange?
  5. rhoydotp macrumors 6502


    Sep 28, 2006
    really interesting stuff, i must say :)

    well, i did some looking around and here's what I got regarding the table so you might be able to try to add your script via an "insert" operation (i didn't try it myself though)

    sqlite> .tables
    app_sources       dbinfo            image_cache       widgets         
    apps              downloading_apps  items           
    categories        groups            widget_sources  
    sqlite> .schema apps
    CREATE TABLE apps (item_id INTEGER PRIMARY KEY, title VARCHAR, bundleid VARCHAR, storeid VARCHAR,category_id INTEGER, moddate REAL, bookmark BLOB);
    sqlite> select * from apps where title == "Skype";
    sqlite> select * from apps where title == "Terminal";
  6. RA23 thread starter macrumors newbie

    Dec 13, 2012
    Yes, inserting manually in the db is what I was considering, but I don' t know how relevant the other fields are. If nobody else comes up with alternative ideas, that is what I will do.

    I still find it strange that nobody has apparently needed to do this before... seems a very common task to me.
  7. Weaselboy Moderator


    Staff Member

    Jan 23, 2005
    You can call both bash and python from within an Applescript by using the "do shell script" command.

    For example the below is part of an Applescript I use to launch some apps/files after my machine starts.

    do shell script "open ~/Documents/ibank_data.ibank"
    This has the same effect as typing "open ~/Documents/ibank_data.ibank" in Terminal (bash).

    Python will do the same thing. You can Google "python in Applescript" and find examples.

    So make your Applescript then and click the run button in Applescript Editor to make sure it is doing what you want. Once you are happy with it, do command-s to save the script. The window below will come up. Change File Format from script to Application and click save.

    You will now have a regular Mac application that runs your python or bash script and you can put it in Applications and it should then show in Launchpad.

  8. RA23 thread starter macrumors newbie

    Dec 13, 2012
    Thanks Weaselboy, that worked flawlessly.
    I am starting to like the Mac more and more :)

Share This Page