spit out on change

Alex Tweedly alex at tweedly.net
Mon Mar 6 06:54:25 EST 2006


Christian Langers wrote:

> Hello all,
>
> But I want to change this procedure : the app should only spit out  
> components if there had been changes in the component folders...
>
> What methods should I use : checking timestamp of the folders on  disk 
> ?(how does one do that ?) Checking the number of files in  folders ? ...
>
> If anyone had an idea about this, I would be thankful to read about  
> it ;-)

I've tested out this little script - but not used it in a real case. 
Seems to do what we want, but I can't be sure there isn't some way 
around it ... adjust the folder path (and the list of files) to suit 
your needs.

<code>
--> all handlers

on mouseUp
    put "D:/Our Documents/trythis" into tFolder
    put false into tOK
    put empty into tPrevious
    put empty into tCurrent
    if there is not a folder tFolder then
        create folder tFolder -- NB assuming the path to it must already 
exist !!
    end if
    put the defaultFolder into tSaveFolder
    set the defaultFolder to tFolder
    if there is a file (tFolder & "/filelist.txt") then
        put URL ("file:" & tFolder &  "/filelist.txt") into tPrevious
        filter tPrevious without ".*" -- eliminate special files !?
        sort tPrevious
        put the detailed files into tCurrent
        filter tCurrent without ".*" -- eliminate special files !?
        filter tCurrent without "filelist.txt*" -- eliminate special 
files !?
        sort tCurrent
        if tCurrent = tPrevious then
            put true into tOK
        end if
    end if
    put tOK & CR & tPrevious & CR&CR & tCurrent & CR into field "Field"
    if not tOK then
        put "this is a" into URL ("file:" & tFolder & "/a.txt")
        put "this is file c" into URL ("file:" & tFolder & "/c.txt")
        put "this is b" into URL ("file:" & tFolder & "/b.txt")
        put the detailed files into URL ("file:" & tFolder & 
"/filelist.txt")
    end if  
    set the defaultFolder to tSaveFolder
end mouseUp
</code>

-- 
Alex Tweedly       http://www.tweedly.net




-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03/03/2006




More information about the Use-livecode mailing list