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

Can I open a folder with Windows Explorer ?

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

    Can I open a folder with Windows Explorer ?

    Could somebody please point me in the right direction with this..

    I want 2 buttons:

    1 which allows a user to specify the location folder for files relating to a particular client, for example "C:\Users\Steve\Documents\Client Files\George & Mildred" - to be stored in folder_address_field

    and another which opens the folder in Windows Explorer to view the files within that folder

    I've no idea how to do the first.

    For the second: I've tried playing around with both the Open URL and Open non-Alpha file options, but with no success..

    Any help welcome - thx in advance..

    Steve

    #2
    Re: Can I open a folder with Windows Explorer ?

    from the help files...



    Code:
    dim file_names[250] as C
    
    old_directory = dir_get()
    
    dir_put("c:\a5\a_sports")
    
    files = filefind.first("*.dbf")
    
    I = 1
    
    while .not. files.eof()
    
        file_names[I] = files.name()
    
        files.next()
    
        I = I + 1
    
    end while
    
    dir_put(old_directory)
    This will display all the files in a directory.

    Tom

    Comment


      #3
      Re: Can I open a folder with Windows Explorer ?

      Hi Tom..

      Thanks for the quick response..

      I can't get this to work however..

      The "c:\a5\a_sports" directory doesn't exist on my machine - when I change the address to something that does exist - even something as simple as "C:\a5V10"- nothing happens..

      and if I could get this to work, would it be possible to open based on a Variable or field value, rather than a pre-coded address ?

      Thanks again..

      Comment


        #4
        Re: Can I open a folder with Windows Explorer ?

        Progress of a sort..

        Have just discovered sys_explore

        - when I enter sys_explore("C:\Users\Steve\Documents\Client Files") it opens up exactly as required

        Now I just need it to translate : sys_explore("fieldname")

        Comment


          #5
          Re: Can I open a folder with Windows Explorer ?

          Originally posted by Steviev View Post
          Now I just need it to translate : sys_explore("fieldname")
          Not understood. What do you expect sys_explore() to do to with a "fieldname", assuming you really mean "filename"?

          SYS_EXPLORE() opens the Windows Explorer showing files in the drive and/or path specified by Drive_Folder.
          sys_explore() doesn't accept a filename as a parameter.

          1 which allows a user to specify the location folder for files relating to a particular client
          That code involves ui_get_path()

          another which opens the folder in Windows Explorer to view the files within that folder
          That's the functionality of sys_explore()
          There can be only one.

          Comment


            #6
            Re: Can I open a folder with Windows Explorer ?

            Hi Stan..

            I've been plugging away at this (ironically the 'Similar Threads" below helped a lot - despite the fact that I couldn't find them before I'd posted my own !)

            "sys_explore() doesn't accept a filename as a parameter" - I didn't think it would either but I've got this part (ie second button) working:

            DIM foldername as C
            foldername = a5_eval_expression("=filefolder")
            sys_explore(foldername)

            This opens up Windows explorer to the folder address stored in field filefolder

            I'm now trying to get the address into the filefolder field using UI_BROWSE_FOR_FOLDER() but can't seem to make this work - do I specify the field, or a variable to be transferred to the field ?

            (As far as I can see - ui_get_path() and browse for folder are pretty much the same - the former allows you to create the folder if it doesn't exist

            Comment


              #7
              Re: Can I open a folder with Windows Explorer ?

              Given a path "to be stored in folder_address_field", don't forget that the field is probably specified as wider than any likely path. So ...

              on a form based on the table holding the folder_address_field

              sys_explore(alltrim(folder_address_field))

              should work.

              If the folder_address_field is visible on the form and the object name for folder_address_field is also folder_address_field

              sys_explore(folder_address_field.value)

              should work.
              There can be only one.

              Comment


                #8
                Re: Can I open a folder with Windows Explorer ?

                Stan you're a star..

                - it was the alltrim which did it - the folder name - which I eventually stored into a variable using the Action Script 'rompt for Folder name' function - had a trailing '/' - which Sys_explore didn't like

                Thanks again..

                Comment


                  #9
                  Re: Can I open a folder with Windows Explorer ?

                  This is awesome.

                  Should give my mouse and forefinger a few more years of service as the clicking as you burrow down to the different sub-directories to find stuff is reduced by a factor of 5. Also, prevents the error of opening wrong project files.

                  Now to see if I can find or come up with a way to save reports that will take me into the general vicinity of the same sub_ directories.


                  Thanks Stan and Steve.

                  Larry

                  Comment


                    #10
                    Re: Can I open a folder with Windows Explorer ?

                    Now to see if I can find or come up with a way to save reports that will take me into the general vicinity of the same sub_ directories.
                    What is your issue? You should be able to save a report anywhere you like.
                    There can be only one.

                    Comment


                      #11
                      Re: Can I open a folder with Windows Explorer ?

                      Stan, I have a button on a form that prints a report to pdf, saves it in a temporary file and then opens it with Acrobat. After previewing it, I do a "save as" in Acrobat and save it to the proper sub-directory with a name that is usually similar to what is already in the sub-directory. There are usually many files and the names vary enough that it has to be a manual pick although as I am typing this, I am thinking I might be able to standardize a bit more and combine three or four fields from the form as the file name.

                      As I started to write this I was only thinking I might save a few clicks if I was able to go directly to the correct sub-directory to pick a similar file name, just as I am now able to do with the code from above when I want to open any one of the reports but I think I might be able to do even better.

                      I also have a button that will open open the report that I am about to save and my plan was that when I save the report, I can do a "copy as a path" on the name and go back to A5 and paste it into the filename field on the form so the button will be able to function as intended. Again, as I am writing this, it seems that if I combine the three or four field from above, this can go directly into the filename field and eliminate the copy and paste routine.

                      I just created the open button a few days ago to access the specific file so I am quite excited about all of this as it takes the monotony and time out of searching a list of files to get the one you want.

                      There appear to be several threads on this so hopefully I should be able to find enough info to get me on my way. If all of this makes sense to you and you think I am dreaming, let me know as it is quite late right now.

                      Larry

                      Comment


                        #12
                        Re: Can I open a folder with Windows Explorer ?

                        All doable. You should be able to use ui_get_file() to navigate to the file you want to open. It accepts a "start in" path which can be whatever sub directory you like. If you store the start in path for pdf's related to the current record in the record, half the work is done.

                        Then you just test the return of the ui_get_file() to make sure a file was chosen (return is not blank) and use that as the parameter for sys_open().
                        There can be only one.

                        Comment


                          #13
                          Re: Can I open a folder with Windows Explorer ?



                          Works well and I am surprised at how easy it was to do it.

                          Thanks Stan for the help.

                          I now have a concern with the file save button in that when I create the report (cover page), I combine other pdf docs with it for a package deal. I am thinking that it will be quite easy to accidentally overwrite the file. Any thoughts on how one could protect the file from the press of a button?

                          Larry

                          Comment


                            #14
                            Re: Can I open a folder with Windows Explorer ?

                            You could set the file to read only after saving it.

                            FILE.ATTRIBUTES_SET()

                            Also the ui_get_file() has a parameter that the path/name value chose either must exist or must not exist. If you use the must not exist you shouldn't be able to overwrite an existing file.
                            Last edited by Stan Mathews; 01-17-2013, 09:34 AM.
                            There can be only one.

                            Comment


                              #15
                              Re: Can I open a folder with Windows Explorer ?

                              Setting the attributes would work, however we rarely get the cover page right the first time so we need to proof and save a second or third time.
                              As I was driving in to work this morning I was thinking about what I could do and I came up with the idea of having a check box
                              - if the check box is unchecked, the save goes to a temp file (need to change drive letters and directory location so I was hoping that a second "saveas" statement could be incorporated into the xbasic for the button routine.
                              - when the check box is made active, the save occurs to the permanent file and the check box is automatically deactivated so that the next intended or accidental save would go to the temp file unless the box is checked.

                              I didn't use the UI routine as I had created a calculated field that uses fields to create the path. Probably not an efficient way to do it so I will need to read up on the UI_get file routine.

                              Do you think this is doable?

                              Larry

                              Comment

                              Working...
                              X