Try the next statement:
Shell("psexec -i -s -d \REMOTECOMPUTERNAME -u USER -p PASSWORD ""C:\Program Files\LightBurn\LightBurn.exe"" """ & out_file & """", vbNormalFocus)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Guys,
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)
Try the next statement:
Shell("psexec -i -s -d \REMOTECOMPUTERNAME -u USER -p PASSWORD ""C:\Program Files\LightBurn\LightBurn.exe"" """ & out_file & """", vbNormalFocus)
Thanks Viorel-1
still getting the same compile error: Expected list separator or ).
This is a macro within CorelDraw (CorelDraw have a VB editor for Macros). Basically it will copy the selection in coreldraw and open it in another program LightBurn.
The script work well when both programs are on the same PC. using the code:
Call Shell("C:\Program Files\LightBurn\LightBurn.exe " & """" & out_file & """", vbNormalFocus)
I am trying to open the program LightBurn on another machine on the local network using psexec
(typing directly in CMD window: psexec -i -s -d \REMOTECOMPUTERNAME -u USER -p PASSWORD “C:\Program Files\LightBurn\LightBurn.exe
will do it.
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
when I change the path of the file on the local machine to the psexec command, I get the syyntax error.