plistTool for OS X

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

plistTool for OS X

Post by wilbert »

A little tool Joe and I made to set Info.plist information from within a PureBasic source.

Configure Tools in PureBasic
  • Open "Configure Tools..."
  • Select "New"
  • Commandline: open
  • Arguments: /Applications/plistTool.app --args "%COMPILEFILE" "%EXECUTABLE" "%PATH"
  • Name: plist Tool
  • Event to trigger the tool: After Compile/Run
  • Select - "Wait until tool quits"
  • Select - "Hide Tool from the Main menu"
  • Click "Ok"
If you wish, you can add the tool a second time with
Event to trigger the tool: After Create Executable

Download plistTool v1.1 (Developer signed for OS X 10.6+)

Image


Usage
Within the PureBasic source code, you can use ;@@ to set something in the Info.plist file and ;@R to embed a resource.
By default the tool shows a window with information. If you don't want to show this, you can use
;@@ DisableDebugWindow
This doesn't disable the PureBasic debug window, only the window of the tool.

Example

Code: Select all

;@@ LSMinimumSystemVersion = 10.6
;@R MyImage.png

MessageRequester("Test", "Test application")
To set something other than a string, you can use XML notation like this

Code: Select all

;@@ <key>CFBundleTypeExtensions</key> 
;@@ <array> 
;@@ <string>ext</string> 
;@@ </array>
The advantage of this tool is that you don't have to modify the Info.plist file manually after creation.
It allows you to use the debug feature of PureBasic with the Info.plist settings set as you wish and resources included.

ScreenShot
Image
Last edited by wilbert on Fri Mar 22, 2013 7:32 am, edited 1 time in total.
Windows (x64)
Raspberry Pi OS (Arm64)
WilliamL
Addict
Addict
Posts: 1214
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: plistTool for OS X

Post by WilliamL »

Interesting, could be useful for my needs.

It appears that you must make a second tool using the trigger After Create Executable for the new plist to be saved (Info.plist). (see below)

I have the example working and I'm trying to figure out how to put the info I use into your syntax. I will try these and correct them as needed.

For example: (I'm not sure what this is and if it is needed any more)
<key>CFBundleSignature</key>
<string>BOOK</string>

would be ;@@ CFBundleSignature = BOOK

sets the app icon
<key>CFBundleIconFile</key>
<string>BooksIcon.icns</string>

would be ;@@ CFBundleIconFile = BooksIcon.icns

sets file click to run by extension
<key>CFBundleTypeExtensions</key>
<array>
<string>BKS</string>
</array>
; see below for arrays
would be ;@@ CFBundleTypeExtensions = BKS

sets the extensions above to use this icon
<key>CFBundleTypeIconFile</key>
<string>BFileIcon.icns</string>

would be ;@@ CFBundleTypeIconFile = BFileIcon.icns
Last edited by WilliamL on Sat Mar 23, 2013 4:52 pm, edited 4 times in total.
MacBook Pro-M1 (2021), Sonoma 14.3.1 (CLT 15.3), PB 6.10b7 M1
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: plistTool for OS X

Post by wilbert »

A second tool is required if you want to create an executable (After Create Executable).
Otherwise it will only work if you use the Compile or Run commands.

<key>CFBundleSignature</key>
<string>BOOK</string>

would become
;@@ CFBundleSignature = BOOK

Setting an array is currently not supported.
It's not difficult to add, I just don't know what the best way would be to set it.
Windows (x64)
Raspberry Pi OS (Arm64)
WilliamL
Addict
Addict
Posts: 1214
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: plistTool for OS X

Post by WilliamL »

I looked at my old plist and I don't see any quotes there so I will take them out of my examples above. I suppose it will take a while for the system to see the changes for them to take effect.
MacBook Pro-M1 (2021), Sonoma 14.3.1 (CLT 15.3), PB 6.10b7 M1
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: plistTool for OS X

Post by wilbert »

@William, setting an array is supported now by plistTool 1.1
When you have to set something other than a string, you can use XML notation now.
So
<key>CFBundleTypeExtensions</key>
<array>
<string>BKS</string>
</array>

would become
;@@ <key>CFBundleTypeExtensions</key>
;@@ <array>
;@@ <string>BKS</string>
;@@ </array>
Windows (x64)
Raspberry Pi OS (Arm64)
WilliamL
Addict
Addict
Posts: 1214
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: plistTool for OS X

Post by WilliamL »

ok, like

;@@ <key>CFBundleTypeExtensions</key>
;@@ <array>
;@@ <string>BKS</string>
;@@ <string>INV</string>
;@@ <string>AUT</string>
;@@ </array>


I seems that type extensions can be any length. I tried a longer extension of .PChart and it worked fine.
MacBook Pro-M1 (2021), Sonoma 14.3.1 (CLT 15.3), PB 6.10b7 M1
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: plistTool for OS X

Post by wilbert »

WilliamL wrote:I seems that type extensions can be any length. I tried a longer extension of .PChart and it worked fine.
Yes, that's correct.
What it actually does is load the Info.plist file PureBasic generates, merge the information you set into this and write the result back.
Windows (x64)
Raspberry Pi OS (Arm64)
WilliamL
Addict
Addict
Posts: 1214
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: plistTool for OS X

Post by WilliamL »

Hi wilbert,

I wanted to have the Finder's to show the version number of my program and this seemed to work. I hope this is the correct place. Oh, it took a while for the Finder to show the data (moved app out of then back into it's folder to force the Finder to update).

