browsing the user folder in the CF

rofever
2010-02-01
2010-02-11
  • rofever - 2010-02-01

    I am using a BoschRexroth L10

    Is there a function that will return the filenames in the user partition of the CF? I want to use this for example to show it on the operating panel and to choose the file that I want to open.

     
  • Avgur - 2010-02-02

    You should use functions from SysLibDir library to work with PLC's filesystem and SysLibFile library to handle file operations. Make sure these libraries are supported in your target system.

     
  • rofever - 2010-02-02

    This target uses SyslibfileAsync.lib but this is not the problem.

    My problem is to enter the filenames in an array without knowing their names and thus without knowing their addresses.

    The result must be to be able to browse the root directory on the CF from the HMI. Rexroth has such functionality inserted in some of their standard programs like Indramotion for Handling but it is very hard to follow the program because of all the structures from the specific program.

    My question is if someone else has managed to create such an application for listing the files.

     
  • Avgur - 2010-02-02

    Sorry, I was wrong and SysLibDir library doesn't solve your problem.

    Maybe your target system supports some library that can execute system commands. For example see the target Codesys SP PLCWinNT, library SysLibOS.lib, function Sys_Execute_Command```

    ( Execute system command and returns system result )
    FUNCTION Sys_Execute_Command : DINT
    VAR_INPUT
    Β  Β pszCommand : STRING;Β  Β ( COmmand line to execute as system command )
    END_VAR
    VAR
    END_VAR

    Try to execute system command to browse root directory, save the output to a file and then parse this file using SyslibfileAsync.lib functions.
    Example for windows-like platforms:```
    
    dir > somefile.txt
    

    Example for linux-like platforms:```

    ls -a > somefile.txt

    ```

    It's not elegant, but it should work.

     
  • rofever - 2010-02-10

    I just found my problem

    It seems that I will need a library like Syslibdir but one that works in async mode. There is such a thing?

     
  • Avgur - 2010-02-11

    All SysLib* libraries are platform-depended. Call your PLC manufacturer to get support.

     

Log in to post a comment.