cookiemonster Posted April 8, 2014 Share Posted April 8, 2014 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? Link to comment Share on other sites More sharing options...
Bert Posted April 8, 2014 Share Posted April 8, 2014 Wrong place. AutoIt is a Windows based app, not a Apple based app. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
cookiemonster Posted April 8, 2014 Author Share Posted April 8, 2014 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 8, 2014 Moderators Share Posted April 8, 2014 (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 April 8, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
cookiemonster Posted April 8, 2014 Author Share Posted April 8, 2014 Ah but i dont want to replace 'CFBundleDisplayName' I want to replace the value in the string answer below it in the document. Link to comment Share on other sites More sharing options...
iamtheky Posted April 8, 2014 Share Posted April 8, 2014 (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 April 8, 2014 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 8, 2014 Moderators Share Posted April 8, 2014 boththose is quite correct, you have been provided a great hint, now it is time to show some effort. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
cookiemonster Posted April 8, 2014 Author Share Posted April 8, 2014 (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 April 8, 2014 by cookiemonster Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 8, 2014 Moderators Share Posted April 8, 2014 Once again, information that would have been useful at the outset I was expecting to use XMLDomWrapper, not put it into an array "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
cookiemonster Posted April 8, 2014 Author Share Posted April 8, 2014 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? Link to comment Share on other sites More sharing options...
iamtheky Posted April 8, 2014 Share Posted April 8, 2014 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 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
cookiemonster Posted April 8, 2014 Author Share Posted April 8, 2014 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? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now