RobotStudio event

Rapid-Code Import from .txt-file to Robotstudio

Hello :)
i am generating Rapid Code with a Python-Script, which is connected to Chatgpt. The code ist then saved as a .txt file on my PC. Now i want to automatically import the code to Robotstudio, but I cant find a way to do so. 

My Idea was, that I either send the code via an api to Robotstudio or I tell Robotstudio where the txt.-file is and it gets importet. But I cant find a way to implement something like this.

Thanks
Levin

Answers

  • lemster68
    lemster68 ✭✭✭
    Don't save it as .txt, save it as .mod.  All rapid modules are text files basically.  Use the Load command in rapid to then load your .mod file.
    Lee Justice
  • Thanks for the answer!
    I tried searching for the command-syntax but couldnt find any. 
    Could you explain to me how the load command should look?
  • lemster68
    lemster68 ✭✭✭
    edited June 21
    You are welcome.
    A search on this site should yield quite a few threads concerning Load/UnLoad.
    Lee Justice
  • I have found some discussions, but I still can't really make progress. My current code looks like this:

    var string diskhome := "c:/asdf/";
    Load\Dynamic,diskhome\File:="Code.Mod";

    I get the error message that the file cannot be found..."
  • lemster68
    lemster68 ✭✭✭
    The path to the virtual controller's home is very different from that.  If that is where the file is located, try to specify that and drop the variable assignment to diskhome and use the path in your load instruction.
    Or, maybe copy it into the virtual controller's home directory first.
    Lee Justice
  • I must admit that I don't really understand what you mean, this is the first time I'm using RobotStudio. So if you could perhaps explain it again, I would be very grateful.

    Otherwise, I had another idea: As far as I understand, the RAPID code is saved as a .modx file under C:\Users\droste\Documents\RobotStudio\Projects\Project4\Controller Data\IRB4600_20_250\RAPID\TASK1\PROGMOD\Module1.modx. My idea was to edit this file directly with Python, but when I change this file, the code remains the same.

  • lemster68
    lemster68 ✭✭✭
    In the case of the demo project I have opened in RS, this is the path to the home directory in full:

    C:\Users\YourUserName\Documents\RobotStudio\Projects\Demo Exhaust Pipe\Virtual Controllers\IRB1600ID_AW\HOME

    You can save or copy the module to the home of the virtual controller you are working with.  Then, just use Load "HOME:"\File:="MyMod.mod";
    Lee Justice