Trying to display the name of file moved out of a directory

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
steveuba
Posts: 14
Joined: Sat Mar 22, 2014 5:10 pm
Location: Alberta
Contact:

Trying to display the name of file moved out of a directory

Post by steveuba » Thu May 29, 2014 11:39 pm

I am new to LC and have been trying to complete a task of displaying the name of any files that gets moved out of a folder. The below is the code i have been struggling with, there are two parts to it;
can anyone help me out with this;

(1) button which triggers the load event and also calls a stack that has been skinned to display a notification message when a change occurs;

global lFilesList, theOutput

on mouseUp
answer folder "Select a directory:"
if it is empty then exit mouseUp
set the directory to it
put the files into lFilesList
put lFilesList into field "listBox"

put field "listBox" into field "outputBox"
put empty into field "lineList"
send "checkUpdate" to me in 2 seconds
end mouseUp

on checkUpdate
if the files is not lFilesList then
toplevel "alert"
put the files into lFilesList
put lFilesList into field "listBox"
put the number of lines of lFilesList into field "lineList"
movedItem
wait 2 seconds
close stack "alert"
end if
send "checkUpdate" to me in 2 seconds
end checkUpdate

on movedItem
put empty into field "outputBox"
repeat for each line theLine in field "listBox"
if theLine is not among the items of field "outputBox" then
put theLine into field "outputBox"
put theLine after theOutput
end if
end repeat

end movedItem

(2) stack with the skinned message
global theOutput
on preOpenStack
set the topRight of this stack to item 3 of the screenRect -50,item 1 of the screenRect + 50
set the blendLevel of this stack to 100

end preOpenStack

on openStack
put empty into field "movedFile"
repeat with i = 100 down to 1
set the blendLevel of this stack to i
put theOutput into field "movedFile"
wait 1 millisecond
end repeat
end openStack

on closeStack
repeat with i = 1 to 100
set the blendLevel of this stack to i
wait 1 millisecond
end repeat
end closeStack
Custom IT solutions that won't require you to break the bank.......
http://www.ezektec.com/

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Trying to display the name of file moved out of a direct

Post by Simon » Fri May 30, 2014 2:01 am

Hi steveuba,
Happy to help you here but you must reduce your code to where the error is.
Put breakpoints in and step through the code until you find the error.
Is "checkUpdate" working? "movedItem"?
Is the alert not showing up?

Otherwise this is a fun example but pretty much
Does field A = field B?
If not find the difference.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”