Results 1 to 6 of 6

Thread: Open a File Dialog Box in SBP

  1. #1
    Join Date
    Jan 2017
    Location
    Chappell Hill, TX
    Posts
    4

    Default Open a File Dialog Box in SBP

    Hello,
    I'm trying to write a sbp file that allows you to open a sbp file and which then has some additional commands to allow the selected file to run several times in different locations on the machine. I have a program written that already does this but I have to manually go in and change the file name.

    So my question is... Is there a way when open a file selection box within a sbp file?

    Thanks so much, Charlie
    www.joswoodgallery.com

  2. #2
    Join Date
    Jul 2014
    Location
    Bell, Florida
    Posts
    409

    Default

    The "FP" command will run a file from within a file - so if you wrote a file the has a popup to give you choices of files and set up variables to go to sections to run different files - something like this

    'Make First Plunge... the following line will display first and wait for key stroke

    MSGBOX(Is &ToolName tool number &tool in spindle? ,YesNoCancel,Change bit?)
    if &msganswer = Cancel then ENDALL
    if &msganswer = no then GoTo changebit

    MSGBOX(Is Z axis zeroed? ,YesNoCancel,ZeroZ)
    if &msganswer = Cancel then ENDALL
    if &msganswer = YES then GoTo AlreadyZero

    the MSGBOX sets up the question
    msganswer is the variable
    the GoTo sends you to a section of the file which in your case could be file names - then when you get there you run your FP command


    hope this made sense

    Tim
    Tim Lucas Custom Woodworks
    www.TLCW.us

  3. #3
    Join Date
    Apr 2007
    Location
    Marquette, MI
    Posts
    3,388

    Default

    This is an excerpt from something similar I wrote 6-8 years ago:

    INPUT "ENTER DOOR HEIGHT [96],[81],[80], Input [C]ustom or [Q]uit" &menu_hgt
    '
    IF &menu_hgt = Q THEN ENDALL
    '
    IF &menu_hgt = C THEN GOSUB CUSTOM
    '
    IF &menu_hgt = 96 THEN GOSUB 96
    '
    IF &menu_hgt = 81 THEN GOSUB 81
    '
    IF &menu_hgt = 80 THEN GOSUB 80
    '
    'ADD ADDITIONAL HERE IF NEEDED (dont forget to add to input at top)
    '
    MSGBOX(CUT DIFFERENT LENGTH DOORS?,YesNo,[YES] top SELECT NEW LENGTH OR [NO] to QUIT)
    IF &msganswer = YES THEN &change_height = YES
    IF &msganswer = YES THEN GOTO CHANGE_HGT
    '
    END
    '+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++
    CUSTOM:
    FP,C:\SbParts\Fixed Louver Doors\JALOUSIE FIXED LOUVER CUTTER CUSTOM SIZES.sbp
    RETURN
    '
    80:
    FP,C:\SbParts\Fixed Louver Doors\FXD LVR 80 TALL.sbp
    RETURN
    '
    81:
    FP,C:\SbParts\Fixed Louver Doors\FXD LVR 81 TALL.sbp
    RETURN
    '
    96:
    FP,C:\SbParts\Fixed Louver Doors\FXD LVR 96 TALL.sbp
    RETURN
    '
    Gary Campbell
    GCnC Control
    GCnC411(at)gmail(dot)com
    Servo Controller Upgrades
    http://www.youtube.com/user/Islaww1


    "We can not solve our problems with the same level of thinking that created them"
    Albert Einstein


  4. #4
    Join Date
    Jan 2017
    Location
    Chappell Hill, TX
    Posts
    4

    Default

    Thanks folks for trying to help. I guess both of the solutions are still hard coding the file names into the file. In my case the file folder constantly changes with additional files (I just want to pick the file I need out of the folder they reside in...). I may have to create a VB program that creates a sbp file and then I run the same sbp file all the time. Basically, run the VB program 1st then run the SBP file.

    Thanks, Charlie

  5. #5
    Join Date
    Dec 2000
    Location
    Thorp, WI
    Posts
    2,845

    Default

    Not sure if you can get the SHELL command to work for you or not, but this would bring up the open dialog set to a folder of your choosing.

    "c:\windows\EXPLORER.EXE /n, /e, c:\SbParts"
    Scott




  6. #6
    Join Date
    Jan 2017
    Location
    Chappell Hill, TX
    Posts
    4

    Default

    Well, tried your suggestion(s) (Thanks!) but couldn't quite find anything that would open a dialog box from within the SBP code and do what I wanted. So... I went a different way. I used an Excel file and coded some VBA to do it...
    Basically the Excel file allows you to select a file that you want to run multiple times shifting between 2 locations. After you select the file it actually writes out a SBP file that you would run. The file will be written to the same folder you select the file from. There is some documentation within the file. You will need to enable macros in order for it to work. Should work in both Excel 2013 and 2016.

    Hope this makes sense...

    Try in preview mode to see it work.

    https://www.dropbox.com/s/at7ekguqvk...cker.xlsm?dl=0

    Thanks, Charlie
    www.joswoodgallery.com

Posting Permissions

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