Licensence code storage prog

I have a program to store all my license programs. But It refuses to work. I have two lists: prog and LicencesTemplate’s Progs. I know that the single item in list prog is in list LicencesTemplate’s Progs, but I need to get the item number. This dosen’t work:
set curnum to the item number of (item prog of list LicencesTemplate’s Progs)
What to do?
Here is the script. Feel free to muck it up.


repeat
	set choice to the button returned of (display dialog "Welcome to reg base. Please choose what you wish to do:" buttons {"New reg code", "View/Edit reg codes", "Quit"})
	if choice is "New reg code" then
		set prog to the text returned of (display dialog "Program:" default answer "" buttons {"OK"})
		set LicencesTemplate's Progs to LicencesTemplate's Progs & prog
		set LicencesTemplate's Names to LicencesTemplate's Names & {}
		set LicencesTemplate's Names2 to LicencesTemplate's Names2 & {}
		set LicencesTemplate's Codes to LicencesTemplate's Codes & {}
		set LicencesTemplate's Codes2 to LicencesTemplate's Codes2 & {}
		set LicencesTemplate's Extrainfo to LicencesTemplate's Extrainfo & {}
	else if choice is {"Quit"} then
		exit repeat
	else
		set prog to (choose from list LicencesTemplate's Progs)
		set curnum to the item number of (item prog of list LicencesTemplate's Progs)
		set curname to item curnum of list (LicencesTemplate's Names)
		set curname2 to item curnum of list (LicencesTemplate's Names2)
		set curcode to item curnum of list (LicencesTemplate's Codes)
		set curcode2 to item curnum of list (LicencesTemplate's Codes2)
		set curexinf to item curnum of list (LicencesTemplate's Extrainfo)
		set listinfo to {"program name: " & prog, "Licensee name: " & curname, "Licensee code: " & curcode, "2nd licensee name: " & curname2, "2nd licensee code: " & curcode2, "extra info: " & curexinf}
		set option to (choose from list listinfo)
		if option is item 1 of list listinfo then
			set newprog to the text returned of (display dialog "New Program name:" default answer prog buttons {"OK"} default button 1)
			set item curnum of list (LicencesTemplate's Progs) to newprog
		else if option is item 2 of list listinfo then
			set newname to the text returned of (display dialog "New Licensee name:" default answer curname buttons {"OK"} default button 1)
			set item curnum of list (LicencesTemplate's Names) to newname
		else if option is item 3 of list listinfo then
			set newcode to the text returned of (display dialog "New Licensee code:" default answer curcode buttons {"OK"} default button 1)
			set item curnum of list (LicencesTemplate's Codes) to newcode
		else if option is item 4 of list listinfo then
			set newnames2 to the text returned of (display dialog "New 2nd Licensee Name:" default answer curnames2 buttons {"OK"} default button 1)
			set item curnum of list (LicencesTemplate's Names2) to newnames2
		else if option is item 5 of list listinfo then
			set newcodes2 to the text returned of (display dialog "New 2nd Licensee Code:" default answer curcodes2 buttons {"OK"} default button 1)
			set item curnum of list (LicencesTemplate's Codes2) to newcodes2
		else if option is item 6 of list listinfo then
			set newinfo to the text returned of (display dialog "New additional information:" default answer curexinf2 buttons {"OK"} default button 1)
			set item curnum of list (LicencesTemplate's Extrainfo) to newinfo
		end if
	end if
end repeat

script LicencesTemplate
	property Progs : {"Progs:"}
	property Names : {"Names:"}
	property Names2 : {"2nd Names:"}
	property Codes : {"Codes:"}
	property Codes2 : {"2nd Codes:"}
	property Extrainfo : {"Ex Info:"}
end script

Thanks!!!

Hi,

item number of a list is no valid AppleScript expression.
You have to go thru the list like

repeat with curnum from 1 to (count LicencesTemplate's Progs)
	if prog is item curnum of LicencesTemplate's Progs then exit repeat
end repeat

PS: Why do you reinvent the wheel? :wink: There are very good tools like e.g. Pastor, which are protected with a master password

That seems to work. Thanks! I’d tried something along thoes lines, don’t know why one worked and the other didn’t, but still.