hi
i am a new user of AS and is there any AS can automatic index my HD
i can find the command from the AS dictionary but don’t know the synatex of the command ?
would anyone can post the script ?
rgds
" i am a new user of AS and is there any AS can automatic index my HD "
“Index” is not a clear statement in this context. If you wish the contents of files indexed so that you may find a word or combination of words, Sherlock performs this adequately (& better is you create a label for folders for it to ignore or partition your hard drive and index only necessary files).
If you want a list of file names… excluding useless files is the first priority.
"i can find the command from the AS dictionary but don’t know the synatex of the command ? "
There is?! I haven’t seen one in the Finder or Scripting Additions. Which application dictionary are you examining?
: " i am a new user of AS and is there any AS can
: automatic index my HD "
By reading the following script you can understand the steps needed. Here indexing is understood to be the same as listing files as file paths.
You can tell Sherlock to do the real indexing with AppleScript? I suppose so.
–digFolder to the bottom by Tuomas Rosberg
global directoryList
on run
set directoryList to {}
set aFolder to choose folder with prompt "Choose a folder, please. "
my digFolder(aFolder)
end run
on digFolder(aFolder)
set folderList to {}
tell application "Finder"
set fileList to every file in aFolder
repeat with aFile in fileList
set aFile to aFile as string -- for a more readable result
set directoryList to directoryList & aFile
end repeat
set folderList to folderList & (every folder of aFolder)
if folderList is not {} then
repeat with aFolder in folderList
my digFolder(aFolder) -- the recursion
set folderList to rest of folderList
end repeat
end if
end tell
theResult(directoryList)
end digFolder
on theResult(directoryList)
set delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set printList to directoryList as text
set AppleScript's text item delimiters to delims
printList
end theResult