Editing Info.plist of Xcode project using AppleScript? - applescript

How can I edit info.plist file of xcode project? I have tried searching a lot but nothing specific.

An info.plist file can be considered 2 ways. One, it's just a specially formatted text file so thinking that way you can manipulate the text directly. Applescript can read text files, manipulate text, and write text files. Two, it's a basic xml file formatted with apple's tags to create a "plist" file. So you could use xml tools on the file as well. System Events has xml tools. There's also a unix command line program called "defaults" that can work on them as well.
So there's several tools. You need to think about what you want to do, how complicated the task is, and then decide which tool will best fit your requirements.
After you figure out those basics, try some things and come back and ask specific questions.

Related

How do I debug a kml file

I am editing kml files of maps of history and science of files that already appear on http://climateviewer.org/. I am editing them in Sublime text and/or Notepad since all I am doing is editing text, deleting extended data and switching links and references from my old web site MyReadingMapped to the new site which has far better technology. You can see images of the maps I made at http://climateviewer.org/myreadingmapped/
BTW, I am not a programmer or developer of software, but rather a retired marketing communications professional who understands just enough coding to make these changes and can do some html as well.
The problem I am having is that of the 30 or so files I have edited so far 4 have a parsing error that consistently involves closing a Placemark. Yet there appears to be nothing wrong with the code. I am testing the files by uploading them to Google Earth to get the error statements. And so far I have fixed many problems but I can't seem to solve this problem. Jim Lee, ClimateViewer's creator tells me to debug them.
How do I debug them and is it something I would be able to learn without formal training?
There are several tools available to debug a KML file, which is simply an XML file that must conform to rules of the KML specification. As an XML file, all start and end tags must match. In addition, the tags are case-sensitive.
The easiest trick is using a web browser to validate it. Simply rename the KML file to an XML file (rename .kml extension to .xml) then drag the .xml file onto the open web browser. Parsing errors will be identified with row and column number.
Next, you can upload the KML file to KML Validator to get a list of potential errors that need to be fixed or run the standalone command-line XmlValidator tool.
Additional tips to fix KML files are described here along with details about KML validation.

How to Hide the source code in xcode?

I am writing an app using applescriptobjc in xcode, and while making the archive I see the source code is still inside the package, is there a way to hide it or transform it completely to binary code?
Thanks
I may be a year late to the discussion but I asked the same question around the same time as you did last year and hope that the answer I got will satisfy your own question. Here is an extract answer from
my own question:
When you save the AppleScript file you have the option of checking "Run Only" - in that case the script is compiled into a new form that can be run exactly as the original script, but it is not meant for further editing/development.
It doesn't mean that the run-only file is complete protected or non-readable, but parts of your code, comments, etc. are not included or not easily readable.
If you want to do more you'll need a code obfuscator if you still want to use AppleScript - however I'm not sure if one exists on the market, or you need to develop your own.
As you can see, a simple way to do this is:
Open your final AppDelegate.applescript file in Script Editor on the mac.
Select: File > Export...
2.1. Don't change the file name but override the archive file
2.2. BEFORE SAVING: Choose Run-only checkbox from the save options but leave the File Format as Script
Now your file cannot be opened in plain text as it is set to Run-only. Please remember that it is not a 100% read-proof solution, but works great for small projects (provided you are not rushing the final export and don't forget to perform the above mentioned steps before handing it over to the customer).
I hope you can make the most of this answer and still deem it useful. Let me know how you get on or whether you have any more questions. Perhaps you have since found a far better solution (or just an alternative), if so, I am still looking for the next best thing in source code protection.
In Xcode 9.2. (and maybe earlier versions) you can find under Build Settings the item OSACompile and can choose to compile to an executable only directly from Xcode.

Sublime Text 2 config files on Windows

I found there are several config files for SL2 on Windows, one in:
%AppData%\Sublime Text 2
and another one in
%SublimeText2InstallPath%\Data
So, which config files is used on Windows? and what is the purpose of having multiple copies of them? I find starting SL2 from the right-click context menu, running the .exe directly, and starting it from command line results in different configuration file being used, not sure what caused it. how do I set it so that it only uses just a single set of configuration files?
Take a look at the Sublime Text Unofficial documentation page.
EDIT:
Since I see this is/was a link only answer, here's the relevant text from that webpage:
Sublime Text will look for resources inside the packages [emphasis mine] folder. We’ll
talk at length about packages later, but the short version is that, to
keep things tidy, Sublime Text has a notion of a package, that is, a
folder (or zip archive) that contains resources that belong together
(maybe they help compose emails faster, write HTML efficiently,
enhance the coding experience for C, Ruby, Go…).

Compiling applescript from a text-only source file

Is there a way to compile apple script code on the command line from a text source file, like you know, the way it is done in every real programming language? I have an applescript .app file and it seems the only way to edit it is using the native script editor app. However not having a source text file results in all kinds of problems when the binary is loaded into different environments. From what I can tell, it is not even possible to edit the source in the binary in many cases if the script editor is for whatever reason unable to load the binary file.
What I am trying to do is make it so that I can compile it in the environment it will run in. Any suggestions are appreciated...
Try the osacompile command.

How Can I Automate Tasks in Xcode?

I'm building an app in Obj-C / Xcode and I'm running into some repetitive tasks. For example if I want to add an image resource to my project I just go through the same identical steps... only difference is the path to the resource.
How can I automate these tasks?
Is there some sort of Xcode macro-recorder like in Photoshop and Excel?
There's definitely no macro recorder, but there are some tools you can use. First, there's Applescript, which is the most likely to be of use for this particular problem. I'm not promising it'll be easy, however. There isn't a rich collection of Applescripts for Xcode that I know of, so you'd need to dig through the Scripting Suite using Script Editor and see what's available.
For text things, there are User Scripts, which you can create from the script menu (it looks like a scroll). You can write perl, python, ruby, or whatever you like to process selected text and turn it into other text.
You can also create text macros (Edit>Insert Text Macro).
Another major repetitive task is setting up your initial project. For that you can create new project templates to be set up as you like them. I have most of a walkthrough of that written up, and should have something posted on Cocoaphony this week or early next as part of my Building the Build System series.

Resources