Hot Door CORE Forum
AppleScript for resource definitions - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: General discussion (http://hotdoorcore.com/forum/forumdisplay.php?fid=3)
+--- Thread: AppleScript for resource definitions (/showthread.php?tid=271)



AppleScript for resource definitions - Rick Johnson - 01-29-2021

I'll admit I probably just don't understand how to use it, but I find the scripted JSON system used in CORE 0.7.7 to be more complicated than just hand coding it. Maybe there's an automated way to generate the JSON file? Anyway, as an alternative, I’ll share this script I wrote to help in my work, available at my web site's script section, at the bottom of the page.

generate resource IDs

This AppleScript generates text for cross-platform Hot Door CORE resource definition files as used in the Tool sample of CORE 0.7.6 and earlier:

• ResourceIDs.rh
• Resources.r
• Resources.rc
• IDtoFile.txt

First, select one or more base image files in the Finder. By “base” I mean the 1x size, light UI, not rollover. Next, run the script and answer the dialogs. The script relies on your having followed the file naming conventions of the Hot Door CORE samples, which you can also see in the results for the IDToFile.txt file. Optionally, you can run it with nothing selected in the Finder and just provide a base image file name when prompted.

Either way, you’ll be prompted to specify which image sizes you’re using (1x, 1.5x, 2x, 3x, and/or 4x), and whether it should include rollover images. For resource names and numbers, you’ll be prompted for a prefix (e.g., “TS” in the CORE Tool sample) and starting resource number.

The script will generate the resource definitions and place the results in a TextEdit window, which you can cut and paste into your CORE project files.

No guarantees it’s 100% reliable, but it should save a ton of time compared to writing this all out by hand. If you find a problem, just let me know and I’ll do my best to update the script.

-- Rick