Alpha Video Training
Results 1 to 4 of 4

Thread: Back up script

  1. #1
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Back up script

    Hi everyone,

    I have followed on from Tom Cone's backup routine. My script creates a back up zip file and places it into a designated folder named username.zip
    The script runs fine if the user has two buttons, one to run the batch, then wait until the dos batch has finished, then button second button to continue.

    I want to place the whole script on one button but my poser is pausing the script while the dos batch is running . I could do this with a timer, but not really the answer.
    I could really use some help with WHILE .NOT. statement towards the end of the script that checks to see if the dummy file is present.

    'Create a dummy text file and the final line of the dos batch file will delete this.
    filename="C:Myfolderdummy.txt"
    file_pointer=file.create(filename,FILE_RW_SHARED)
    file_pointer.flush()
    file_pointer.close()

    If username="Your name here".OR.username="" then
    ui_msg_box("You must","enter your name before proceeding")
    END
    ELSE
    sys_shell("Zipper.pif",1) ' dos batch file deletes previous.zip files if any, creates a zipfile Roomlist.zip
    'and finally deletes dummy.txt file
    END IF
    'Check to see if dummy.txt exists, if false then I know batch has ended
    filename="c:myfolderdummy.txt"
    result = file.exists(filename)
    trace.writeln(filename)
    WHILE .NOT. Result=.f.
    'THIS WHERE I AM STUCK
    'I NEED XBASIC HERE TO NOT CONTINUE UNTIL RESULT IS FALSE
    END WHILE
    'this final part of the script must not continue until the batch has ended
    filename=chr(92)+rtrim(remspecial(username))+".zip"
    file_copy("c:myfolderroomlist.zip","c:myfolderchemdata"+filename)
    oldfile="c:myfolderroomlist.zip"
    file.remove(oldfile)

    If I can get this right it will be a very useful script to share

    Appreciate any help

    Michael

  2. #2
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default RE: Back up script

    I see that my backslashes are missing. They are present in my script.

    Michael

  3. #3
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default RE: Back up script

    Hi Michael,

    'Check to see if dummy.txt exists, if false then I know batch has ended
    filename="c:myfolderdummy.txt"
    result = file.exists(filename)
    trace.writeln(filename)
    WHILE .NOT. Result=.f.
    'THIS WHERE I AM STUCK
    'I NEED XBASIC HERE TO NOT CONTINUE UNTIL RESULT IS FALSE
    END WHILE

    The 3rd line above checks for the existence of the file, and then your code sits in a loop using that result (which never changes)! It should look more like this;

    'Check to see if dummy.txt exists, if false then I know batch has ended
    filename="c:myfolderdummy.txt"
    trace.writeln(filename)
    WHILE file.exists(filename)
    END WHILE

    To enhance the loop, you should place a timeout that also exits the loop if the timeout value is exceeded. This takes care of the case when the Zip file fails for some reason.

    Regards,

    Ira J. Perlow
    Computer Systems Design & Associates
    csda@mediaone.net

  4. #4
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default RE: Back up script

    Thanks again Ira,

    The scipt now runs sweetly and allows me to have a message form warning that the operation is running.

    I have posted the finished script on the Code Archive site should anyone be interested.

    Michael

Similar Threads

  1. Back up to CD
    By Michael Humby in forum Alpha Five Version 4
    Replies: 1
    Last Post: 06-15-2003, 08:10 PM
  2. Back ups
    By Mark Donnison in forum Alpha Five Version 4
    Replies: 10
    Last Post: 04-18-2002, 08:24 AM
  3. Back up script
    By Michael Humby in forum Code Archive
    Replies: 0
    Last Post: 01-23-2001, 10:14 AM
  4. A different way to back up.
    By Jamin Dunivan in forum Alpha Five Version 4
    Replies: 3
    Last Post: 08-16-2000, 07:26 AM
  5. back-up
    By Sharon Stewart in forum Alpha Five Version 4
    Replies: 5
    Last Post: 06-23-2000, 10:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •