2 Replies Latest reply on Apr 4, 2018 1:45 PM by Derek Eldridge

    How does #Task handle Multiple Option Selection

    Derek Eldridge

      Can anyone help point me in the right direction here.

      In the #Task application, I've selected "Options" and filled out a bunch of "Members". It's set to multiple selection so in the application I can select multiple file types to save to.

       

      What I can't figure out, is how #Task passes these options to the macro. Is it a comma separated string, an array, or whatever?

       

      I've tried to handle them as a string like this with no luck. They will export if I select one at a time. But when I select multiple, it will only save using one of the selected.

      ****************

      Dim Extension As String

      Extension = "%STR_Extension%"

       

      'Index string to array

      myArray = Split(Extension, ", ")

       

      'Run for each extension selected

      For Each i In myArray

      myArray_Ext = i

      myArray_Ext_Trim = Mid(myArray_Ext, Len(myArray_Ext) - 4, 4)

      boolstatus = swModel.SaveAs3(FileLocation & "\" & NewFileName & myArray_Ext_Trim, 0, 0)

      Next

      ****************

       

      I also Tried like this as an array:

      ****************

      Dim Extension As Variant

      Extension = Array("%STR_Extension%")

       

      myArray = Extension

       

      'Run for each extension selected

      For Each i In myArray

      myArray_Ext = i

      myArray_Ext_Trim = Mid(myArray_Ext, Len(myArray_Ext) - 4, 4)

      boolstatus = swModel.SaveAs3(FileLocation & "\" & NewFileName & myArray_Ext_Trim, 0, 0)

      Next

      ****************

       

       

        • Re: How does #Task handle Multiple Option Selection
          Artem Taturevych

          Hi Derek,

           

          The values are separated by commas. In order to find the macro which is resolved by #TASK (for debugging purposes) you can follow the steps below:

           

          1. Create args.ini file in the %appdata%\CI.SharpSwTask folder
          2. Add the following line to this file

          copy_debug_sts_dir=[Folder To Copy Debug File]

          Specified folder must exist.

           

          Next time when you run the macro you will see a text file created with the time stamp

           

          You can copy-paste that into the VBA macro and debug. So for example for the following sts file:

           

          Dim swApp As SldWorks.SldWorks

           

          Sub Main

           

          Set swApp = Application.SldWorks

          MsgBox "%EXT%"

           

          End Sub

           

          '------------

          ' "var","editor","editor_arg","name","desc"

          ' "%EXT%","System.Enum","-m -i:A -i:B -i:C -i:D","Options",

           

          with the following selection:

           

           

          This what would be resolved:

           

          Dim swApp As SldWorks.SldWorks

           

          Sub Main

           

          Set swApp = Application.SldWorks

          MsgBox "B,C"

           

          End Sub

           

          As you can see the values are separated by commas.

           

          Thanks,
          Artem