write text on menu bar

Mark, you can avoid a bit of that by using path to me to build the path to the image. Then it will work fine in both an editor and the applet.

Hello @Shane Stanley,

I am new to applescripts. Could you give the exact script for “path to me”?

I tried Mark script and it didn’t work without any error as I run it as app. I double check and it shouldn’t be file name problem. I installed Mojave on a VM so it shouldn’t OS difference.

Thanks

Using path to resource is even simpler:

set imageFilePath to POSIX path of (path to resource "imageFileName.png") -- Your file name
set my statusItemImage to current application's NSImage's alloc()'s initWithContentsOfFile:imageFilePath
set statusImageSize to (statusBar's thickness()) - 4
statusItemImage's setSize:{statusImageSize, statusImageSize}

Hello @Shane Stanley,

where do I put my image file if I use apple script editor? we only have Resources folder after I export the Script to applet. Is it easier to use SF Symbols (https://developer.apple.com/sf-symbols/)?

much appreciated

Thank you @Shane Stanley and @Mark FX. my script finally works.
I use code from Shane provided and manually put the image file to Resources folder of the exported applet.

Much appreciated

Shane Stanley Said:

@Shane that makes more sense from the testing point of view, I was getting stuck in ASObjc land for a moment there.

At least the OP has a working solution now, and that’s the main thing.

Regards Mark