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

rename external file

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

    rename external file

    Is it possible to rename a file from A5? I have a report that I print to file. The file lands on the desktop for email purposes. I would like to change the name of the file before I print another report. Can this be done?
    Thanks for any suggestions.
    bob

    #2
    RE: rename external file

    Bob - taken from the PDF xbasic reference file/book that ships with A5

    'This script will rename any file.
    '---------------------------------
    filename = ui_get_file("Rename Which File?","All Files
    (*.*)","","X")
    IF filename = "" THEN
    END
    END IF
    newfile = ui_get_file("New Filename","All Files (*.*)","","N")
    IF newfile = "" THEN
    END
    END IF
    file.rename(filename,newfile)

    Comment


      #3
      RE: rename external file

      Thanks Stephen,
      I don't know xbasic except by tial and error. Could you fill in the blanks? The file name generated by the report is c:windowsdesktoptest.pdf
      I would like to rename it c:windowsdesktoptest2.pdf
      actually i would like to get the text of the baseball players lastname and use that for the file name but i might be able to figure that out if you could just get me started.
      Thank you,
      Bob

      Comment


        #4
        RE: rename external file

        The line you need is

        file.rename("c:\windowsdesktop\test.pdf","c:\windowsdesktop\test2.pdf")

        Comment


          #5
          RE: rename external file

          Thanks Stephen, Works perfect. Is there a way to put a variable where test2 is?
          Bob

          Comment


            #6
            RE: rename external file

            Test2 = "c:\windowsdesktop\test2.pdf" '

            Comment


              #7
              RE: rename external file

              Thanks a million for your time. I will give it a try tonight.
              Bob

              Comment


                #8
                RE: rename external file

                Here is the script I am trying. I want the new file name (statname) to be the value of the lastname field on the form.
                ross_stats is the name of the file generated by the report
                dim value as c
                tbl=table.current()
                statname = tbl.lastname
                statname="c:windowsdesktopstatname.pdf"
                ross = "c:windowsdesktopross_stats.pdf"
                file.rename(ross,statname)
                thankls again,
                Bob

                Comment


                  #9
                  RE: rename external file

                  Bob -
                  I am very confused by this code, but it is obviously only a piece...so I numbered it to comment

                  1.ross_stats is the name of the file generated by the report
                  2.dim value as c
                  3.tbl=table.current()
                  4.statname = tbl.lastname
                  5.statname="c:windowsdesktopstatname.pdf"
                  6.ross = "c:windowsdesktopross_stats.pdf"
                  7.file.rename(ross,statname)

                  1. I assume the report has been generated elsewhere.
                  2. the variable value is created and never used (maybe later...)
                  3. tbl = table.current() suggests this is put on a button on a form, else you would use tbl = table.open("put-your-table-name-here")
                  4. a variable, statname, is set as a variable with the value of the lastname field of the current table.
                  5. The variable, statname, is then reset, now to the character value "c:windowsdesktopstatname.pdf" (what was the lastname field value for?)
                  6 A variable, ross , is set to the character value "c:windowsdesktopross_stats.pdf"
                  7. the file c:windowsdesktopross_stats.pdf is renamed c:windowsdesktopstatname.pdf

                  Is this what you meant?
                  Ultimately it renames the ross_stats file to stat_name, but it doesn't make use of the value in the lastname field of the current table.

                  If this works, great! But there is obviously more to it. Tell me what you want from the current table...

                  Steve

                  Comment


                    #10
                    RE: rename external file

                    Yes, ultimatly i want the file name ross_stats.pdf to be renamed to lastname.pdf
                    It doesn't work the way i have it. The new file name on the desktop now ends up statname.pdf
                    I would like the value of lastname field to be the name of the file. In other words the new file name would be smith.pdf, then the next one would be jones.pdf, atc. Yes I am taking the value of lastname off form. If there is another way it would be ok. Action scripting as you can see it probably more my speed.
                    Thank you,
                    Bob

                    Comment


                      #11
                      RE: rename external file

                      Bob-
                      Create a button to run a custom action, on the form that has the customers last name in it.
                      Right click on it and open the code editor, either xbasic or action scripting.
                      If Action scripting, create a new inline xbasic object.

                      Put this bit of code in it, and see if that is what you need

                      tbl=table.current()
                      newname = tbl.lastname
                      if new name = ""
                      ui_msg_box("Cannot rename file","The customer last name cannot be blank",UI_OK)
                      end
                      end if
                      oldname = "c:\windowsdesktop\ross_stats.pdf"
                      if File.Exists(oldname)
                      file.rename(oldname,newname)
                      else
                      ui_msg_box("Cannot rename file","Could not find the file "+oldname,UI_OK)
                      end if

                      Comment


                        #12
                        RE: rename external file

                        Thanks Stephen,
                        That's pretty cool. Here is what happens. Let'say the lastname is "Smith". Ross_stats has a pdf file extension. The file is renamed to Smith but without pdf ext. It also places it in the A5v4 directory which I can live with. I would like to maintain the pdf ext. Also if I click on Smith and tell windows to open it with Adobe it opens ok.
                        Thank for all the help,
                        Bob

                        Comment

                        Working...
                        X