Login  •  Register


The time is now: Wed Nov 21, 2018 5:58 am

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 2 of 3 [ 54 posts ]    Go to page Previous  1, 2, 3  Next
Print view Previous topic  |  Next topic
Author Message
PostPosted: Sat Nov 22, 2014 9:18 pm 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
EDIT: Better error-handling

Code:
set myRes to (path to me as text) & "Contents:Resources:"

set posixRes to (POSIX path of myRes)

tell application "Finder"
   try
      set myAlias to (path to desktop folder as text) & "Pass-Through Drive" as alias
   on error
      make new alias to folder (myRes & "Pass-Through Drive") at desktop
   end try
end tell

do shell script "cd" & space & quoted form of posixRes & space & "&&" & space & "./BasiliskII" & space & "--config" & space & "basilisk_ii_prefs"


tell application "Finder"
   try
      delete file "Pass-Through Drive" of desktop
   end try
end tell


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Jul 06, 2018 1:28 pm 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
kanjitalk755's 64-bit SDL2 build of Basilisk works perfectly in this kind of self-contained VM (you need to add the Frameworks folder to the bundle). So here's one question:

Is there a way to make this bundle display a credits.rtf file when you click About BasiliskII? I'm going to put together a modern self-contained 68K-emulation package, and I would like to give credit where credit is due.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Aug 08, 2018 7:40 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
emendelson wrote:
Is there a way to make this bundle display a credits.rtf file when you click About BasiliskII? I'm going to put together a modern self-contained 68K-emulation package, and I would like to give credit where credit is due.

Yes, there is. Here's an example app where I have made the necessary changes.

http://www.mediafire.com/file/6dc9rnf5q ... p.zip/file

If you use macOS Script Editor to create a simple AppleScript and then save it as an Application, you'll see the structure you need to have extra information shown in the About this app dialog. I've gone one further and added more to enable a Credits scroll and custom icon.

Image


Last edited by gingerbeardman on Wed Aug 08, 2018 10:02 pm, edited 1 time in total.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Aug 08, 2018 7:57 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2275
Location: Emaculation.com
Let me know if you get stuck; My self-contained bundles use a mix of applescript and shell script. Using AppleScript to open /bin/sh with a parameter should do what you need.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Aug 08, 2018 8:37 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
Ah, the way to do it is already in the OP and in the "Self-contained Basilisk II VM"

So I'll leave it as it is so I don't confuse things :)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Aug 08, 2018 9:17 pm 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
gingerbeardman wrote:
Yes, there is. Here's an example app where I have made the necessary changes.


I admit I'm puzzled. How would this work with the BasiliskII setup described in this thread? You're using my System761 app. How would you add a credits box to the BasiliskII executable that it's in there? I'm genuinely puzzled...!


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Wed Aug 08, 2018 9:29 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
Are your files in source control anywhere? I'll happily do it for you.

But, short version, you don't add it to BasiliskII executable. The information to enable the About box is in the other files in the app package. You'd add them to /Applications/Parent.app/Contents/Resources/Child.app/... if you get what I mean?

Right click the app and Show Contents, there is the minimum contents in this demo App to show you how to do the thing you wanted.

Summary... (* denotes essential requirement for About box customisation)

Info.plist:
* NSHumanReadableCopyright (string) "Created by..."
* CFBundleShortVersionString (string) "1.0"
* CFBundleVersion (string) "1234a"
* CFBundleExecutable (string) "applet"
CFBundleName (string) "AppName" [app name of parent]

MacOS:
* applet (launches main.scpt)

Resources:
* applet.rsrc (contains information required by the applet binary, see here)
* Credits.rtf (rich text file containing credits text, can contain hyperlinks)
description.rtfd (leave this, no need to edit it)
Classic.icns (classic happy mac iconset)
Finder.icns (classic finder mac iconset)

Scripts:
* main.scpt (this should launch the shell script that in turn launches BasiliskII)


Last edited by gingerbeardman on Thu Aug 09, 2018 7:06 am, edited 2 times in total.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Aug 09, 2018 6:59 am 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
Thinking about your question a little bit more....

Basically the applet binary checks for the presence of various things in the app package and enables or disables features depending on the the result.

So, yes, it might seem puzzling or akin to magic.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Aug 09, 2018 9:03 am 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
gingerbeardman wrote:
But, short version, you don't add it to BasiliskII executable. The information to enable the About box is in the other files in the app package. You'd add them to /Applications/Parent.app/Contents/Resources/Child.app/... if you get what I mean?


That works! Thank you! It does seem like magic, as you say, but I'm delighted to know the magic spell.

EDIT: Actually, with a main script that launches a shell script, the contents of credits.rtf display in the About box, but I can't get the custom icon to appear in the About box, no matter what name I apply to the icon in the info.plist. Can you try your AppName applet with an executable that runs a shell script and let us know if it works? If it does, could you post that app? Thanks again.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Aug 09, 2018 9:41 am 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
I'm not sure what you're asking?

What isn't clear from my example?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Aug 09, 2018 10:48 am 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
Ignore my question - apologies. I wasn't able to get my app to display the correct icon in the about box when the script launched a shell script, but I tried rewriting your app to run a shell script, and the icon displayed correctly, so the method clearly works, and I'll have to figure out what I'm doing wrong here...


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Aug 09, 2018 2:21 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
You may be doing nothing wrong... macOS caches icons!

The best way I have found of refreshing them during this sort of back-and-forth is to, in Terminal:

Code:
touch Parent.app
touch Parent.app/Contents/Resources/Child.app


