Macro for LightBurn

I am trying to use psexec to start a program on a remote computer. I embedded the code :
psexec -i -s -d \REMOTECOMPUTERNAME -u USER -p PASSWORD “C:\Program Files\LightBurn\LightBurn.exe”
(which working well by itself) inside a Visual Basic code and I am getting a syntax error. I guess VB don't like the parenthesis in the psexec argument.

This is the line in question and I hope someone can offer solution.


Call Shell("psexec -i -s -d \REMOTECOMPUTERNAME -u USER -p PASSWORD “C:\Program Files\LightBurn\LightBurn.exe” " & """" & out_file & """", vbNormalFocus)
End Sub

-----------------------------------------

The original macro that working when both programs are on the same machine is bellow: 

--------------------------------

Sub removeDup()

    'variables

    Dim sr As ShapeRange

    Dim srKeep As New ShapeRange

    Dim dupFound As Boolean

   

    Dim shape As shape

    Dim keepShape As shape

 

    'set variables

    Set sr = ActivePage.Shapes.FindShapes()

   

    For Each shape In sr.Shapes

        dupFound = False

        If srKeep.Count > 0 Then

            For Each keepShape In srKeep.Shapes

                 If keepShape.PositionX = shape.PositionX Then

                         If keepShape.PositionY = shape.PositionY Then

                                 If keepShape.SizeHeight = shape.SizeHeight Then

                                         If keepShape.SizeWidth = shape.SizeWidth Then

                                                 sr.DeleteItem (sr.IndexOf(shape))

                                                 dupFound = True

                                                 Exit For

                                         End If

                                 End If

                         End If

                 End If

            Next keepShape

            If Not dupFound Then

                 srKeep.Add shape

                 dupFound = False

            End If

        Else

            srKeep.Add shape

        End If

    Next shape

End Sub

Sub Lightburn()

    Dim answer As Integer

    Dim OrigSelection As ShapeRange

    Set OrigSelection = ActiveSelectionRange

    OrigSelection.CreateSelection

    Dim expopt As StructExportOptions

    Set expopt = CreateStructExportOptions

    expopt.UseColorProfile = True

    Dim expflt As ExportFilter

   

    Dim out_file As String

    out_file = "C:" & Environ("HOMEPATH") & "\export.ai"

    If Len(Dir$(out_file)) > 0 Then

        Kill (out_file)

    End If

   

    ' is an item selected?

    If ActiveSelectionRange.Count > 0 Then

        ' something is selected export it

        Set expflt = ActiveDocument.ExportEx(out_file, cdrAI, cdrSelection, expopt)

        With expflt

            .Version = 10 ' FilterAILib.aiVersionCS6

            .TextAsCurves = True

            .PreserveTransparency = True

            .ConvertSpotColors = True

            .SimulateOutlines = False

            .SimulateFills = False

            .IncludePlacedImages = True

            .IncludePreview = True

            .EmbedColorProfile = True

            .Finish

        End With

       

    Else

        answer = MsgBox("Nothing was selected, Export All?", vbYesNo + vbQuestion, "Export All")

        If answer = vbYes Then

            ' Export everything

            Set expflt = ActiveDocument.ExportEx(out_file, cdrAI, cdrAllPages, expopt)

            With expflt

                .Version = 10 ' FilterAILib.aiVersionCS6

                .TextAsCurves = True

                .PreserveTransparency = True

                .ConvertSpotColors = False

                .SimulateOutlines = False

                .SimulateFills = False

                .IncludePlacedImages = True

                .IncludePreview = True

                .EmbedColorProfile = True

                .Finish

            End With

           

        Else

            'do nothing

            Exit Sub

        End If

    End If

   

    ' Edit this like if lightburn is in a diffrent location

    Call Shell("C:\Program Files\LightBurn\LightBurn.exe " & """" & out_file & """", vbNormalFocus)

End Sub

--------------------------

  • Former Member
    0 Former Member over 4 years ago

    you probably need to escape the slashs and quotes

    • I’ve created a macro and pasted the code above. Upon clicking on the button, the Lasers state goes to “Busy” and does not finish. I tried running the same lines from the “Command” input field by removing all newlines and that works.

      Would you know, why the macro does not run/does not finish, if it’s ran via the button? I’m attaching a gif, which shows the issue.