Page 1 of 1

Help Debug My Program Please

Posted: Tue May 19, 2015 10:16 pm
by 7Leven
Hello everybody, my name is Pat and I recently purchased the LiveCode indie license. In that comes LiveCode Academy where there are lessons on specific LiveCode skills. One of those skills or lessons covers how to tell when a directory has changed.

After completing that lesson I decided to take it a step further and make my own version of it but instead of monitoring one directory, I would monitor several.

As of now, the application finds these directories : (On Windows machines currently)
  • Desktop
    Documents
    Download
    Music
    Photos
    Videos
There are several errors (NOT SCRIPTING ERRORS) but logical errors that I can't figure out.

These are :
  • The application currently only detects the changes made on the files located in the Desktop directory. (It should detect all the changes made in the list above)
    When a change is made the pop up windows stays there for like 10 seconds as opposed to the 2.5 seconds it should pop up for.
I'll attach the stack on this post so you guys can get a more specific look. Feel free to ask any questions as well.
Also feel free to critique my coding as it is. I want to learn how to code better not just how to code correctly. So if there's anything you see I could improve on feel free to mention it. I love constructive criticism.

Re: Help Debug My Program Please

Posted: Sat Jun 20, 2015 7:25 pm
by zaxos
change this:

Code: Select all

on checkUpdate
   repeat with i = (the number of elements in locations) down to 1 
      set the directory to locations[i] 
      if the files is not filez[i] then 
         topLevel "alert" 
         wait 2.5 seconds
         close stack "alert"
      end if
   end repeat
   importFiles
   send "checkUpdate" to me in 1 second
end checkUpdate
to this:

Code: Select all

on checkUpdate
   repeat for each element theElement in locations
      add 1 to i
      set the folder to theElement
      if the files is not filez[i] then 
         topLevel "alert" 
         wait 2.5 seconds
         close stack "alert"
      end if
   end repeat
   importFiles
   send "checkUpdate" to me in 1 second
end checkUpdate
Not sure what the problem was but it worked with the new code