You might also need
Code:
touch Parent.app/Contents/Resources/Icon.icns
touch Parent.app/Contents/Resources/Child.app/Contents/Resources/Icon.icns


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Aug 09, 2018 7:35 pm 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
I think I may give up on this question for two reasons:

1. When I use an AppleScript script to launch a shell script that then launches BasiliskII, I end up with two icons in the dock: The custom icon of the AppleScript app and the generic icon of the BasiliskII executable. This doesn't happen when I use the method presented earlier in this script, where there's no AppleScript, just a shell script, that launches BasiliskII.

2. I still can't get the custom icon to appear in the About box when I launch the BII executable. I can get the credits.rtf to display but not the icon. The Touch command doesn't help; neither does rebuilding launch services. But the custom icon in the About box isn't important, as credits.rtf does display correctly.

I'm on a slow connection right now, but if you're still interested, I'll post an attempt to get this working when I'm able to upload large files


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Thu Aug 09, 2018 10:48 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
Don't give up!

1. I can fix this. I set the demo app to stay open after launch so you could click the about menu.

2. I'll do this one also.

I'd encourage you to put your package on GitHub. Then it's easier for people to contribute.

Why have the nested apps? Was it not possible to get it working well enough with one?


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Aug 10, 2018 6:12 am 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2275
Location: Emaculation.com
He's done nested apps because he wrote the Applescript wrapper around the existing build.

I went a different route and modified the BII build to point to the applescript instead of the main binary, and the applescript then eventually launches the original binary in the same package. Both methods have their benefits; I can add menus etc. with little difficulty, but emendelson's method means that you can drop-in a new BII build and everything still works; mine needs surgery with each new build.

Good point on Github; I'll get my frameworks up on my github repo sometime soon; bug me in a week if I haven't done it yet.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Aug 10, 2018 6:39 am 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
gingerbeardman wrote:
Don't give up!

1. I can fix this. I set the demo app to stay open after launch so you could click the about menu.

2. I'll do this one also.

I'd encourage you to put your package on GitHub. Then it's easier for people to contribute.

Why have the nested apps? Was it not possible to get it working well enough with one?


Excellent - but for the next few weeks I'm on a metered connection that someone else is paying for, so I won't be able to upload anything substantial.

I use the AppleScript wrapper to do many things - in the WPMac version, it parses a dropped file and sends it to a folder where a background script in Basilisk II is waiting to open it in WP. In both the WPMac and System761-only versions it builds and runs a launch daemon that watches for print files, etc., sent from Basilisk and processes them in macOS. That's how I can print/create PDFs in macOS from BasiliskII.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Aug 10, 2018 10:36 am 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
I'll take a look this weekend and get a new test app up.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Aug 10, 2018 10:03 pm 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
I realized that I could upload a small archive by leaving out the disk image file, so here it is:

https://github.com/emendelson/Basilisk-Icon-Test

If you can figure out how to get the custom icon to display in the About box and how to avoid two icons in the dock, I'll be very grateful!


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Aug 10, 2018 10:11 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2275
Location: Emaculation.com
https://github.com/adespoton/macosemushells


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Fri Aug 10, 2018 10:22 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
Thanks both


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sat Aug 11, 2018 3:39 am 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 2275
Location: Emaculation.com
Also, I stuck https://github.com/adespoton/sparserbundler on there for people who want sparser sparsebundles.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Aug 13, 2018 9:52 am 
Offline
Forum All-Star

Joined: Tue Oct 14, 2008 12:12 am
Posts: 926
adespoton wrote:
Also, I stuck https://github.com/adespoton/sparserbundler on there for people who want sparser sparsebundles.


Something seems wrong with the 7z file - it won't extract either in macOS (with BetterZip) or Windows (using the 7zip utility). Could you take a look? It may be my incompetence that's at fault here.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Aug 13, 2018 12:59 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
Just noticed this during testing:

Code:
# eval "echo \"keycodefile ${RES_PATH}/BasiliskII_keycodes\" >> ${RES}/biiprefs"


This prevents my keyboard (A1243; alu wired with numeric pad) cursor up and down from working. Therefore I can't do Cmd+Alt+Up/Down to traverse Finder keeping only one window open.

FYI


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Aug 13, 2018 1:33 pm 
Offline
Expert User
User avatar

Joined: Thu Feb 09, 2006 10:24 pm
Posts: 5188
Location: Amsterdam, Netherlands
gingerbeardman wrote:
Just noticed this during testing:
Code:
# eval "echo \"keycodefile ${RES_PATH}/BasiliskII_keycodes\" >> ${RES}/biiprefs"

This prevents my keyboard (A1243; alu wired with numeric pad) cursor up and down from working. Therefore I can't do Cmd+Alt+Up/Down to traverse Finder keeping only one window open.

I do not know what the difference could be with a regular BasiliskII setup, but this works fine here in a regular setup with the same keyboard and (I presume) the same BasiliskII keycodes file. (As far as I am aware, there is only one BasiliskII keycodes file, sometimes with a different file name, but always with the same content.)


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Mon Aug 13, 2018 5:34 pm 
Offline
Student Driver
User avatar

Joined: Mon Aug 06, 2018 2:58 pm
Posts: 14
Location: Cornwall, UK
My macOS input source (keylayout) is "British - PC" which is British with " and @ swapped (amongst others)


Top
 Profile  
Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 2 of 3 [ 54 posts ]    Go to page Previous  1, 2, 3  Next


Who is online

Users browsing this forum: Google [Bot] and 3 guests


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® Forum Software © phpBB Group