Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 17, 2012, 09:41 AM   #1
BlindSoul
macrumors 6502
 
Join Date: May 2010
Location: Israel
Send a message via MSN to BlindSoul
Running a bash file when opening an application

Hello,

How can I run a bash file when opening an application?
( When someone is opening the application the .bash file will run too ).

Also, I was wondering if this code is can be correct:
prism --app application.ini --override ../Resources/webapp/
override.ini --webapp ../Resources/webapp


Thank you very much.
BlindSoul is offline   0 Reply With Quote
Old Mar 17, 2012, 05:23 PM   #2
thundersteele
macrumors 68030
 
Join Date: Oct 2011
Right now I can think of two ways of doing it:

1) Call the script in the applicationDidFinishLaunching() method using NSTask

2) Use automator to bundle the execution of the shell script together with the application

I'm not sure if calling a bash script during program start is good programming style for OSX apps. It might be a security issue too.
thundersteele is offline   1 Reply With Quote
Old Mar 18, 2012, 12:12 PM   #3
BlindSoul
Thread Starter
macrumors 6502
 
Join Date: May 2010
Location: Israel
Send a message via MSN to BlindSoul
Well, I need it much simpler. It's a very simple application of mine.
What I need it to do exactly:
Is to make an app file, which when executed, runs another app located inside its directory with some additional arguments
I should achieve that using a bash file, but if you have a better solution...?

Last edited by BlindSoul; Mar 18, 2012 at 12:19 PM.
BlindSoul is offline   0 Reply With Quote
Old Mar 18, 2012, 05:36 PM   #4
chown33
macrumors 603
 
Join Date: Aug 2009
What language is your app written in?

This seems obvious to me, but have you tried making the executable referred to by Info.plist simply be a bash shell script? Then you can run whatever you want, because it's just a shell script.

If a direct shell script doesn't work, try Platypus. Also see a past post on Platypus.
chown33 is offline   1 Reply With Quote
Old Mar 18, 2012, 10:07 PM   #5
thundersteele
macrumors 68030
 
Join Date: Oct 2011
Quote:
Originally Posted by BlindSoul View Post
Well, I need it much simpler. It's a very simple application of mine.
What I need it to do exactly:
Is to make an app file, which when executed, runs another app located inside its directory with some additional arguments
I should achieve that using a bash file, but if you have a better solution...?
I still don't get it.

What is an app file? Do you want something that when you double click it executes a shell command?

Of course you can do whatever you want with a bash file, but you would still have to launch it using a terminal...
thundersteele is offline   1 Reply With Quote
Old Mar 19, 2012, 07:09 AM   #6
ibennetch
macrumors member
 
Join Date: Aug 2008
Quote:
Originally Posted by BlindSoul View Post
Hello,

How can I run a bash file when opening an application?
( When someone is opening the application the .bash file will run too ).
Quote:
Originally Posted by BlindSoul View Post
What I need it to do exactly:
Is to make an app file, which when executed, runs another app located inside its directory with some additional arguments
I should achieve that using a bash file, but if you have a better solution...?
These sound like two different requirements to me. Some of the other folks have asked good questions which might help clear this up, but do you have an application (say Pages) that exists and you need to run a bash script when a user opens that application, or do you want to make an application/script that in turn calls another program?

If it's the second -- which is what your latest post states, a few lines of bash should do just fine. Then you'd execute the script file instead of the application from the Finder. Either I misunderstood or my system differs from thundersteele's; I can just double-click a bash script to have it execute; I don't need to go to terminal (although it does open a new Terminal instance which can be unsightly).
ibennetch is offline   2 Reply With Quote
Old Mar 19, 2012, 01:27 PM   #7
thundersteele
macrumors 68030
 
Join Date: Oct 2011
Double clicking a shell script also works on my machine. I don't like the terminal popping up when I start an application - for me, it's either a shell script, then I launch it from a shell, or an application icon, then I don't want to see the shell
thundersteele is offline   0 Reply With Quote
Old Mar 21, 2012, 10:45 PM   #8
ibennetch
macrumors member
 
Join Date: Aug 2008
Quote:
Originally Posted by thundersteele View Post
Double clicking a shell script also works on my machine. I don't like the terminal popping up when I start an application - for me, it's either a shell script, then I launch it from a shell, or an application icon, then I don't want to see the shell
Ah, sorry I just misunderstood then. But yes, I completely agree about how unsightly it is to have another shell script window running underneath the application I want.
ibennetch is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
changed bash to tcsh in gui MAC OS 10.5.8 how to chage back to bash? Mac10.5.8USER OS X 0 Feb 3, 2014 04:45 PM
Application not opening expertu iPhone Tips, Help and Troubleshooting 0 Sep 21, 2013 05:50 AM
-Bash No such file or directory os ck Mac Basics and Help 0 Jan 14, 2013 09:21 AM
Opening Application In Multiple Instances ylagandre Mac Basics and Help 6 Dec 15, 2012 08:12 PM
Assistance with bash script, read from file djjasonsa Mac Programming 1 Jun 4, 2012 07:52 AM

Forum Jump

All times are GMT -5. The time now is 09:41 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC