Help Debug My Program Please

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
7Leven
Posts: 18
Joined: Sat Oct 11, 2014 2:06 am

Help Debug My Program Please

Post by 7Leven » Tue May 19, 2015 10:16 pm

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.
Attachments
Download Monitor.zip
(2.03 KiB) Downloaded 96 times

zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm
Location: Greece

Re: Help Debug My Program Please

Post by zaxos » Sat Jun 20, 2015 7:25 pm

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
Knowledge is meant to be shared.

Post Reply

Return to “Windows”