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.
--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.
JR
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?
> 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 <Patrick.S...@unine.ch>
You do know that BBEdit is recordable, yes?
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.
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
BBEdit is the wrong tool for the job anyway. Use pure AppleScript or
shell scripting instead.
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:Users:pierrelemercier:Desktop: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
> 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.
> 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.
> BBEdit is the wrong tool for the job anyway. Use pure AppleScript or
> shell scripting instead.
I don't disagree, but sometimes there is a specific reason for using a
particular tool.
> Well, poop. Have you contacted the folks at BareBones? They are very
> good at responding to customers.
Adding full scripting support to the disk browser would probably require
quite a bit of work, but having a command to open a specific file inside
an archive file shouldn't be too hard to implement.
I've sent a feature request for such a command from TextWrangler.
What would that reason be, in this case?
--
Posted from my iPhone.
I'm sure that would be a fine feature for BBEdit, but there is absolutely
nothing preventing you from opening a specific file in plain AppleScript
without BBEdit.
> Dave Balderstone <dave@N_O_T_T_H_I_Sbalderstone.ca> wrote:
> > In article <jollyroger-AFE64...@news.individual.net>,
> > Jolly Roger <jolly...@pobox.com> wrote:
> >
> >> BBEdit is the wrong tool for the job anyway. Use pure AppleScript or
> >> shell scripting instead.
> >
> > I don't disagree, but sometimes there is a specific reason for using a
> > particular tool.
>
> What would that reason be, in this case?
I have no idea, except that the OP requested the solution.
> Posted from my iPhone.
You know you can turn that off, yes?
> In article
> <739158173334246606.785...@news.individual.net>,
> Jolly Roger <jolly...@pobox.com> wrote:
>
> > Dave Balderstone <dave@N_O_T_T_H_I_Sbalderstone.ca> wrote:
> > > In article <jollyroger-AFE64...@news.individual.net>,
> > > Jolly Roger <jolly...@pobox.com> wrote:
> > >
> > >> BBEdit is the wrong tool for the job anyway. Use pure AppleScript or
> > >> shell scripting instead.
> > >
> > > I don't disagree, but sometimes there is a specific reason for using a
> > > particular tool.
> >
> > What would that reason be, in this case?
>
> I have no idea, except that the OP requested the solution.
I guess we'll never know.
> > Posted from my iPhone.
>
> You know you can turn that off, yes?
Of course.