PC SDK "GetDirectory" problem
PeterG
✭
Hi All,
Basic concept is to creat a backup on the flexpendent controller and the copy that directory to the local HDD of the PC that is running the SDK but I keep having a problem getting the "CopyDirectory" or "GetDirectory" methods to work!
My Code:
//string st_BackUp = this.controller.SystemName;
string st_BackUp = this.controller.SystemName + "_TEST";
string st_RobotDirectoryPathCk = ("");
string st_folderName = "C:\\TEMP_NS";
string st_RobotDirectoryPath = "";
string st_LocalBackupPath = Path.Combine(st_folderName, st_BackUp);
//Create string for comparision between path name methods
st_RobotDirectoryPathCk = this.controller.FileSystem.RemoteDirectory;
// Create second controller directory path string using different method
st_RobotDirectoryPath = controller.GetEnvironmentVariable("HOME") + @/;
string st_RobotBackupPath = (st_RobotDirectoryPath + "/" + st_BackUp);
// Display path
MessageBox.Show("current Robot Directory is set to: " + st_RobotDirectoryPath);
MessageBox.Show("current Robot Directory check is set to: " + st_RobotDirectoryPathCk);
//Create backup in HOME or BACKUP directory with system name.
this.controller.Backup(st_BackUp);
while (this.controller.BackupInProgress)
{
MessageBox.Show("Backup In progress");
}
MessageBox.Show("Backup complete");
// Create directory on local system and copy backup to that location.
Directory.CreateDirectory(st_LocalBackupPath);
this.controller.FileSystem.GetDirectory(st_RobotBackupPath, st_LocalBackupPath);
I Have tried writing the file paths but stll have the same problem.
error message when running "GetDirectory": "Operation is not valid due to the current state of the object"
Any help appreciated,
Running RS 5.15.02 VS 2010 express
Basic concept is to creat a backup on the flexpendent controller and the copy that directory to the local HDD of the PC that is running the SDK but I keep having a problem getting the "CopyDirectory" or "GetDirectory" methods to work!
My Code:
//string st_BackUp = this.controller.SystemName;
string st_BackUp = this.controller.SystemName + "_TEST";
string st_RobotDirectoryPathCk = ("");
string st_folderName = "C:\\TEMP_NS";
string st_RobotDirectoryPath = "";
string st_LocalBackupPath = Path.Combine(st_folderName, st_BackUp);
//Create string for comparision between path name methods
st_RobotDirectoryPathCk = this.controller.FileSystem.RemoteDirectory;
// Create second controller directory path string using different method
st_RobotDirectoryPath = controller.GetEnvironmentVariable("HOME") + @/;
string st_RobotBackupPath = (st_RobotDirectoryPath + "/" + st_BackUp);
// Display path
MessageBox.Show("current Robot Directory is set to: " + st_RobotDirectoryPath);
MessageBox.Show("current Robot Directory check is set to: " + st_RobotDirectoryPathCk);
//Create backup in HOME or BACKUP directory with system name.
this.controller.Backup(st_BackUp);
while (this.controller.BackupInProgress)
{
MessageBox.Show("Backup In progress");
}
MessageBox.Show("Backup complete");
// Create directory on local system and copy backup to that location.
Directory.CreateDirectory(st_LocalBackupPath);
this.controller.FileSystem.GetDirectory(st_RobotBackupPath, st_LocalBackupPath);
I Have tried writing the file paths but stll have the same problem.
error message when running "GetDirectory": "Operation is not valid due to the current state of the object"
Any help appreciated,
Running RS 5.15.02 VS 2010 express
0
Comments
-
Hi,Had the exact problem with the FileSystem. The code below started to work...''' <summary>''' Creates a backup on the robot, copies the backup to PC and removes the backup vrom the robot.''' </summary>''' <param name="dirAtRobot">Dir to be created in the /hd0a/BACKUP/ folder at he robot</param>''' <param name="dirAtPC">Directory at local PC to where the backup is being copied</param>''' <returns>True or false</returns>''' <remarks></remarks>Public Function GetBackup(ByVal dirAtRobot As String, ByVal dirAtPC As String) As BooleanTry' Login_selController.Logon(UserInfo.DefaultUser)' Create backup_selController.Backup("(BACKUP)$" & "/" & dirAtRobot)' Wait for the backup to finishWhile _selController.BackupInProgressThreading.Thread.Sleep(50)Application.DoEvents()End While' Create dir on local PC, if doesn't existIf Not IO.Directory.Exists(dirAtPC) ThenIO.Directory.CreateDirectory(dirAtPC)End If' IMPORTANT! Set the RemoteDirectory!!!_selController.FileSystem.RemoteDirectory = "(BACKUP)$"' Just get the directory from the remote dir_selController.FileSystem.GetDirectory(dirAtRobot, dirAtPC, True)' Remote the directory on the robot_selController.FileSystem.RemoveDirectory(dirAtRobot, True)Return TrueCatch ex As ExceptionThrow exFinally' Own stuff...LogOffController()End TryEnd FunctionHope this helps!0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 799 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings