1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. Fanuc Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

DELETE a FILE in MD: using KAREL(FILE NAME TOBE EXTRACTED FROM DATA STRINGS REGI

  • balajitdm2000
  • November 9, 2018 at 2:03 AM
  • Thread is Resolved
  • balajitdm2000
    Guest
    • November 9, 2018 at 2:03 AM
    • #1

    I'm Newbie to KAREL WORLD, Could somebody help me with the karel code to--

    Deleting a FILE in MD: using KAREL.pc program(FILE NAME TOBE EXTRACTED FROM DATA STRINGS REGISTERS)

    As a first step I am trying to create a .KL FILE in ROBOGUIDE9.0 to just delete a file using file name as below, I'm missing something need help to debug or correct code

    PROGRAM DELPRGLB
    VAR
    status : INTEGER -- The status returned from the built-in calls
    file_spec : STRING[30] -- The created file specification for DELETE
    BEGIN
    DELETE_FILE (MD:\BALA.TP, FALSE, status) -- Delete the file.
    IF (status <> SUCCESS) AND (status <> 10003) AND
    (status <> 85014) THEN
    WRITE (’ERROR ’, status,’ IN attempt TO delete ’,CR, file_spec,CR)
    ENDIF
    END DELPRGLB

    Edited once, last by balajitdm2000 (November 9, 2018 at 2:09 AM).

  • andreic
    Reactions Received
    24
    Trophies
    4
    Posts
    280
    • November 9, 2018 at 7:07 AM
    • #2

    Hello,
    I've adjusted the code a little:
    PROGRAM DELPRGLB
    VAR
    STATUS : INTEGER -- The status returned from the built-in calls
    file_spec : STRING[30] -- The created file specification for DELETE

    BEGIN
    DELETE_FILE ('MD:\BALA.TP', FALSE, STATUS) -- Delete the file.
    IF (STATUS <> 10003) AND (STATUS <> 85014) THEN
    WRITE ('ERROR', STATUS,'IN attempt TO delete',CR, file_spec,CR)
    ENDIF
    END DELPRGLB


    I have some remarks:
    1. Always format your code in order to look easier to read.
    2. You have to enclose MD:\BALA.TP in ' '.
    3. You must enclose ’ERROR ’ .. in ' ', not in ’ ’.
    4. Variable SUCCESS is not declared.

  • balajitdm2000
    Guest
    • November 13, 2018 at 1:02 AM
    • #3

    Awesome, Thank you very much Mr. Andreic, it worked.

    As I said as next step I want to choose\take the .TP file name for deletion from the char_array send from PLC.

    So I am thinking if I can modify the karel.pc with a dynamic String registers SR[1} (instead of a single definite file name) like the way I call in TP programs for program execution

    some thing like the attached Pictures


    Any Help :help:

    Images

    • SR.PNG
      • 6.19 kB
      • 390 × 69
      • 13
    • pgmcall.PNG
      • 20.05 kB
      • 577 × 330
      • 20

    Files

    SR.PNG_thumb 6.04 kB – 170 Downloads pgmcall.PNG_thumb 16.36 kB – 168 Downloads

    Edited once, last by balajitdm2000 (November 13, 2018 at 1:03 AM).

  • andreic
    Reactions Received
    24
    Trophies
    4
    Posts
    280
    • November 13, 2018 at 1:26 PM
    • #4

    Depending on your controller type you can use GET_STR_REG for getting string into a variable from SR[].
    You can set back the value in SR[] using SET_STR_REG.

  • balajitdm2000
    Guest
    • November 15, 2018 at 8:38 AM
    • #5

    Hi Andreic,

    Going back to our previous conversion on deleting programs, the karel P-code got generated and I was able to execute the pc program and the intended program got deleted successfully, and the program is no longer seen in Teach pendant.

    But I get an error " uninitialized data type used'. as attached in picture

    Is this because the file is deleted and our karel is still trying to return a status of ,' I am not sure.

    Images

    • delerror.PNG
      • 59.39 kB
      • 794 × 484
      • 22

    Files

    delerror.PNG_thumb 11.4 kB – 163 Downloads
  • andreic
    Reactions Received
    24
    Trophies
    4
    Posts
    280
    • November 15, 2018 at 1:50 PM
    • #6

    file_spec is uninitialized.
    In this case you can see in your program. But you also can check by pressing ENTER on KAREL prog and selectes DATA -> Karel Vars.
    You must set file_spec to whatever you want, I guess the path of your file, so:
    Add file_spec='MD:\BALA.TP' replace DELETE_FILE (MD:\BALA.TP, FALSE, status) with DELETE_FILE (file_spec, FALSE, status).

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download