![]() Then we call the write function mentioned above, passing ‘a’ (append) for the mode.įinally, we fire the UI alert on the condition that the string has got more than 2 characters in it (if it didn’t it was just the “\n\n” string from ignoring the DS.Store file).Īfter the function definition, the aWatcher variable sets up the watcher on the path we want to observe and tells the watcher to start monitoring. We just ignore adding anything to it all.Īt the end of the for loop we add another new line to the string just so our outputted text file looks nice and neat. If the count is more than 1 we don’t do anything to ‘str’. DS_Store) we discard the entire str var and replace it with new line character. If the count is ‘1’ (i.e., the only change was. If the ignore file is not found, we then append the filename to the str variable. The loop begins by incrementing the count, then checks for the ignore file (.DS_Store). The ‘files’ in parentheses are the list of file names (not file specifiers, you AppleScripters!) that were added, deleted, or modified in the watched folder. The '_' here is just a dummy variable for the first parameter. I won’t go into why, other than to say its a result of Lua’s table data structure. For loops in Lua are weird (at least for me), as you’ll see that they have this structure for a,b in pair (aPair). Lua doesn’t have an easy way to count entries in tables, so we bascially iterate a variable each time through the loop to achieve the same effect.Īfter that, we have the ‘for’ loop. DS_Store changes when it’s the only change. The ‘count’ variable is an internal var we need in order to eliminate. ![]() DS_Store files from triggering the alert or appearing in the list of file changes. ‘ignore’ is a string that will help us to exclude. ‘ in both these assignments is a string concatenator (i.e., like ‘
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |