putfile error
I am having trouble writing files to the controller. I think I am following the examples correctly. The error I get for a putfile call is GenericControllerException "File Not Found on the local filesystem". What am I missing here?
Here is my code:
Try
Dim LocalFile As String = AFileSystem.LocalDirectory + "" + "test.txt"
Dim RemoteFile As String = AFileSystem.RemoteDirectory + " est.txt"
master = Mastership.Request(controller.Rapid)
AFileSystem.PutFile(LocalFile, RemoteFile)
Catch ex As Exception
MsgBox(ex.ToString)
Eny Try
Comments
-
If you expand the values of LocalFile and RemoteFile, what are they? Do they match the location of the source and destination on your PC?
Russell Drown0 -
Yes, that was the first thing I checked. The paths are fine and the file really does exist. sanfordm2006-10-2 18:15:550
-
Try the following snippet; it works on my machine.
It appears that there are some problems with trying to use LocalDirectory or RemoteDirectory to form your paths. You may wish to avoid using LocalDirectory at all as I have done below; this seems to be the source of your problem. I'm not sure that LocalDirectory really means anything on PCSDK; however it does refer to the TEMP directory for the FLexPendant and is definitely used there.
NOTE: if you comment out the line where we set the value of LocalDirectory, the code should fail with the same exception that you reported above.
You can use a dialog control to browse for the file you wish to transfer, then you might try to modify the value of RemoteDirectory to change the destination. It appears that value of RemoteDirectory is appended to the destination argument in PutFile.
If anyone can clarify the proper usage here, it would be appreciated.
Private Sub PutFiles()Dim strPath As String
Dim ms As Mastership
Try
If ms Is Nothing Then
ms = Mastership.Request(ctrl.Rapid)
Else
ms.Release()
ms.Dispose()
ms = Nothing
ms = Mastership.Request(ctrl.Rapid)
End If
strPath = "C: emp
abtest.prg"ctrl.FileSystem.LocalDirectory = ""
ctrl.FileSystem.RemoteDirectory = "(HOME)$"
ctrl.FileSystem.PutFile(strPath, System.IO.Path.GetFileName(strPath))
Catch ex As Exception
MsgBox("Exception text: " & ex.ToString(), MsgBoxStyle.OKOnly, "Exception")
Finally
If Not ms Is Nothing Then
ms.Release()
ms.Dispose()
ms = Nothing
End If
End Try
End Sub
RussD2006-10-2 19:41:27Russell Drown0 -
Great, that works. Thanks.
0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings