Amend module file
 
            
                
                    ko414du4                
                
                     ✭                
            
                        
            
                    Greetings all,
I am trying to add a routine in a module file located in "Home:/".By this, I mean keeping the existing contents and then add a routine at the end of the module just before 'ENDMODULE' line.
=====================================================================
        
                                        
The issue I have now is that function ReadStr() cannot read more than 80 chars. While the existing contents has robtarget data that exceed this limit, and therefore the line is chopped and continued on the next line like below:
=====================================================================
        
    
=====================================================================
Is there any way of getting around this ReadStr() limitation of 80 chars? So the line is not chopped?                
                        I am trying to add a routine in a module file located in "Home:/".By this, I mean keeping the existing contents and then add a routine at the end of the module just before 'ENDMODULE' line.
=====================================================================
Code:
=====================================================================
=====================================================================
        VAR iodev readingChannel;
        VAR iodev writingChannel;
        VAR string line;
        ! Append new recipe routine
        Open "HOME:/Recipes.mod",writingChannel\Append;
        Write writingChannel,"! New routine here";
        Write writingChannel,"PROC newProc()";
        Write writingChannel,"! Test";
        Write writingChannel,"ENDPROC";
        Write writingChannel,"ENDMODULE";
        Close writingChannel;
        ! Read result and get rid of old ENDMODULE lines. Add ENDMODULE to the end instead.
        Open "HOME:/Recipes.mod",readingChannel\Read\Bin;
        Open "HOME:/temp.mod",writingChannel\Write\Bin;
        line:=ReadStr(readingChannel);
        WHILE (line<>EOF) DO
            IF (line <> "ENDMODULE") Write writingChannel,line;
            line:=ReadStr(readingChannel);
        ENDWHILE
        Write writingChannel,"ENDMODULE";
        ! Close channels
        Close readingChannel;
        Close writingChannel;
        ! Copy temp module to Recipes.mod
        Open "HOME:/temp.mod",readingChannel\Read;
        Open "HOME:/Recipes.mod",writingChannel\Write;
        line:=ReadStr(readingChannel);
        WHILE line<>EOF DO
            IF (line <> "ENDMODULE") Write writingChannel,line;
            line:=ReadStr(readingChannel);
        ENDWHILE
        Write writingChannel,"ENDMODULE";
        ! Close channels
        Close readingChannel;
        Close writingChannel;
        Stop;
=====================================================================
=====================================================================
The issue I have now is that function ReadStr() cannot read more than 80 chars. While the existing contents has robtarget data that exceed this limit, and therefore the line is chopped and continued on the next line like below:
=====================================================================
Result:
=====================================================================
=====================================================================
MODULE Recipes
    PROC Recipe_33()
        opsSets:=[
        [1,[[-1819.4,712.469,1163.07],[1.265E-06,0.818184,-0.574957,1.29455E-06]
,[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],222,2,222],
        [2,[[-2712.47,-1319.4,384.069],[2.08991E-08,-0.985099,-0.171988,-1.80987
E-06],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],33,3,333],
        [3,[[-2712.47,-1319.4,384.069],[2.08991E-08,-0.985099,-0.171988,-1.80987
E-06],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],33,3,333],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0],
        [0,[[0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0,0,0]],0,0,0]]
    ENDPROC
    ! New routine here
    PROC newProc()
        ! Test
    ENDPROC
ENDMODULE
Is there any way of getting around this ReadStr() limitation of 80 chars? So the line is not chopped?
            Tagged:
            
        
0  
            Comments
- 
            Why not do the changes in RobotStudio and then save the modified file back to the controller?0
- 
            
 Because I want to be able to modify "HOME:/Recipes.mod" routine on-the-fly which is done on Flexpendant via UI interaction with user.graemepaulin said:Why not do the changes in RobotStudio and then save the modified file back to the controller?0
Categories
- All Categories
- 5.6K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 15 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.9K Robot Controller
- 363 IRC5
- 80 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 853 RAPID Programming
- 31 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 110 Collaborative Robots
- 5 Job listings
