9 Replies Latest reply on Jan 15, 2015 6:39 PM by Wayne Matus

    Link to another file in the vault on a data card

    Charles Culp

      I need to set up a data card so it can link to another file in the vault. I assume this would be done with a button. I need this file location to be defined by a variable.


      I know how to set a up a button to link to a single file, but I need this file to change for every project.


      Imagine this on the data card:
      Link to template file: <Edit Box with file location> <Button to open up file>


      I did a search and found a few requests for this type of thing, but no real solutions. Does anyone know how to make this happen? Thanks for any ideas.

        • Re: Link to another file in the vault on a data card
          Charles Culp

          I have somewhat found a way to do it using the "Command String" button function, but this requires addresses using "C:\" and linking to Excel.


          What works for me. Command String button:

          "C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE ""%5\Design Files\Prototype Planning %3.xlsx"""


          Why does this not work? Why do I have to execute Excel explicitly?

          "%5\Design Files\Prototype Planning %3.xlsx"




          What happens when someone wants to use a PDF instead of an Excel file? Out of luck. What happens if someone is using a different version of Excel? No good. We also can't ever change the names of these planning files. I might be ok with that, but I'd rather it was controlled with a variable.


          The "Web Page" button does not allow for customized input strings (%5 for folder location, etc) to make it project specific.


          I would like to have an input like this:

          conisio://VaultLocation/open?projectid=15&documentid=12&objecttype=1 Where "15" and "12" are somehow able to be pulled from an outside variable instead of being static

            • Re: Link to another file in the vault on a data card
              Wayne Matus

              You can use VB script to open the file. In notepad or notepad++, create a file with .vbs files extension and add the following text.VB script.jpg

              In the Card Editor, set the button to command string to  cscript pathscript pathToFileToOpen

              Card button.jpg


              This will open any file with it's associated application. It does quickly opens a cmd window, but closes. Other option would be to write an custom add-in to do the same thing.

                • Re: Link to another file in the vault on a data card
                  Charles Culp



                  Thanks for your response! Sorry for not replying sooner, I was sidetracked and didn't check my inbox on the forum.


                  I modified the button command to try and get what I want, but I can't get it to work. This line does not work:

                  cscript "C:\StageGate\Administration\Scripts\VBSopen.vbs" "%5\Design Files\Prototype Planning %3.xlsx"

                  This line also does not work:

                  cscript "C:\StageGate\Administration\Scripts\VBSopen.vbs ""%5\Design Files\Prototype Planning %3.xlsx"""

                  %5 is the current folder, and %3 is the current file name. I need to open up a file in a subdirectory \Design Files\Prototype Planning <main drawing number>.xlsx.


                  When I type out this path explicitly (removing the %5 and %3) it works. When I use the following command, I can successfully open the file:

                  "C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE ""%5\Design Files\Prototype Planning %3.xlsx"""

                  This also works:

                  cscript "C:\StageGate\Administration\Scripts\VBSopen.vbs" "C:\StageGate\<edited>\Design Files\Prototype Planning 9020459900.xlsx"

                  So I guess what I'm asking, is what's the magic mojo with quote marks that I need to use to get this to work?

                    • Re: Link to another file in the vault on a data card
                      Wayne Matus



                      Here is the modified VBscript


                      Dim strName

                      Dim FSO

                      set wShell = CreateObject("Shell.Application")

                      set args = Wscript.Arguments

                      set FSO = CreateObject("Scripting.FileSystemObject")

                      strName = args(0) & args(1) & args(2) & args(3) & args(4)

                      If FSO.FileExists(strName) Then

                        wShell.Open strName


                        MsgBox strName & " - does not exist"

                      End if


                      And this is the command string


                      cscript C:\StageGate\Administration\Scripts\VBSopen.vbs C: %5 "\Design Files\Prototype Planning " %3 .xlsx


                      In the command string you need double quotes " when there are spaces in the string. The command string uses spaces to separate the different arguments passed to the VBScript. %5 starts at the root folder in the vault. So the first argument C: is the path to the root folder. The "\Design Files\Prototype Planning " is put into double quotes because of the spaces between Design Files and Prototype Planning and the space at the end of the string.


                      The VBScript concatenates all four of the arguments passed via the command string into a single string that is the full filename. I also added some error checking so it will prompt with a message box if there is not a file with that name.

                        • Re: Link to another file in the vault on a data card
                          Charles Culp

                          Thanks Wayne!


                          I spend way too much time on this earlier this morning without looking at this thread, and I found my problem is that I didn't add the "C:" in the command string. Funny how the "C:" isn't required when using Excel.exe. Anyway, we also sometime have our vault located on an H:, for computers with a special setup where there is no access to the "C:", so we are modifying the VB script to swap either H or C when appropriate.


                          Thank you for your help. I will report back tomorrow if we got it to work; but I'm sure we are at least on the right track.

                  • Re: Link to another file in the vault on a data card
                    Jim Sculley



                    If I understand you correctly, when you click the button, you want the file listed in the edit box to open with whatever it's associated application is?


                    Is this edit box user-editable?  Does it contain just a file name a folder name or the full path?  Where is the data in the edit box coming from?

                    Jim S.

                      • Re: Link to another file in the vault on a data card
                        Charles Culp



                        Originally, I wanted exactly what you said. I imagined that the edit box was user-editable, so users could replace a *.xls with a *.pdf, or something similar. It can contain whatever works for full path vs local file name. The data should originally come from the project template.


                        I have been thinking about this for a couple weeks, but it is now "crunch time". Since I have been focusing on it this afternoon, I have come to the conclusion that the link doesn't have to be a user editable box. It can be completely invisible and behind the scenes. As long as each project can link to a separate predetermined document as set up in the project template. It seems my above approach could work, except I don't like having to explicitly call out Excel.exe. This executable location could change over time, and could be different on one computer to another.


                        For example:






                        Where MasterFile_ProjectA.xls has a data card. On that data card is a list of Data requirements, and next to each data requirement is a button to open up TemplateFile1_ProjectA.xls, etc..


                          • Re: Link to another file in the vault on a data card
                            Jim Sculley

                            This whole thing is pretty trivial with an add-in as long as the full path to the file you need is stored in a variable.  Windows has built in functions to open documents using their default application so that you don't have to worry about xls vs. PDF or where the actual program is located.  So, with the full path to the file in hand, the add-in only has to do this:


                            Process process = new Process();

                            process.StartInfo = new ProcessStartInfo(pathToTheFile);



                            If the app is already open (e.g. SolidWorks), it will open the document in the running app.  If it isn't running it will start it.  Add a little error handing (file not found, no associated program, etc...) and you are good to go.


                            If you have access to Visual Studio, I can walk you through whipping up an add-in that does what you want.  It is only about 70 lines of code, mostly boilerplate.


                            Jim S.