Mac Help Forums


Reply
Thread Tools Display Modes

Applescripting the disk browser of BBEdit

 
pierre lemercier
Guest
Posts: n/a
 
      3rd August 2011
Hello,

I would like to extract certain parts (info.plist) of .ipa files (iPhone
apps); these files include various interesting parameters.

This can be manually done by:

Opening xxx.ipa file with BBEdit
In the disk browser
Opening payload
Opening xxx folder
Selecting Info.plist
The content of Info.plist appears in the right part of the window

I would like to automatise the above actions by using applescript but I
have not found the way to script the disk browser

Any ideas?

best regards
 
Reply With Quote
 
 
 
 
pierre lemercier
Guest
Posts: n/a
 
      3rd August 2011
Jolly Roger <(E-Mail Removed)> wrote:

> In article <1k5fj40.1rot4iyefbydcN%(E-Mail Removed) >,
> (E-Mail Removed) (pierre lemercier) wrote:
>
> > Hello,
> >
> > I would like to extract certain parts (info.plist) of .ipa files (iPhone
> > apps); these files include various interesting parameters.
> >
> > This can be manually done by:
> >
> > Opening xxx.ipa file with BBEdit
> > In the disk browser
> > Opening payload
> > Opening xxx folder
> > Selecting Info.plist
> > The content of Info.plist appears in the right part of the window
> >
> > I would like to automatise the above actions by using applescript but I
> > have not found the way to script the disk browser
> >
> > Any ideas?
> >
> > best regards

>
> I'm confused as to why you would try to script BBEdit when it seems all
> BBEdit is actually doing is accessing text files in the file system.
> Rather than trying to script a text editor, I would simply tell
> Applescript to open the text file using the the path to the property
> list file in question, and do with it as you please. Something like this:
>
> set foo to (open for access (POSIX file unixPath))
> set txt to (read foo for (get eof foo))
> close access foo
>
> Then "txt" will contain the text of the property list file.


Ok thanks,

But my file (let me called it xxx.ipa) is not a text file; it's a rather
complex structure;
- it's a zip archive
- when dezipped it gives you a folder named xxx
- Included in this folder is another unique folder names Payload
- inside is an unique file called xxx; this file is an application whose
content (lot of folders and files including the one I am interested
in)can be accessed by right clicking it.

All this has to be manually done and seems difficult to automatise.


Another possibility is to use BBEdit
xxx.ipa, when opened with BBEdit, appears in the left part of the "disk
window" as
- a file (xxx.ipa)
- derivating from the above file is a folder (Payload)
- derivating from the above folder is another folder (xxx)
- when opening that last folder you can find folders and files including
the one I am interested in

My problem is to automatically access that file. I was expecting that
this part of BBEdit was scriptable. It seems not the case but I am not
sure?

Is there another possible solution?



 
Reply With Quote
 
 
 
 
Patrick Stadelmann
Guest
Posts: n/a
 
      3rd August 2011
In article <1k5fl11.147or4a1cxaikgN%(E-Mail Removed) r>,
(E-Mail Removed) (pierre lemercier) wrote:

> But my file (let me called it xxx.ipa) is not a text file; it's a rather
> complex structure;
> - it's a zip archive
> - when dezipped it gives you a folder named xxx
> - Included in this folder is another unique folder names Payload
> - inside is an unique file called xxx; this file is an application whose
> content (lot of folders and files including the one I am interested
> in)can be accessed by right clicking it.
>
> All this has to be manually done and seems difficult to automatise.


Not so much. You can use the "unzip" command to extract just the file
you want :

unzip -j xxx.ipa Payload/xxx/Info.plist

in the current directory (add -d <path> at the end to extract at <path>
instead).

You can call the "unzip" command from AppleScript with "do shell script".

Patrick
--
Patrick Stadelmann <(E-Mail Removed)>
 
Reply With Quote
 
Dave Balderstone
Guest
Posts: n/a
 
      3rd August 2011
In article <1k5fj40.1rot4iyefbydcN%(E-Mail Removed) >, pierre
lemercier <(E-Mail Removed)> wrote:

> Hello,
>
> I would like to extract certain parts (info.plist) of .ipa files (iPhone
> apps); these files include various interesting parameters.
>
> This can be manually done by:
>
> Opening xxx.ipa file with BBEdit
> In the disk browser
> Opening payload
> Opening xxx folder
> Selecting Info.plist
> The content of Info.plist appears in the right part of the window
>
> I would like to automatise the above actions by using applescript but I
> have not found the way to script the disk browser
>
> Any ideas?
>
> best regards


