Sign in to follow this  
Followers 0
cookiemonster

Reading iphone app files

12 posts in this topic

Has anyone has any expierence in reading (opening) apple app files like .pch and .plist, updating various fields then returning these back to the document?

Share this post


Link to post
Share on other sites



Not wrong place, this script is running on windows, not a mac, maybe my question has been misunderstood...

Im trying to develop an autoit script to read certain lines out of a .plist file (example attached (just change .txt to ,plist, it wouldnt let me upload it as .plist)

so for example I want it to read the value in .plist for CFBundleDisplayName and put it into a variable for me to put into a label

example.txt

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If you have an application set up to open that file type, you should be able to just use a FileReadToArray on it, like so:

#include <Array.au3>

$sFile = @DesktopDir & "\example.plist"
$aArray = FileReadToArray($sFile)

    For $aLine In $aArray
        If StringInStr($aLine, "CFBundleDisplayName") Then
            ;Do Stuff here
        EndIf
    Next
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Ah but i dont want to replace 'CFBundleDisplayName' I want to replace the value in the string answer below it in the document.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

And all post #4 did was find it, moving to the next line and replacing the text you want goes in the "do stuff here" part.  This is the portion of the exercise where you get to try something for yourself, and post your result, as it has become a simple string operation.  Filereadtoarray puts you like 80% of the way of there.

And post #5 should have been the first question you asked as nothing else has been pertinent.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

boththose is quite correct, you have been provided a great hint, now it is time to show some effort.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I was expecting to use XMLDomWrapper, not put it into an array, which is why I questioned the answer from you guys

So far ive got the following but its giving me -1 return rather than the value of the first key

#include <_XMLDomWrapper.au3>

 

$sFile = @DesktopDir & "\example.txt"



    _XMLFileOpen($sFile)
    $aNodes = _XMLGetValue("/plist/dict/key[@key=CFBundleDisplayName]/string")

    
                MsgBox(0, $sFile, $aNodes)
Edited by cookiemonster

Share this post


Link to post
Share on other sites

Once again, information that would have been useful at the outset ;)

 

I was expecting to use XMLDomWrapper, not put it into an array


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

By outset I'm guessing you mean beginning. I hadn't written that at the beginning, I'm providing what I have as and when I have it. So any suggestions why that isn't working?

Share this post


Link to post
Share on other sites

A real quick way to get your problem ignored, is to ignore the solutions provided.   My suggestion would be to go to post #4, create a working model with filereadtoarray.

Then maybe go google about your new problem:  http://cakoose.com/wiki/plist_xml_is_pointless


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

I'm not ignoring post four. I'm trying to understand why xml was will not work... Do you know why it won't work?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0