Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Open a folder

  1. #1
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658

    Open a folder

    Hello,

    How do I open a windows folder?

    Say I have a path 'C:\Users\Cory\Desktop\TestFolder', I want to add a button to open this folder.
    How do I accomplish that?

    Cory

  2. #2
    Lianja Team davefoss's Avatar
    Join Date
    Feb 2012
    Posts
    111
    Hi Cory,

    One way is to use the RUN command:

    RUN "c:\windows\EXPLORER.EXE /n, /e, X:\Folder_of_my_choosing"

    There may be other/better ways.

  3. #3
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hi Dave,

    That code somewhat works.
    It will not open any folder on the desktop and defaults to My Documents instead.

    Cory

  4. #4
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    After a bit more testing, I have determined that you cannot concatenate any string to the command. It must remain as one string.
    This is what I was attempting:
    Code:
    RUN "c:\windows\EXPLORER.EXE /n, /e, " + Lianja.Get("lblRptPath").caption + "\reports"
    Here is what I ended up with:
    Code:
    strPath = Lianja.Get("lblRptPath").caption + "\reports"
    RUN "c:\windows\EXPLORER.EXE /e, /root, &strPath"
    Thanks,
    Cory

  5. #5
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,011
    Hi Cory,

    it works for me.

    What are you trying to accomplish by doing this?

    Hank

  6. #6
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,230
    Hi Cory,

    If you want to select a folder, you can just use =getdir()
    If you trying to select a particular file, then use = getfile()

    Herb

  7. #7
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hi Hank and Herb,

    This is a case where I am trying to help the user.
    I have a function which creates a csv report for the user and saves it to a location of their choice (using the GetDir() function).

    I want to open the folder location for the user instead of allowing the user to navigate the various paths to get to the folder location.
    The paths are extremely long, especially if you are using the default cloudserver location in the app center.

    Cory

  8. #8
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,230
    Hi Corey,

    I see your issue.
    Getdir() should allow you to specify a file location to open, but it is only using the default.

    This probably needs to be looked at by the dev team.

    Meaning - you should be able to call getdir("<file location", "text","title")

    These are the parameters in vfp
    GETDIR([cDirectory [, cText [, cCaption [, nFlags [, lRootOnly]]]]])

    Herb

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,972
    I have corrected this behavior in the next build which will be available within a few days.

    So GETDIR() behaves like VFP not FP.

    GETDIR([cDirectory [, cText [, cCaption [, nFlags [, lRootOnly]]]]])

    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  10. #10
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hi Barry,

    If GETDIR() has changed, can you please update the wiki and the function description in the app builder.
    http://www.lianja.com/doc/index.php/GETDIR()

    In this case, I don't think I can use GETDIR() since it seems like it only accesses the open folder dialog box.
    I was looking to physically open the folder.

    Using the RUN command still seems to be my best option and it works fine.

    Thanks,
    Cory

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

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
  •  
Journey into the Cloud
Join us