Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

file copy difficulty

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    file copy difficulty

    the goal is to copy all the dbfs from one directory to another and in so doing overwrite the 2nd with the first so that they are "uptodate"
    following is a stadalone global script that doesn't work - any ideas


    ''XBasic
    dim filenames[250] as c
    olddirectory=dir_get()
    dir_put("E:new programeastdbfs")
    files=filefind.first("*.dbf")
    i=1
    while .not. files.eof()
    filenames(i)=files.name()
    files.next()
    i=i + 1
    end while
    sort_array("filenames")
    for n = 1 to i
    file_copy("e:new programeastdbfsfilenames(n)","e:new programeastfilenames(n)")
    next
    dir_put(olddirectory)
    end
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    [email protected]

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

    #2
    RE: file copy difficulty

    Martin, can you tell us what happens when the script tries to run?

    I see that the backslash characters are missing from your script, right? If I recall correctly, this is something the new message board is doing as it formats your message.

    Without knowing more about what you are experiencing I can only suggest two things which have been useful to me, here. First, verify that Drive E: is accessible... i.e. that you have read/write permission to it. Next, check the array of filenames to see how each is punctuated. (Check any that have blanks in the DOS filename carefully).

    Good luck.

    -- tom

    Comment


      #3
      RE: file copy difficulty

      Tom - good to hear from you - saw you were working on a big one a while back
      My hearing aid software is going well - I recently made another sale to a dealer with 3 locations - bought Unlimited Runtime for it.
      The goal here is this: The "Main Office", using PCAnywhere, downloads all DBF's and FPT's, from two satellite offices, to an auxillary directory containing only DBF's and FPT's, which are to be overwritten each time the main office runs the auto download operation.
      What I am trying to accomplish with this code is to copy the files to another directory.
      The following code produces the array correctly. I copied it from the manual. (I don't show here a ui_get_list..... that displays all the filenames correctly.
      Where it bombs is at the file_copy.... line - says it "...can't find the file specified. ...e:new programeastdbfsfilenames(n)"
      I presume that what i need to do is something like:
      "E:|New Program|east|dbfs|" + filenames(n) + " - but haven't been successful so far.

      I substituted a character for the slash

      ''XBasic
      dim filenames[250] as c
      olddirectory=dir_get()
      dir_put("E:|new program|east|dbfs")
      files=filefind.first("*.dbf")
      i=1
      while .not. files.eof()
      filenames(i)=files.name()
      files.next()
      i=i + 1
      end while
      sort_array("filenames")
      for n = 1 to i
      file_copy("E:|New Program|east|dbfs|filenames(n)","E:|New Program|east|filenames(n)")
      next
      dir_put(olddirectory)





      Cole Custom Programming - Terrell, Texas
      972 524 8714
      [email protected]

      ____________________
      "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

      Comment


        #4
        RE: file copy difficulty

        Martin, try stuffing the current array value (string) into a variable, and then using the variable in the file_copy() function. I think the string expressions in your file_copy() statement are being evaluated literally. The references to the array are probably not returning the actual array value... see what I mean?

        One approach I use is to store the target path in a variable, say "targetpath".

        Then I retrieve the current array value into another variable, say "targetfile".

        Then I concatenate them into a third variable, say "filecopysource", and use this in the file_copy() function.

        Of course, a similar concatenation is needed each time for the destination fpath and file.

        Good luck.

        -- tom

        Comment


          #5
          RE: file copy difficulty

          well, phooie - so far unsuccessful - but have isolated it to this:

          if i say
          dim path1 as c
          path1="E:new programeastdbfs" it likes it
          but
          path1="E:new programeastdbfs" it doesn't like the last back slash
          if i say
          path1a=filenames(i)
          path3=path1 + "" + path1a it still bombs
          Cole Custom Programming - Terrell, Texas
          972 524 8714
          [email protected]

          ____________________
          "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

          Comment


            #6
            RE: file copy difficulty

            I think you're on the right path, so to speak! Hang in there.

            Consider modifying the script so that it copies a known a file. Then store the path and filename in variables, and copy the known file again. Then go back and the logic to loop through all the names in the folder.

            -- tom

            Comment


              #7
              RE: file copy difficulty

              file_copy("E:|new program|east|bell customers.dbf", "E:|new program|east|dbfs|bell customers.dbf") - good

              path1="E:|new program|east|dbfs|bell customers.dbf"
              path2="E:|new program|east|bell customers.dbf"
              file_copy(path1, path2) - good

              path1="E:|new program|east|dbfs" + "|bell customers.dbf"
              path2="E:|new program|east" + "|bell customers.dbf"
              file_copy(path1, path2) - good

              but i can't get it to take a variable
              like
              temp="bell customers.dbf"
              path1="E:|new program|east|dbfs" + "|temp"
              interprets literally -no good

              tom - if i can't work this out, how would i call a dos batch file from within alpha
              Cole Custom Programming - Terrell, Texas
              972 524 8714
              [email protected]

              ____________________
              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

              Comment


                #8
                RE: file copy difficulty

                Martin,

                I suspect the quotation marks around the string "|temp" causes the values within the quotes to be interpreted literally. You can see this by using a ui_msg_box() to display the value of path1, immediately after you finish building (concatenating) the string.

                If you want the value of temp to be inserted in the string (instead of the letters t e m p), you cannot use quotes.

                Assuming temp is a variable which is declared in the script, you might try the following, substituting an actual backslash for |.

                temp="bell customers.dbf"
                path1="E:|new program|east|dbfs" + "|"+ temp
                ui_msg_box("Path1 is", path1)

                Alternatively, you could embed the backslash in the variable temp, and change the script to:

                temp = "|bell customers.dbf"
                path1="E:|new program|east|dbfs"+ temp
                ui_msg_box("Path1 is", path1)

                Martin, the backslash is Alpha five's line continuation character, so it's possible the suggestions I've made won't work until you convert the backslash mark to CHR(92) in your script. If you do this do not put quotes around CHR(92), or that will cause A5 to think you mean the letters, C H R ( 9 2 ). I can never remember the rules for when the backslash will be treated as a simple character, and when it will be treated as a line continuation, so I thought I'd mention it to you.

                Also, once you get it working you probably will want to remove the ui_msg_box() statements, but they're useful during development, don't you think?

                -- tom

                Comment


                  #9
                  RE: file copy difficulty

                  Martin:

                  Have you gone through your script with the debugger activated? You can see exactly what values are being parsed and reconstruct the variable accordingly.

                  To construct the long path variable you will have to use Chr(92) instead of the backslash character. e.g.

                  path3=path1 + Chr(92) + path1a



                  Finian
                  Finian

                  Comment


                    #10
                    RE: file copy difficulty

                    Tom and Finnian - thank's to you both
                    success at last
                    following are two pieces of code
                    first copies the files - second creates a file with today's date as name for making audit trail and also for daily reports
                    PS: I also successfully worked out getting PCAnywhere to automatically call another computer at a specified time and download specified files from specified places to specified places - if anyone needs the info - jes holler

                    again thank's ten thousand times

                    ''stand-a-lone-script:UPDATECOPY
                    original=dir_get()
                    dim names[250] as c
                    dir_put("E:|New Program|east|dbfs")
                    source="E:|New Program|east|dbfs"
                    destination="E:|New Program|east"
                    files = filefind.first("*.dbf")
                    I = 1
                    WHILE .not. files.eof()
                    names[I] = files.name()
                    files.next()
                    I = I + 1
                    END WHILE

                    for n=1 to (i - 1)
                    file_copy(source + chr(92) + names(n),destination + chr(92) + names(n))
                    next
                    dir_put(original)
                    end

                    ''********************************************************

                    stand-a-lone-script:DAILYENTRIESCREATE
                    ''generates "Daily04-04-2000.dbf"
                    t=dtoc(date())
                    filename=substr(t,1,2) + "-" + substr(t,4,2) + "-" + substr(t,7,4)
                    daily="daily" + alltrim(filename) + ".dbf"
                    rec=file.exists(daily)
                    if rec
                    ans=ui_get_radio("A File with today's date already exists - Overwrite ?",2,"Yes","No")
                    if ans "Yes"
                    end
                    end if
                    end if
                    tblsrc=table.open("dailyentries")
                    tblsrc.duplicate(daily,3)
                    file_add_to_db(daily)
                    end

                    Cole Custom Programming - Terrell, Texas
                    972 524 8714
                    [email protected]

                    ____________________
                    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                    Comment


                      #11
                      RE: file copy difficulty

                      Glad you got it working.

                      One comment ... your code will be easier and the mobility of your app somewhat greater if you make the various copy to/from folders as sub-folders of the main application folder. In that situation, you don't have to hard code a drive/path and your file paths are simply an addition to the application path derived via A5 methods.

                      I realize that it's not always possible to do this, but if it is, it will greatly simplify your life, especially if you need to move/install the app to/on another computer.

                      Finian
                      Finian

                      Comment


                        #12
                        RE: file copy difficulty

                        as soon as i posted my working solution the same thought crossed my mind - here's the amended version:

                        ''XBasic
                        original=dir_get()
                        dim names[250] as c
                        source=original + chr(92) + "dbfs"
                        dir_put(source)
                        destination=original
                        files = filefind.first("*.dbf")
                        I = 1
                        WHILE .not. files.eof()
                        names[I] = files.name()
                        files.next()
                        I = I + 1
                        END WHILE

                        for n=1 to (i - 1)
                        file_copy(source + chr(92) + names(n),destination + chr(92) + names(n))
                        next
                        dir_put(original)
                        end


                        will add the fpt's to this as well

                        PS: where did you find the "file_add_to_db()" function???
                        Cole Custom Programming - Terrell, Texas
                        972 524 8714
                        [email protected]

                        ____________________
                        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                        Comment


                          #13
                          RE: file copy difficulty

                          Finian

                          Comment

                          Working...
                          X