/ Forums / Advansys Formativ / Creating Solutions with Formativ / select directory code not working…

  • Creator
  • #4065

      following is a code snip that is not working as I need. When the user starts this app, they get a directory select dialog box, but if the press cancel, it does not cancel, it chooses c: as the default path and runs the rest of the program. It seems that “if iDlg.execute then” always evals to true even if you press cancel. How can I fix this so that if you press cancel, getExportDir remains = “”. IS this a bug, or a issue with my specific code or install on nt 4.0?

      Please help

      dim iStatusDlg
      set iStatusDlg = Utilities.NewStatusDialog
      iStatusDlg.ProgressRange = iMessages.count
      iStatusDlg.CanCancel = TRUE
      iStatusDlg.title = “Exporting Messages”
      iStatusDlg.MainText = “Preparing to export…”

      if iStatusDlg.Cancel then
      set iMessages = nothing
      exit sub
      end if

      exportPath = Utilities.AddBackSlashToPath(getExportDir)

      if exportPath = “” then
      set iMessages = nothing
      set iStatusDlg = nothing
      exit sub
      end if

      .. more code follows, and fucntions as well..

      Function getExportDir()
      getExportDir = “”
      dim iDlg
      set iDlg = Utilities.NewSelectDirectoryDialog
      iDlg.Caption = “Select export directory”
      if iDlg.execute then
      getExportDir = iDlg.Directory
      end if
      set iDlg = nothing
      End Function

    • Author
    • #6999
      Support 1a

        Thank you for your question. I can’t duplicate this exactly without having all your code, but I suspect the problem may lie in the line:

         exportPath = Utilities.AddBackSlashToPath(getExportDir) 

        The function getExportDir returns an empty string if the user cancels the directory select dialog. However, the line above will at the very least set exportPath to equal “”, even if the user presses cancel. This means the test:

        if exportPath = ""

        is never true. You’ll need to do that test before you call AddBackSlash to path.

        I hope this helps.

        Advansys Support


          yup, that is what I was looking for. Works fine for me now.

          How to I compile a applet into a self installing exe file like the ones I download from Novell’s cool solutions?


          Support 1a

            We just use the WISE Installation System to build applet installers. You could use any installation system you feel comfortable with.

            Your installer will need to determine the local applets location. We do this by first chacking the registry to see if the following key/value exists:

            HKEY_CURRENT_USERSoftwareAdvansys Corporationformativ1.0Settings

            Value: Local Scripts

            If this value exists, copy the applet to that location.

            If this value doesn’t exist, you need to dynamically determine this location. Use the facilities available in your installer to determine the location of the users ‘My Documents’ location. Then append “AdvansysFormativApplets” to the end of this location.

            I hope this helps.

            Advansys Support

          Viewing 3 replies - 1 through 3 (of 3 total)
          • You must be logged in to reply to this topic.