You do know that BBEdit is recordable, yes?
 
Reply With Quote
 
pierre lemercier
Guest
Posts: n/a
 
      4th August 2011
Dave Balderstone <dave@N_O_T_T_H_I_Sbalderstone.ca> wrote:

> In article <1k5fj40.1rot4iyefbydcN%(E-Mail Removed) >, pierre
> lemercier <(E-Mail Removed)> wrote:
>
> > Hello,
> >
> > I would like to extract certain parts (info.plist) of .ipa files (iPhone
> > apps); these files include various interesting parameters.
> >
> > This can be manually done by:
> >
> > Opening xxx.ipa file with BBEdit
> > In the disk browser
> > Opening payload
> > Opening xxx folder
> > Selecting Info.plist
> > The content of Info.plist appears in the right part of the window
> >
> > I would like to automatise the above actions by using applescript but I
> > have not found the way to script the disk browser
> >
> > Any ideas?
> >
> > best regards

>
> You do know that BBEdit is recordable, yes?


That is the first action I have tried, but unfortunately all the actions
affecting the left part of the browser is not recorded

The result:

tell application "BBEdit"
activate
select text 1 of disk browser window 1
end tell
 
Reply With Quote
 
pierre lemercier
Guest
Posts: n/a
 
      4th August 2011
Jolly Roger <(E-Mail Removed)> wrote:

> In article
> <Patrick.Stadelmann-(E-Mail Removed)>,
> Patrick Stadelmann <(E-Mail Removed)> wrote:
>
> > In article <1k5fl11.147or4a1cxaikgN%(E-Mail Removed) r>,
> > (E-Mail Removed) (pierre lemercier) wrote:
> >
> > > But my file (let me called it xxx.ipa) is not a text file; it's a rather
> > > complex structure;
> > > - it's a zip archive
> > > - when dezipped it gives you a folder named xxx
> > > - Included in this folder is another unique folder names Payload
> > > - inside is an unique file called xxx; this file is an application whose
> > > content (lot of folders and files including the one I am interested
> > > in)can be accessed by right clicking it.
> > >
> > > All this has to be manually done and seems difficult to automatise.

> >
> > Not so much. You can use the "unzip" command to extract just the file
> > you want :
> >
> > unzip -j xxx.ipa Payload/xxx/Info.plist
> >
> > in the current directory (add -d <path> at the end to extract at <path>
> > instead).
> >
> > You can call the "unzip" command from AppleScript with "do shell script".

>
> It is precisely as Patrick says. You simply use the "do shell script"
> command to "unzip" the archive. From there, you can determine the full
> path to the expanded files, and pass that path to the AppleScript "open
> for access" and "read" commands as I outlined. It's actually much
> simpler than GUI scripting BBEdit, which adds another layer of
> complexity to the job.


Thanks for your answer that can give me a possible solution

my test file is oMaps 1.3.4.ipa
it is located in a folder named Essaizip on the desktop


Firstly I have tried to use various commands in terminal to see what
appends:

cd ~/Desktop/Essaizip to access the right dir >ok

unzip -j "oMaps 1.3.4.ipa" to try to unzip that file
>it ask me "replace CodeResources? [y]es, [n]o, [A]ll, [N]one,

[r]ename: my answer n
>it gives me a lot of files including Info.plist


unzip -j "oMaps 1.3.4.ipa" Payload/omaps/Info.plist
> give that answer
>Archive: oMaps 1.3.4.ipa
>caution: filename not matched: Payload/omaps/Info.plist



Secondly I have tried with "do shell script" but I am not sure of the
syntax

set p to POSIX path of "MBP-Sys:Usersierrelemercieresktop:Essaizip:"
set res to (do shell script "ls " & p)
display dialog res > files wich are in that directoty:
oMaps 1.3.4.ipa >original
oMaps 1.3.4.zip >.zip instead of .ipa
oMaps1.3.4.zip >without space
oMaps

Tried with do shell script "unzip oMaps 1.3.4.ipa
Payload/omaps/Info.plist"
> Error 9 >unzip: cannot find or open oMaps, oMaps.zip or oMaps.ZIP


