Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.dialog.fileInfo
on fileInfo (path) {
if not file.exists (path) {
scripterror ("File " + file.filefrompath (path) + " doesn't exist.")};
<<bundle <<old dialog code
<<local
<<okitem = 13
<<nameitem = 7
<<folderitem = 8
<<createditem = 9
<<modifieditem = 10
<<sizeitem = 11
<<versionitem = 12
<<typeitem = 15
<<creatoritem = 17
<<on copytodialog () <<copy info about "path" into the dialog
<<dialog.setvalue (nameitem, file.filefrompath (path))
<<dialog.setvalue (folderitem, file.folderfrompath (path))
<<dialog.setvalue (createditem, file.created (path))
<<dialog.setvalue (modifieditem, file.modified (path))
<<dialog.setvalue (sizeitem, file.size (path) / 1024 + "K bytes")
<<dialog.setvalue (typeitem, file.type (path))
<<dialog.setvalue (creatoritem, file.creator (path))
<<bundle <<set the version number
<<local (s = "n/a")
<<if not file.isVolume (path)
<<if not file.isbusy (path)
<<if not file.isFolder (path)
<<s = file.getVersion (path)
<<dialog.setvalue (versionitem, s)
<<on itemhit (item)
<<case item
<<-1
<<copytodialog ()
<<return (true)
<<okitem
<<bundle <<rename file
<<local (newpath)
<<newpath = dialog.getvalue (nameitem)
<<if not file.exists (newpath)
<<speaker.beep ()
<<return (true) <<keep processing the dialog
<<path = newpath
<<copytodialog ()
<<return (false)
<<else
<<return (true) <<keep going if item isn't OK
<<dialog.run (270, okitem, @itemhit)
local (f = filespec (path));
card.run (@dialog.cards.fileInfo);
return (true)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.