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 Feb 25, 2012, 03:08 PM   #1
JesseW6889
macrumors 6502
 
Join Date: Dec 2010
Automator Help: Get item location

I've got some programming background but don't quite know my way around automator. I am a iOS application developer, and I test my apps on my jailbroken iPhone, but they need to be code signed first, which consists of running a command in terminal to the location of the .app file, which is kind of a pain in the butt, but this is my routine now...

1. Copy and paste this script into terminal:
Code:
codesign -fs "Cydia Developer" /path/appname.app/appname
2. Replace the '/path/appname.app/appname' with the path and name of app
Code:
codesign -fs "Cydia Developer" '/Users/jessew/Desktop/Switch Views.app/Switch Views'
3. Execute

How would I automate this, by say, dragging and dropping the file or (preferably) the folder and have automator copy the location and append that to the 'codesign -fs "Cydia Developer"' code. It seems like it should be pretty easy, but I don't know how to do it!

Any help would be MUCH appreciated, its a pain in the butt to do EVERY time I want to try an app on my phone... thanks!
JesseW6889 is offline   0 Reply With Quote
Old Feb 25, 2012, 04:27 PM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
Since you already know how to write shell scripts (or so it seems), you can simply wrap a shell script into a drag-n-drop wrapper, like Platypus. You have to put a little code at the head of the script, to accept the dropped items as normal command-line parameters, but after that it's just like a normal shell script.

Here's an example I use:
Code:
#!/bin/bash

#printenv | sort

## Under Platypus, $1 is path to app-bundle.
## MUST NOT process that.
## Relies on env-var APP_BUNDLER being set to "Platypus*"
APP_DIR="$PWD"

if [[ "${APP_BUNDLER:0:8}" = "Platypus" ]]
then
  APP_DIR="$1/.."
  shift
  echo ".. Platypus at: $APP_DIR"
fi



# This script strips all ".DS_Store" files from a subtree.
# This is most often useful on app-bundles.

# echo "$@"

for item in "$@"
do
  if [ -d "$item" ]
  then
    echo "Directory: " "$item"
    find "$item" -name ".DS_Store" -print -delete
  fi

done
The original script I developed starts at the "This script strips all ..." comment. The preface is boilerplate I use in several Platypusified scripts, for detecting that they're running under Platypus. If it's not obvious, I have the APP_BUNDLER env-var set under Platypus, but NOT set in my normal Terminal shell (unless I'm testing it in an environment like Platypus).

Last edited by chown33; Feb 25, 2012 at 04:33 PM.
chown33 is offline   0 Reply With Quote

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

Tags
app, automator, xcode

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Getting Current Location in City Name Wellington2k iPhone/iPad Programming 3 Jun 9, 2012 12:00 AM
Automator Help: RickCrules Mac Applications and Mac App Store 0 Mar 16, 2010 07:53 PM
SL Help: Menubar items have disappeared JTG123 OS X 1 Aug 28, 2009 09:46 PM
Automator Help: Finder plugin lost. RumMunkey Mac Programming 4 Aug 1, 2009 02:39 AM
Automator Help: set display settings hyroboarder Mac Applications and Mac App Store 0 Nov 7, 2007 05:00 PM


All times are GMT -5. The time now is 03:58 PM.

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

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