Tried with do shell script "unzip " & "oMaps 1.3.4.ipa" & "
Payload/omaps/Info.plist"
> Error 9 >unzip: cannot find or open oMaps, oMaps.zip or oMaps.ZIP


Tried with do shell script "unzip oMaps Payload/omaps/Info.plist"
> Error 9 >unzip: cannot find or open oMaps, oMaps.zip or oMaps.ZIP


> may be a problem with space and dot inside the name?


Any advice?

PS: Sorry for my broken english and for not being used to manipulate
Terminal
 
Reply With Quote
 
Patrick Stadelmann
Guest
Posts: n/a
 
      4th August 2011
In article <1k5hj2g.1ulllrrdir6bkN%(E-Mail Removed) >,
(E-Mail Removed) (pierre lemercier) wrote:

> unzip -j "oMaps 1.3.4.ipa" to try to unzip that file
> >it ask me "replace CodeResources? [y]es, [n]o, [A]ll, [N]one,

> [r]ename: my answer n
> >it gives me a lot of files including Info.plist


Don't use "-j" if you extract the all file, it instructs unzip to forget
about the hierarchy.

> unzip -j "oMaps 1.3.4.ipa" Payload/omaps/Info.plist
> > give that answer
> >Archive: oMaps 1.3.4.ipa
> >caution: filename not matched: Payload/omaps/Info.plist


The path inside the .ipa is probably incorrect, it's not always the name
of the .ipa file. For instance, for "Remote 1.3.ipa" the correct path is
"Payload/KeynoteRemote.app/Info.plist"

You can use "unzip -t xxx.ipa" to get the list of valid paths inside the
archive.

> Tried with do shell script "unzip oMaps 1.3.4.ipa
> Payload/omaps/Info.plist"
> > Error 9 >unzip: cannot find or open oMaps, oMaps.zip or oMaps.ZIP


That's because the "do shell script" sets the working directory to / so
you have to use full paths (or use ~ or $HOME) instead of just xxx.ipa
and provide a writable path to extract the file using the -d option.

This works for me :

set ipa to quoted form of "Remote 1.3.ipa"
set dir to "~/Desktop/Essaizip/"
set f to dir & ipa
set p to "Payload/KeynoteRemote.app/Info.plist"

set cmd to "unzip -j " & f & " " & p & " -d " & dir
do shell script cmd

> PS: Sorry for my broken english


Your English is OK, but if you prefer, you can ask questions in French
in news:fr.comp.sys.mac.programmation.

Patrick
--
Patrick Stadelmann <(E-Mail Removed)>
 
Reply With Quote
 
Dave Balderstone
Guest
Posts: n/a
 
      4th August 2011
In article <1k5gvit.b5nd47n3jjwuN%(E-Mail Removed)> , pierre
lemercier <(E-Mail Removed)> wrote:

> Dave Balderstone <dave@N_O_T_T_H_I_Sbalderstone.ca> wrote:


<snip>

> > You do know that BBEdit is recordable, yes?

>
> That is the first action I have tried, but unfortunately all the actions
> affecting the left part of the browser is not recorded
>
> The result:
>
> tell application "BBEdit"
> activate
> select text 1 of disk browser window 1
> end tell


Well, poop. Have you contacted the folks at BareBones? They are very
good at responding to customers.
 
Reply With Quote
 
 
 
Reply

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescripting Automator. aaabha AppleScript 0 19th August 2010 11:31 AM
applescripting internet Lawson English Programmer Help 3 8th September 2006 10:39 PM
Filemaker scripting/Applescripting/Automator zeyhra AppleScript 0 8th June 2006 02:16 AM
Applescripting for Entourage zeyhra AppleScript 3 29th March 2006 09:13 PM
Applescripting Automator jkevinwolfe AppleScript 6 5th October 2005 11:03 AM


All times are GMT +1. The time now is 08:06 AM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
How do I change pdf attachment to an icon?
Bunnyzilla (1 Hour Ago, 06:45 AM)

Flash software cant be viewed in new macs
vivhope (16 Hours Ago, 03:51 PM)

can't text certain contacts
hannahroseviolin (20 Hours Ago, 11:14 AM)

iMac user running Logic 9, slow and sluggish across the board...
EddieBanda (1 Day Ago, 02:08 AM)

Equals sign won't type
frisbeecat (1 Day Ago, 01:01 AM)