;@@ CFBundleShortVersionString = 6.3

You need to put the link to this thread (plistTool for OS X) in the Mac forum!
MacBook Pro-M1 (2021), Sonoma 14.3.1 (CLT 15.3), PB 6.10b7 M1
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: plistTool for OS X

Post by J. Baker »

WilliamL wrote:Hi wilbert,

I wanted to have the Finder's to show the version number of my program and this seemed to work. I hope this is the correct place. Oh, it took a while for the Finder to show the data (moved app out of then back into it's folder to force the Finder to update).

;@@ CFBundleShortVersionString = 6.3

You need to put the link to this thread (plistTool for OS X) in the Mac forum!
Don't forget the copyright info. ;)
;@@ NSHumanReadableCopyright = Copyright © 2013 MyCompany. All rights reserved.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
jamirokwai
Enthusiast
Enthusiast
Posts: 771
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: plistTool for OS X

Post by jamirokwai »

Hi all,

if you add the UPX-packing-thing from here: http://www.purebasic.fr/english/viewtop ... 19&t=50521, this would be a great enhancement :-)
Regards,
JamiroKwai
User avatar
thinkitsimple
User
User
Posts: 89
Joined: Mon Aug 13, 2012 6:12 pm
Location: Berlin, Germany
Contact:

Re: plistTool for OS X

Post by thinkitsimple »

Tried this helpful tool, but can't get my info.plist for my compiled executable.

I installed the tool, added the 2 tool-entries within the ide and put some plist-code into my source:

Code: Select all

;plist Info
;@@ <key>LSApplicationCategoryType</key>
;@@ <string>public.app-category.adventure-game</string>
;@@ <key>CFBundleDevelopmentRegion</key>
;@@ <string>English</string>
;@@ <key>CFBundleExecutable</key>
;@@ <string>Dungeon!</string>
;@@ <key>CFBundleGetInfoString</key>
;@@ <string>Dungeon! 1.0, Copyright © 2014 Michael Bzdega. Alle Rechte vorbehalten.</string>
;@@ <key>CFBundleIdentifier</key>
;@@ <string>com.bzdega.dungeon</string>
;@@ <key>CFBundleName</key>
;@@ <string>Dungeon!</string>
;@@ <key>CFBundleShortVersionString</key>
;@@ <string>1.0.0</string>
After creating the executable, the plist tool debug window opens, but none of the information is in there.

Is this still working with OS X 10.9.2?
Michael

PureBasic 5.51, macOS 10.12.2 Sierra
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: plistTool for OS X

Post by J. Baker »

Write it like this and notice the "NSHumanReadableCopyright". I use spaces as it's easier to read but it's not required.

Code: Select all

;@@ LSApplicationCategoryType = public.app-category.adventure-game

;@@ CFBundleDevelopmentRegion = English

;@@ CFBundleExecutable = Dungeon!

;@@ NSHumanReadableCopyright = Dungeon! 1.0, Copyright © 2014 Michael Bzdega. Alle Rechte vorbehalten.

;@@ CFBundleIdentifier = com.bzdega.dungeon

;@@ CFBundleName = Dungeon!

;@@ CFBundleShortVersionString = 1.0.0
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: plistTool for OS X

Post by Wolfram »

How can I write this with the plistTool for OS X?
;@@ <dict> </dict> dose not work.
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pb</string>
<string>pbi</string>
<string>pbp</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>FileIcon.icns</string>
<key>CFBundleTypeName</key>
<string>PureBasic Sourcecode</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
macOS Catalina 10.15.7
Wolfram
Enthusiast
Enthusiast
Posts: 567
Joined: Thu May 30, 2013 4:39 pm

Re: plistTool for OS X

Post by Wolfram »

Is there a way to put the Code for the plistTool in a .pbi file and load this pbi in the main.pb ?

I tried

Code: Select all

IncludeFile("OSX_Info_plist.pbi")
and

Code: Select all

XIncludeFile("OSX_Info_plist.pbi")
Both doesn't work
macOS Catalina 10.15.7
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: plistTool for OS X

Post by wilbert »

plistTool makes use of the tool menu.
The code it parses is passed to it with %COMPILEFILE .
I don't know if PB has the ability to pass a file with all includes resolved.
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply