Change Mac App Name in code

Can i set the “Build Settings” “macOS” “Mac App Name” in the App Event Open code?
Thanks
J

You cant alter the process name once its started

You need an IDE communicator script to change the name before building starts.

Thanks
was hoping for a one liner to change the app name
J

What is it youre trying to achieve ?

My program is for four family members.
In the app open event I link the app to the appropriate family member sql database.
I comment out the other three links and keep the required one.
I was hoping I could also name the “Built” app in the open event code as well.
Saving the time of doing it in the “Build Settings” “macOS” “Mac App Name”
Which I sometimes forget…

Check out IDE Communicator from the examples. I build 4 versions of my app:

if ConstantValue("App.kMaxVersion") = "0" then
	PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverx"
	PropertyValue("App.MacOSXAppName") = "Mail Archiver X"
elseif ConstantValue("App.kMaxVersion") = "1" then
	PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverxpro"
	PropertyValue("App.MacOSXAppName") = "Mail Archiver X Pro"
else
	print ConstantValue("App.kMaxVersion")
end if
makeVersion(MajorVersion, MinorVersion, BugVersion, BetaVersion)
if BuildApp(16) = "" then
	return
else
	DoCommand "SaveFile"
	DoCommand("CloseWindow")
end if
1 Like

You can. I have it for FileMaker here: App.SetProcessName.
If someone needs, I could implement this for Xojo plugin, too.

1 Like

Is that just altering the NSProcess name ?
https://developer.apple.com/documentation/foundation/nsprocessinfo/1416428-processname

It’s possible, we have done this on linux and macOs usefull if you want to see differnt version names or so.

Yes for macOs but you may not want to do this at any time, only at startup maybe before anything other would access the appname. Don’t recommend it…

Exactly why Apple has a big warning on that page about this :stuck_out_tongue:

:sweat_smile: yes

Here is some info about it:

Oh, that’s new. We had older code to do it.
But I may also add that to our NSProcessInfoMBS class.

Update: already there.

1 Like

You are making life more difficult than it needs to be! Simply store that SQLite file in a user specific specialfolder and the OS will do the rest. There is no need for a built per user.

https://docs.xojo.com/SpecialFolder

1 Like