I’m making a program that checks a website every so often to see if it has changed. All is going well except I need a way to make a combo box that ‘rememebers’ the last few URLs that one has typed in. Help would be greatly appreciated.
Keep in a file a list of five URL’s. then update this file and use this file for your combo box. Here some script parts to know what i mean.
set fd to open for access file ((path to preferences) & "com.yourcompany.yourprogram.plist" as string)
set theList to read fd as list
close access fd
delete every combo box item of combo box "combo" of window "main"
repeat with x in theList
make new combo box item at end of combo box items of combo box "combo" of window "main" with data x
end repeat
when new url is opened delete last item and add new item and save it (made an handler for example)
on newURL(newURL, oldList)
if (count oldList) > 4 then
set numberOfItems to 4
else
set numberOfItems to count oldList
end if
set newList to {}
set end of newList to newURL
repeat with x from 1 to numberOfItems
set end of newList to item x of oldList
end repeat
return newList
end newURL
on saveURLList(theList)
set fd to open for access file ((path to preferences) & "com.yourcompany.yourprogram.plist" as string) with write permissions
set eof fd to 0
write theList to fd as list
close access fd
end saveURLList