RobotStudio event

Copy Directory

Options

Hey all, I am new to the RAB 5.11 PC SDK. I am simlpy trying to copy a directory from my pc to the HOME directory of a selected IRC5 controller. This is my code in C# .Net:

ControllerBrowser cb = new ControllerBrowser();
cb.ShowDialog();
Controller  selectedController = cb.SelectedController;
selectedController.Logon(UserInfo.DefaultUser);
selectedController.FileSystem.PutDirectory(@C:Documents and SettingsuserMy DocumentsData,true);

The controller browser is similar to the simple PC SDK network scannner application from the RAB User Guide.

When I run the program I get an unhandled "System.Exception" thrown for which there is not much explanation.

Can anybody please help me?

Comments

  • BTW I am using a virtual controller right now running on RobotStudio 5.11
  • newform
    Options
    Do you check the property "LocalDirectory"/"RemoteDirectory" of "FileSystem" before you copy directory? 

    I got similar problem before when I tried to send/get file from controller? I need assign these properties before I send/get file.

    I am not sure if this will work. But you can try it.
  • I did check the LocalDirectory and RemoteDirectory properties of the FileSystem. They both seem to be set correctly. Since the controller is virtual the RemoteDirectory is set to be the directory on the local computer in which the system's HOME directory is located (C:/Documents and Settings/user/My Documents/RobotStudio/Systems/System123/HOME)

     

    I am also having trouble with the GetDirectory method.

     


     

    This gives me a DirectoryNotFoundException even thought I can browse to this location using the FlexPendant Explorer on the virtual flexpendant in RobotStudio.

     

    I'm not sure if the fact that the controller is a virtual controller is giving me a problem?

     

     
  • newform
    Options
    How about the LocalDirectory? For instance, if you want to copy a file "C:\Folder\test.txt" to the robot's HOME directory, the LocalDirectory should be "C:\Folder". Then when you use PutFile function, you just need specify the file name "test.txt".

    For the GetDirectory method, do you try "false" instead. It seems that you want to overwrite the directory as you use "true".

    Virtual robot or real robot should not make these functions work differently. We use same functions to manipulate both virtual and real robots.
  • Thanks newform.
     

    It seems that I was just confused about the usage of the LocalDirectory and RemoteDirectory properties of the FileSystem object. I now have it working correctly.