Change version of file?

We are trying to manage distributing scripts out to a large art department. I would like to be able to assign a version number to each script so we can tell if someone has an old version (I am sure we will need to make updates as people use the scripts). Anyway, I can’t figure out if there is a way change the version number of a file (it will always be an applescript application or script) so that you can get info on the script icon and see the version the same way you can get info on say iTunes and see it’s version 5.0.1.

Any ideas if this is even possible??

Model: Mac G5
AppleScript: 1.9.3
Operating System: Mac OS X (10.3.9)

now might be the time to make the leap into Applescript studio/Xcode … it’s really simple to use, very powerful and it’s free… Plus, you can copy and paste your existing scripts. I used applescript for about six months before i realized i had Studio on my OSX install cd (in /developer). In the “simple view” of the “Targets” section you can change the version any time you want and rebuild it. It’s great. I’ll never go back to Script editor.

pilot:

Do you have any recommendations for learning Studio/Xcode? I also want to try it out, but fear the learning curve may be steep. I have very little time for hunt and peck.

We have been considering using Applescript Studio. I guess this gives us one more reason to check it out. Thanks for the suggestion.

well…
shameless plug coming :stuck_out_tongue:
this forum is an excellent place to start.

everything i have learned i have picked up from here, apple’s web site, and various places on the net. In the six months since i switched to studio my little 12-line script has mushroomed into a 285-line program that has pictures, sounds, buttons and menus. It was all very gradual for me. A line or two here, a paragraph there. Figure out how that worked and move on to the next. It really wasn’t that hard though.
What took the longest for me was figuring out the syntax of applescript itself. Compared to the applescript language complexities, the studio program and interface builder are a breeze.

I had the same original question. And I think I should try using Applescript Studio too. But for the quick and dirty solution, is there a way to assign a version number to an Applescript saved as an Application Bundle?

I did come up with a solution without switching to AppleScript Studio.

In all of my scripts, I add at the beginning:

property VersionNumber : “1.00”

Once all of your scripts have this property, save the below script as an application. You can then take any script you have and drop it onto this “Version Check” app and it will display the version. This was the best way I could come up with the manage version changes in my scripts. Whenever I make a change to a script, I change the VersionNumber property.

on run
	display dialog "This script works by dragging and dropping a single AppleScript file onto the script icon." buttons "OK" default button "OK" with icon 2
end run

on open these_items
	tell application "System Events"
		set NumberOfFiles to the count of these_items
		if NumberOfFiles is not 1 then
			display dialog "One file at a time please." buttons "Cancel"
		end if
		set this_item to item 1 of these_items
		set the item_info1 to info for this_item
		if (alias of the item_info1 is true) then
			tell me
				activate
				display dialog "No aliases, AppleScript files only." buttons "Cancel"
			end tell
		end if
		if ((kind of item_info1 is "script") or (kind of item_info1 starts with "Application")) then
		else
			tell me
				activate
				display dialog "This is not an AppleScript." buttons "Cancel"
			end tell
		end if
	end tell
	
	set VersionCheck to load script this_item
	try
		display dialog ("Version: " & (VersionNumber of VersionCheck)) buttons "OK" default button "OK"
	on error
		display dialog "Information not found????" buttons "Cancel" default button "Cancel"
	end try
end open

Browser: Safari 419.3
Operating System: Mac OS X (10.4)

I was just poking around and think I found the most direct approach.

I added “CFBundleShortVersionString” into the Info.plist file that is located in the Contents folder of the package. Bam it added the version number.

I found that if I added “CFBundleGetInfoString” it overrides the “CFBundleShortVersionString”.

“CFBundleShortVersionString” holds just the version number x.y.z.
“CFBundleGetInfoString” holds whatever you want displayed in the Get Info window. Without “CFBundleGetInfoString” existing, “CFBundleShortVersionString” is displayed.

NOTE: I had to make the modifications and then duplicate the file (then rename to replace the original) for the changes to take affect. It’s as though the Finder was using the stale data that was in the original file.