It is currently Mon Dec 11, 2017 6:48 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: plistTool for OS X
PostPosted: Tue Mar 12, 2013 9:15 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3007
Location: Netherlands
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:
;@@ 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:
;@@ <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

_________________
MacOS 10.13.1 High Sierra, PB 5.60 x64


Last edited by wilbert on Fri Mar 22, 2013 7:32 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Sun Mar 17, 2013 11:59 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1100
Location: Seattle, USA
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

_________________
MacBook Pro-r, OSX 10.11.6, Command Line Tools 7.3 (10.11), PB-5.60x64


Last edited by WilliamL on Sat Mar 23, 2013 4:52 pm, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Mon Mar 18, 2013 7:10 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3007
Location: Netherlands
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.

_________________
MacOS 10.13.1 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Mon Mar 18, 2013 5:43 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1100
Location: Seattle, USA
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-r, OSX 10.11.6, Command Line Tools 7.3 (10.11), PB-5.60x64


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Fri Mar 22, 2013 7:37 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3007
Location: Netherlands
@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>

_________________
MacOS 10.13.1 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Fri Mar 22, 2013 5:17 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1100
Location: Seattle, USA
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-r, OSX 10.11.6, Command Line Tools 7.3 (10.11), PB-5.60x64


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Fri Mar 22, 2013 5:39 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3007
Location: Netherlands
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.

_________________
MacOS 10.13.1 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Tue May 14, 2013 5:38 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1100
Location: Seattle, USA
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-r, OSX 10.11.6, Command Line Tools 7.3 (10.11), PB-5.60x64


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Tue May 14, 2013 6:09 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1963
Location: USA
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.9.5 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: XP SP3 / AMD 64 4000+ / 1GB DDR / ATI 9250


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Sun Apr 06, 2014 1:49 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue May 20, 2008 2:12 am
Posts: 661
Location: Cologne, Germany
Hi all,

if you add the UPX-packing-thing from here: viewtopic.php?f=19&t=50521, this would be a great enhancement :-)

_________________
Regards,
JamiroKwai

---
5.10-x64/x86 - MacBook Pro, Mountain Lion
My Blog (German): http://www.quadworks.de


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Sun Apr 27, 2014 9:22 am 
Offline
User
User
User avatar

Joined: Mon Aug 13, 2012 6:12 pm
Posts: 89
Location: Berlin, Germany
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:
;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


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Mon Apr 28, 2014 4:22 am 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1963
Location: USA
Write it like this and notice the "NSHumanReadableCopyright". I use spaces as it's easier to read but it's not required.
Code:
;@@ 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.9.5 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: XP SP3 / AMD 64 4000+ / 1GB DDR / ATI 9250


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Sun May 04, 2014 5:04 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 350
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>


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Sun Aug 24, 2014 4:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 350
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:
IncludeFile("OSX_Info_plist.pbi")
and
Code:
XIncludeFile("OSX_Info_plist.pbi")


Both doesn't work


Top
 Profile  
Reply with quote  
 Post subject: Re: plistTool for OS X
PostPosted: Mon Aug 25, 2014 10:32 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3007
Location: Netherlands
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.

_________________
MacOS 10.13.1 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye