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

RA23

macrumors newbie
Original poster
Dec 13, 2012
8
0
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 SomeScript.app/Contents/MacOS/ 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?
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,484
16,201
California
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.
 

rhoydotp

macrumors 6502
Sep 28, 2006
467
75
i saw this link via google that might help.

http://jitsik.com/wordpress/?p=275

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.
 

RA23

macrumors newbie
Original poster
Dec 13, 2012
8
0
@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 script.app folder in the Applications folder. Isn' t that strange?
 

rhoydotp

macrumors 6502
Sep 28, 2006
467
75
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)

Code:
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";
160|Skype|com.skype.skype||7|376286430.0|book?
sqlite> select * from apps where title == "Terminal";
134|Terminal|com.apple.Terminal||3|361922519.0|book?
sqlite>
 

RA23

macrumors newbie
Original poster
Dec 13, 2012
8
0
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.
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
34,484
16,201
California
@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?

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.

Code:
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.

RcJgc.png
 

RA23

macrumors newbie
Original poster
Dec 13, 2012
8
0
Thanks Weaselboy, that worked flawlessly.
I am starting to like the Mac more and more :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.