RobotStudio event

Reading command string from .txt file

Hey guys,

 

Is there any way I can read a MoveL command stored on a txt file? I've been trying to use the ReadStr function but the path to the text file on my pc is not being acknowledged by the compiler. The program runs perfectly until it stops at the Open file line with the path.

 

I'm trying to follow this example I saw on RAPID's manual:

 

VAR string text;
VAR iodev infile;
...
Open "HOME:/file.doc", infile\Read;
text := ReadStr(infile);

Text is assigned a string read from the file file.doc.

 

Instead of "HOME:/file.doc" I'm using "C:\test\test_v1", which is the location of the txt file on my pc. I'm sorry if it sounds stupid but I'm just beginning to work with the RAPID language and I'm still not familiar with its synthax.

 

What is this "HOME:\" in the beginning of the example path? I inittially assumed it was there just for the sake of the example and that this would actually be my C:\ drive, but I keep getting errors if I refer to C:\. Is it something I have to set on RobotStudio?

 

Btw, I've connected the pc directly to the robot i.e., there's no intervention through the FlexPendant. The robot is an IRB 1600, 6kg, 1.45m with an IRC5 controller.

 

Any ideas on what the correct synthax for the path should be?

 

Any help would be greatly appreciated!

 

Alessandra

Comments

  • jerry-licao
    jerry-licao ✭✭
    edited August 2014

    Hello  moraisale:


           You made a mistake,If you put your file in the lacation: C:\test\test_v1,  You should write like this:  c:/test/test_v1.txt.  The Rapid code will be like this:

       PROC main()
            Open "c:/test/test_v1.txt", infile\Read;
            text := ReadStr(infile);
            TPWrite text;
           Close infile;
       ENDPROC

    I tested the code,it was running OK.   I think it can help you. Any questions, we can have a further comunication.
    Post edited by jerry-licao on
    1.jpg 106.1K
    2.jpg 80.6K