Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 File apps
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Token




PostPosted: Tue Jun 21, 2005 2:01 pm   Post subject: File apps

I'm on yearbook at my school and the company that we use to publish our yearbook is a pain in the ass because they want it in a special format with the .tif file and the .jpg file all in the same folder as your Pagemaker file (for those of you that have any idea what i'm talking about the company is Friesen- http://www.friesens.com/Yearbook/ct/fladefault.aspx so anyways there end up being a lot of files that we dont use in this folder. but the ones that we dont use dont have matching .tif files so i made a program that deletes all files (accept for the Adobe Pagemaker file) that dont have .tif files with a matching name, i hope it can be of some use to you

just be sure to name it 'Folder Cleanup' when you save it or else it will delete itself.

code:

var filename, choice : string
var streamNumber, count : int := 0





streamNumber := Dir.Open (Dir.Current)
assert streamNumber > 1
loop
    filename := Dir.Get (streamNumber)
    exit when filename = ""
    if filename (1) not= "." then
        count += 1
    end if
end loop
Dir.Close (streamNumber)






setscreen ("text:max;max")

put "Delete any files that dont have matching .tif files? (discluding the Pagemaker file) \n\t(y/n)" ..
get choice

if choice = "y" or choice = "Y" then

end if


put "\n\tThe files were deleted: \n"

streamNumber := Dir.Open (Dir.Current)
assert streamNumber > 1
loop

    filename := Dir.Get (streamNumber)
    exit when filename = ""
    if filename not= "Folder Cleanup.t" and filename not= "Folder Cleanup.exe" then
        if filename (1) not= "." and filename (length (filename) - 4 .. length (filename)) not= ".tif" then
            if filename (length (filename) - 4) = "." and filename (length (filename) - 4 .. length (filename)) not= ".pmd" then
                if not File.Exists (filename (1 .. length (filename) - 4) + ".tif") then
                    File.Delete (filename)
                    put filename
                end if
            end if
        end if
    end if
end loop
Dir.Close (streamNumber)
Music.Sound (2000, 50)
Music.Sound (2500, 50)
Music.Sound (3000, 50)
Music.Sound (4200, 200)
put "\n\n\t*Disregard any folder names."


Another i made is to rename the contents of a folder. this is because when you use a camera that saves the filenames in series, every time you clear out the camera it starts over, so u end up with more than one file with the same name, if your pasting these into the same file they have to have a different name so i made this app to quikly rename all of the files in a folder with a keyword that you specify, try it by making a folder on the desktop and pasting a bunch of random pictures in it, it will rename them.

code:

var word, fileName, cont, ext : string
var streamNumber, filecount, line, totalfiles : int := 0

setscreen ("text:max;max")


put "\tCurrent Files in this folder: \n"

streamNumber := Dir.Open (Dir.Current)
assert streamNumber > 1
loop

    fileName := Dir.Get (streamNumber)
    exit when fileName = ""
    if fileName (1) not= "." then
        put fileName, "      " ..
        if line = 3 then
            put ""
            line := 0
        end if
        line += 1
        filecount += 1
    end if

end loop
Dir.Close (streamNumber)

loop

    put "\n\nNew File word: " ..
    get word : *

    Music.Sound (2000, 50)
    Music.Sound (2500, 50)
    Music.Sound (3000, 50)

    put "\nThe files will be named ", word, "1.jpg - ", word, "999.jpg"
    put "\nIs this okay? (y/n) " ..
    get cont

    if cont = "y" or cont = "Y" then
        exit

    end if
    Music.Sound (3000, 50)
    Music.Sound (2500, 50)
    Music.Sound (2000, 50)
end loop
Music.Sound (2000, 50)
Music.Sound (2500, 50)
Music.Sound (3000, 50)
totalfiles := filecount - 2
filecount := 0
streamNumber := Dir.Open (Dir.Current)
assert streamNumber > 1
loop

    fileName := Dir.Get (streamNumber)
    exit when filecount = totalfiles
    if fileName (1) not= "." and fileName not= "File Renamer.t" and fileName not= "File Renamer.exe" then
        filecount += 1
        ext := fileName (length (fileName) - 3 .. length (fileName))
        put fileName, " is now ", word + "0" + intstr (filecount) + ext
        File.Rename (fileName, word + "0" + intstr (filecount) + ext)
    end if
end loop
Dir.Close (streamNumber)
Music.Sound (2000, 50)
Music.Sound (2500, 50)
Music.Sound (3000, 50)
Music.Sound (4200, 200)


If you have any ideas or comments about these programs let me know, and if u actually by chance use this code let me know because that would be cool Laughing

-Enjoy
Sponsor
Sponsor
Sponsor
sponsor
pileggi




PostPosted: Wed Jul 06, 2005 10:42 pm   Post subject: hey man!

hey!
I was searching Compsci to find out how to rEname files using turing, but i found something better! your program!! did the job GREAT! thanks tons Very Happy. Very user friendly, and easy to execute. Congrats, you have my respect Very Happy
Token




PostPosted: Wed Jul 06, 2005 10:59 pm   Post subject: (No subject)

heh wow, thankyou.
you know, i think that is the first time anyone other than myself has used a program i've made for its acutlay purpose, not just to tinker with i mean Razz well good to see i could be of service. There's always room for improvement tho, to that poing, any sudgestions?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: