value list window size

I have a value list that is going to become very long and I require a user to make a selection from this list. Does anybody know if there’s away of making the value list window a certain size so that not all the items of the value list are displayed but can be selected using the side scroll bars.


Additional reading.

This seems to be exactly what I want but I’m not sure how to word the syntax in my script, can yo help?

set magtitles to {"ABUS", "CAUP", "CHOT", "CJOU", "CLDR", "CMRP", "EWEE", "ICIS", "MICR", "OPTI", "TWEK", "UWEE"}
	set mychoice to choose from list magtitles

This interface control is not accessible via vanilla AppleScript. You will need to use AppleScript Studio to utilize NSComboBox.

If you want to use a standard ‘choose from list’ box, blend3, but restrict its length for on-screen display purposes, perhaps this will help. It breaks up the list and displays the pieces one after the other. If you keep continuing, it cycles through the list again.

set magtitles to {"A", "B", "C", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "y", "Z"}
set choices to breakList(magtitles, 10)
set theChoice to offerChoices(choices)

to breakList(aList, howMany)
	set newList to {}
	set c to count aList
	set e to c mod howMany
	repeat with k from 1 to c - e by howMany
		set end of newList to items k thru (k + howMany - 1) of aList
	end repeat
	if e = 0 then
		set end of newList to "Exit Now"
		set end of newList to items (c - e + 1) thru c of aList & "Exit Now"
	end if
	return newList
end breakList

to offerChoices(cList)
	set c to count cList
	set k to 1
		set p to (choose from list (item k of cList) OK button name "Choose This" cancel button name "Continue Choices" with prompt "Is what you want in this list?" & return & "Quit with an Empty Choice" & return & "Or Pick 'Exit Now' at End of List" with title "Choices" with empty selection allowed)
		if p is false then
			set k to k + 1
			if k = c + 1 then set k to 1
		else if p is {"Exit Now"} or p is {} then
			set p to "No Choice" as text
			exit repeat
			exit repeat
		end if
	end repeat
	return p as text
end offerChoices

I’m downloading Studio now but I’ve never used it before. Is there no other way of placing scroll bars on a value list window using standard applescript code?

The script I’ve just posted breaks the list up using plain vanilla AppleScript, blend3

If you use a huge list, ‘choose list’ does use a scroll bar:

set magtitles to {"A", "B", "C", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "y", "Z"}

set nl to {}
repeat 4 times
	set magtitles to magtitles & magtitles
end repeat

choose from list magtitles

I can see that this works very well but it seems a really rediculous that you can’t specify scroll bars on a value list :o
Thanks for you help. :slight_smile: