RobotStudio event

Save Modules from RAM to path

Options
Hello,

I am working on IRC5 controller. I would like to know if there's a way to save and store on the hard drive disk all the files loaded (every .mod / .sys) to a path (eg HOME:/SAVE_TEST/) in order to call them with the automatic loading of modules.

In other words, is it possible to code/program a script (in rapid or other) to copy all the modules/files from controller ram to a directory on the hard drive disk ? (about the same it is used under OS PROMIA with the save modules menu).
And is it possible to call it  from the pendant (button / menu) or by external input ?

Comments

  • DenisFR
    Options
    Hello,
    In PROMIA you have to define which module to save with PERSOARP.sys:
      !============================================
      ! SAUVEGARDE PERSONNALSEE PAR LA TOUCHE SAUVE
      !============================================
      PROC SauvePerso()
        ! si sauvegarde par écran
        ! CheckFileSave "Sauve_Perso",0,MAINId\DirName\StDirName:="SITE","PRG_MVT"\ExtMOD;
        ! CheckFileSave "Sauve_Perso",0,MAINId\System,"DPUSER";
        ! CheckFileSave "Sauve_Perso",0,MAINId\SYSMOD,"DPUSER";
      ENDPROC

    So you can use ABB procedure:
    Save
    [[ ’\’ TaskRef ’:=’ <variable (VAR) of taskid>]
    |[ ’\’ TaskName’ :=’ <expression (IN) of string>] ’,’]
    [ ModuleName’ :=’ ] <expression (IN) of string>
    [ ’\’ FilePath’ :=’<expression (IN) of string> ]
    [ ’\’ File’ :=’ <expression (IN) of string>] ’;’

    You can know if module is modified with
    ModTimeDnum '('
    [ Object ':=' ] < expression (IN) of string>
    [ '\' StrDig ':=' < variable (VAR) of stringdig> ] ')'

    Else you can search for a module with:
    SetDataSearch
    [ Type ’:=’ ] < expression (IN) of string >
    [’\’TypeMod ’:=’<expression (IN) of string>]
    [’\’Object ’:=’<expression (IN) of string>]
    [’\’PersSym ]
    [’\’VarSym ]
    [’\’ConstSym ]
    [’\’InTask ]
    | [’\’InMod’ :=’<expression (IN) of string>]
    [’\’InRout ’:=’<expression (IN) of string>]
    [’\’GlobalSym ]
    | [’\’LocalSym]’ ;’

    To launch your instruction you can use trap or have an other task watching the DI.





  • Hello Denis !! Really thanks for your answer !!
  • Here is the code i am going to use according to your answer. I have tested and i use the automatic loading of modules for the P-start. For the moment, the procedure is called manually. I have stored the name of each modules in two arrays of string (one for all the .mod an another one for all the .sys)
    I have tried to search with the instruction setdatasearch but i did not success because i do not know what is the name of the data "module" to type in the first field of the instruction (SetDataSearch
    [ Type ’:=’ ] < expression (IN) of string >).

    Here is the code for the moment:

      PROC SaveModules(string TabNom{*}\ switch Prg | switch Sys)
        VAR string strExt:="";
        VAR errstr errstrError{5}:=["DEFAUT INCONNU","Sauvegarde Modules abandonnée","Sortie Prg...","Relancer PP=>Main...","-"];
       
        IF Present(Prg) strExt:=".mod";
        IF Present(Sys) strExt:=".sys";
        IF strExt="" RETURN;
       
        WaitUntil IsFile(LecteurSaveMod+"/"+RepSaveMod\Directory)=TRUE;

        nIdxTab:=1;
        WHILE nIdxTab<=Dim(TabNom,1) DO
          IF TabNom{nIdxTab}<>"" THEN
            IF ModExist(TabNom{nIdxTab})=TRUE THEN
              Save TabNom{nIdxTab}\FilePath:=LecteurSaveMod+"/"+RepSaveMod+"/"+TabNom{nIdxTab}+strExt;
            ENDIF
          ENDIF
          Incr nIdxTab;
        ENDWHILE
       
        ! Gestion Erreur
        ERROR
          TEST ERRNO
          CASE ERR_FILEACC:
            ! Création du répertoire
            MakeDir LecteurSaveMod+"/"+RepSaveMod;
            RETRY;
          DEFAULT: TRYNEXT;
            ErreurProcess\Defaut\Fatal,errstrError;
          ENDTEST
        !
        ! Fin SaveModules
        !
      ENDPROC

    Would have you an idea Mr DenisFR please :D ?