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. KUKA Robot Forum
  5. Manuals, Software and Tools for KUKA Robots
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

Kuka tool no.3: Kuka Archiving Automation

  • asimo
  • May 1, 2009 at 7:53 PM
  • Thread is Resolved
  • asimo
    Guest
    • May 1, 2009 at 7:53 PM
    • #1

    Hi,

    I needed a tool to automate the archiving process for a KRC2 controller with v5.x software. So I did this small executable file which simulates the mouse clicks in order to trigger an "Archive->All" process. If you run it, you will notice that it simply simulates what you would do on a teach pendant. So if you want to use it to schedule your backups, you will have to use the Windows Scheduler (found under the "Panel Control" of Windows). But by default, the service is not running, so you will not be able to use the scheduler. To activate it, simply enable the service name called "Task Scheduler". You can find the service list again under the "Panel Control" then under "Administrative Tools" and "Services". Simply copy this executable file in a folder name of your choice under the C: drive for example and schedule something to run that executable file. Note that this will not work for OfficeLite, as I have program it for a KRC2 (v5.x) screen resolution and buttons positions.

    IMPORTANT NOTE: As usual, I offer no warranty (:icon_mrgreen:) and you should use this only if you know what you are doing.

    Hope this can be usefull to somebody else.

    Edited once, last by asimo (May 1, 2009 at 7:55 PM).

  • asimo
    Guest
    • May 6, 2009 at 4:13 AM
    • #2

    On SkyeFire suggestion to be able to archive with the robot name and the date, I have made this second executable file which rename an existing archive with the current robot name and date/time. The executable file can be anywhere, it don't have to be in the same folder as the archive. Simply execute it and the copy will be created. So, by combining the first one (kArchiveAll) with this one, you can full automate your backup process with an *history*. Simply execute this one some time after the archive process (i.e. 20 minutes after to be sure).

    Again, I hope this will be usefull to at least one person!

  • M.Ozkan
    Reactions Received
    22
    Trophies
    5
    Posts
    538
    • April 28, 2012 at 2:00 PM
    • #3

    You are not need mouse data logger.

    if you will use .bat file (Batch file just like MS-DOS commands like below) and this .bat file declare under windows scheduler you own your automatic backup program.

    copy C:\KRC\Roboter\KRC\R1\Program\abcd.src ---> ArchiveDrive:\abcd.src

    etc.

    I develop long time ago automatic backup program for Kuka and ABB Robots in Renault Plant for professional using.

    https://www.robot-forum.com/robotforum/kuk…cs-t3792.0.html

  • nikhilphuge
    Trophies
    2
    Posts
    4
    • January 24, 2022 at 12:22 PM
    • #4

    M.Ozkan Can you please share again

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,422
    • January 24, 2022 at 3:49 PM
    • #5
    Thread

    KR Plant Archiver

    KR Plant Archiver

    Description
    This application automatically or manually pulls archives from a configurable list of KRC4 robots. Execute the application automatically from a scheduled task manager using the following command line switches:

    /DAY {x} - (optional) This switch downloads the archive to the
    specified day. Example /DAY Wednesday

    /UNZIP {x} - (optional) This switch chooses whether to unzip the
    archive to the configured archive folder.
    …
    ofamous1
    November 26, 2013 at 4:10 PM
    Post

    RE: Kuka KRC4 Automatic Archive Backup

    Several years ago, I had an AutoIT script that would automate the Archive function for KSS 5.x, and later for KSS 8.x. It used the Windows Task Scheduler to execute periodically, and worked well. But at some point between KSS 8.2 and KSS 8.3 (probably at the change from WinXP to Win7), the Windows Task Scheduler quit working, even though the script still worked if executed manually. I never did manage to fix the Task Scheduler issue.

    This code hasn't been tested in quite some time, and of…
    SkyeFire
    May 11, 2021 at 3:11 PM
  • nikhilphuge
    Trophies
    2
    Posts
    4
    • January 29, 2022 at 8:45 AM
    • #6

    I need for KR C 2

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,422
    • January 29, 2022 at 2:45 PM
    • #7
    Quote from nikhilphuge

    I need for KR C 2

    Well, this is the most advanced "production" version I used in KRC2s. You'll need to change the Mask variables to match the pattern of your robot's Archive names.

    You will also want to check which numbers your File menu uses for Archive All -- I only ever used this script on KSS 5.X, so if your version of KSS is older, your FILE>ARCHIVE option might not be 3, it might be 2 or 4.

    You can uncomment the MsgBox lines temporarily in order to test how it's working. The log file generated to the Temp directory also tries to record enough data to help troubleshooting.

    You'll have to download AutoIT and use it to edit and compile this script. Then you can copy the .exe to the robot, and execute it. To execute it automatically, you'll need to set it up under Windows Task Scheduler in the robot.


    C
    ; AutoIT script to auto-backup KRC controllers in a journaling fashion
    ; v1.3
    ; v1.3 tries to use FileFindFirstFile and FileFindNextFile to get around the fact that FileExists cannot use Regular Expressions
    #include <Date.au3> ; 
    #include <File.au3> ;
    
    $LatestArchiveMask    = "VRC_R0?.zip"
    $ArchivePath           = "D:\Backups\"
    $ArchiveName           = ""
    $EarlierArchivesMask  = "VRC_R0*.zip"
    $ArchiveDestination   = ""
    $Overwrite            = 1
    $No_Overwrite         = 0
    $Extension            = ""
    $FileTime             = ""
    $RemotePath           = "U:\"
    $ItDoesExist          = False
    $szDrive              = ""
    $SzDir                = ""
    $szFName              = ""
    $szExt                = ""
    $LogFileName          = "JournalBackup.Log"
    
    $LogFileHandle = FileOpen (@TempDir & "\" & $LogFileName, 2) ; open logfile in erase-rewrite mode
    
    FileWriteLine ($LogFileHandle, @YEAR & "/" & @MON & "/" & @MDAY & "." & @HOUR & "." & @MIN & "." & @SEC)
    
    ; Remove previous backup
    ;MsgBox (0, "", "Searching for pre-existing archive, name: " & $ArchivePath & $LatestArchiveMask)
    $Search = FileFindFirstFile ($ArchivePath & $LatestArchiveMask)
    If $Search <> -1 Then
        $File = FileFindNextFile ($Search)
        If @error Then 
            ;MsgBox (0,"", "FileFindNextFile error'd out")
            Exit
        Else
            ;MsgBox (0, "", "FileFindNext Result is: " & $File)
            $LatestArchiveMask = $ArchivePath & $File
            _PathSplit ($LatestArchiveMask, $szDrive, $szDir, $szFName, $szExt)
            $ArchiveName = $szFName
            $Extension = $szExt
            $EarlierArchiveMask = $ArchivePath & $ArchiveName & "*" & $Extension
            ;MsgBox(0,"", "$ArchiveName=" & $ArchiveName & @CRLF & "$ArchivePath=" & $ArchivePath & @CRLF & "$Extension=" & $Extension & @CRLF & "EarlierArchive=" & $EarlierArchiveMask & @CRLF & "LatestMask=" & $LatestArchiveMask)
            ;MsgBox (0, "", "FOUND pre-existing archive, name: " & $LatestArchiveMask, 2)
            FileWriteLine ($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & ": Found Pre-existing Archive: " & $LatestArchiveMask)
            CopyToDatedFilename ($LatestArchiveMask, $RemotePath, $Extension)        
            ;MsgBox (0, "", "DELETING pre-existing archive, name: " & $LatestArchiveMask, 2)
            FileDelete ($LatestArchiveMask)
            ;MsgBox (0, "", "DELETED pre-existing archive, name: " & $LatestArchiveMask, 2)
            Sleep (1000)
        EndIf
    Else
        ;MsgBox(0,"","FileFindFirst failed")
        FileWriteLine($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & "No pre-existing archive found")
    EndIf
    
    ; Trigger KRC's integral Archive process
    WinActivate ("KUKA HMI", "")     ; make sure KRC HMI is active before Sending commands
    Sleep (500)
    WinWaitActive ("KUKA HMI", "")     ; make sure KRC HMI is active before Sending commands
    Send("{f9}")                      ; Key mapped to PROGRAM button
    Sleep (500)
    WinWaitActive ("KUKA HMI", "")     ; make sure KRC HMI is active before Sending commands
    Send ("{3}")                                        ; Key to Archive menu option
    Sleep (500)
    WinWaitActive ("KUKA HMI", "")     ; make sure KRC HMI is active before Sending commands
    Send ("{0}")                                        ; Key to Archive All option
    Sleep (500)
    WinWaitActive ("KUKA HMI", "")     ; make sure KRC HMI is active before Sending commands
    Send ("{f2}")                                        ; Key to answer "Yes" to "are you sure you want to do this?" prompt
    
    ;Sleep (10000)                                        ; Wait for Archive process to near completion before beginning file search
    
    $BackupDirectory = FileChangeDir ($ArchivePath) ; work in backup directory
    ;MsgBox(0,"","Current Working Directory: " & @WORKINGDIR, 1) ; debug
    
    ;Wait for Archive to exist
    $begin = TimerInit()
    $ItDoesExist = False
    While TimerDiff ($begin) < 600000 ; wait for HMI to finish creating standard archive
      If FileExists ($LatestArchiveMask) Then
        ;MsgBox (0,"","File Exists", 1)
        FileWriteLine($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & ": Found new arhive " & $LatestArchiveMask)
        $ItDoesExist = True ; success flag
        Sleep (1000)
        ExitLoop
        EndIf
        ;MsgBox (0,"","File not found at: " & TimerDiff($begin) & "ms", 5)
        Sleep (10000)
    Wend
    If Not $ItDoesExist Then
        ;MsgBox (0, "AutoBack Message", " to find " & $LatestArchiveMask)
        FileWriteLine($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & ": New archive not detected within time limit")
        Exit
    EndIf
    
    $search = FileFindFirstFile($ArchiveName & $Extension) ; locate most recent backup
    If not ($search = -1) Then
        ;MsgBox (0, "", "Found File at: " & $search) ; debug
    Else
        ;MsgBox (0, "", "Unable to find new Archive") ;debug
        Exit
    EndIf
    
    $file = FileFindNextFile ($search) ; get filename for file found by FindFirstFile function
    
    ;MsgBox (0,"Finding new archive","File Found: " & $file, 1) ; debug
    
    CopyToDatedFilename ($file, $RemotePath, $Extension) ; copy regular archive to dated archive
    
    ;MoveToRemoteDir($file, $RemotePath, $Extension) ; copy regular archive to appropriate remote directory
    
    Sleep (1000) ; keep file functions from stepping on each other
    
    DeleteOldFiles($ArchivePath, $EarlierArchivesMask, 30)
    
    FileClose ($LogFileHandle)
    
    Exit
    
    ;================================================================================================
    
    Func CopyToDatedFilename($OriginalFileName, $NewPath, $Ext)
        $FileTime = FileGetTime($OriginalFileName, 1, 0) ; retrieve creation date/time of file
        $FileTime2 =  FileGetTime($OriginalFileName, 1, 1) ; retrieve creation date/time of file
        Sleep (1000)
        If Not @error Then
            ;MsgBox (0, "CopyToDatedFileName", "$FileTime2 = " & $FileTime2)
            ;MsgBox (0, "CopyToDatedFileName", "$FileTime[0] = " & $FileTime[0] & " FileTime[2] = " & $FileTime[2])
        Else
          ;MsgBox (0, "CopyToDatedFileName", "FileGetTime Generated an @error response")
            FileWriteLine($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & ": FileGetTime failure")
          Exit
        EndIf
        $FileDestination = StringReplace($OriginalFileName, $Ext, "_" & $FileTime[0] & "_" & $FileTime[1] & "_" & $FileTime[2] & "_" & $FileTime[3] & "." & $FileTime[4] & $Ext, 1, 2) ; remove .zip extension, add "_YYYY_MM_DD_HH.MM", restore .zip extension
        ;MsgBox (0,"", "$FileDestination: " & $FileDestination, 2) ; debug
        FileCopy ($OriginalFileName, $FileDestination, $Overwrite) ; copy regular archive to new name in same directory
        FileWriteLine($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & ": Copied " & $OriginalFileName & " to " & $FileDestination)
        ;MsgBox (0, "", "$FileDestination: " & $RemotePath & $FileDestination, 2)
    ;    FileCopy ($FileDestination, $RemotePath & $FileDestination, $Overwrite) ; copy renamed file to remote backup directory
        If FileExists ($RemotePath) Then
            FileCopy ($OriginalFileName, $RemotePath & $FileDestination, $Overwrite)
            FileWriteLine($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & ": Copied " & $OriginalFileName & " to " & RemotePath & $FileDestination)
        EndIf
    EndFunc
    ;================================================================================================
    Func DeleteOldFiles($FilePath, $FileMask, $AgeLimit)
    
      $BackupDirectory = FileChangeDir ($FilePath)        ; work in backup directory
    
        $TodaysDateIs = (@YEAR & "/" & @MON & "/" & @MDAY)  ; set up for file-age calculation
    
        ;MsgBox (0,"","The Date is: " & $TodaysDateIs, 2)   ; debug
    
        $FindFile = FileFindFirstFile($FileMask)            ; find first file that matches correct pattern
        
        ;MsgBox (0,"Delete Old Files", $FindFile, 2)        ; debug
        
        If $FindFile = -1 Then
            Exit
        EndIf
        
        While 1
            $FindFileName = FileFindNextFile($FindFile)
            If @error Then ExitLoop
            If $FindFileName = "." Then ContinueLoop          ; blocks root directory, jumps to top of loop
            If $FindFileName = ".." Then ContinueLoop         ; blocks current directory, jumps to top of loop
            $FileDate = FileGetTime($FindFileName, 0, 0)      ; get time from found file
            ;MsgBox (0, "Delete Old Files", "File Name is: " & $FindFileName & "File Date is: " & $FileDate, 2)
            
            If Not @error Then
                $yymmdd = $FileDate[0] & "/" & $FileDate[1] & "/" & $FileDate[2]
                ;MsgBox (0, "Delete Old Files", "Adjusted File Date is: " & $FileDate, 2)
            EndIf
    
            $DateDiffTotal = _DateDiff('D', $yymmdd, $TodaysDateIs)
            ;MsgBox (0, "Delete Old Files", "Difference in days = " & $DateDiffTotal, 2) ;debug
            If $DateDiffTotal > $AgeLimit Then
                ;MsgBox (0, "Delete Old Files", $FindFileName & " is  " & $DateDiffTotal & " day(s) old and will be DELETED") ;debug
                FileWriteLine($LogFileHandle, @HOUR & "." & @MIN & "." & @SEC & ": Deleted " & $FindFileName & " at " & $DateDiffTotal & " days age")
                FileDelete($FindFileName)
            Else
                ;MsgBox (0, "Delete Old Files", $FindFileName & " is  " & $DateDiffTotal & " day(s) old and will be RETAINED") ;debug
            EndIf
        WEnd
    EndFunc
    ;================================================================================================
    Func MoveToRemoteDir()
    ; Copies dated backups to robot-specific remote directory based on archive Name
    ; Example: Robot_6_date.time.zip would be moved to RemoteRoot\Robot_6\ directory
    EndFunc
    Display More
  • nikhilphuge
    Trophies
    2
    Posts
    4
    • February 17, 2022 at 12:09 PM
    • #8
    Quote from SkyeFire
    Thread

    KR Plant Archiver

    KR Plant Archiver

    Description
    This application automatically or manually pulls archives from a configurable list of KRC4 robots. Execute the application automatically from a scheduled task manager using the following command line switches:

    /DAY {x} - (optional) This switch downloads the archive to the
    specified day. Example /DAY Wednesday

    /UNZIP {x} - (optional) This switch chooses whether to unzip the
    archive to the configured archive folder.
    …
    ofamous1
    November 26, 2013 at 4:10 PM
    Post

    RE: Kuka KRC4 Automatic Archive Backup

    Several years ago, I had an AutoIT script that would automate the Archive function for KSS 5.x, and later for KSS 8.x. It used the Windows Task Scheduler to execute periodically, and worked well. But at some point between KSS 8.2 and KSS 8.3 (probably at the change from WinXP to Win7), the Windows Task Scheduler quit working, even though the script still worked if executed manually. I never did manage to fix the Task Scheduler issue.

    This code hasn't been tested in quite some time, and of…
    SkyeFire
    May 11, 2021 at 3:11 PM

    Can you please share code for Mouse simulator

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,422
    • February 17, 2022 at 2:50 PM
    • #9
    Quote from nikhilphuge

    Can you please share code for Mouse simulator

    The code is in the post you quoted.

  • nikhilphuge
    Trophies
    2
    Posts
    4
    • March 3, 2022 at 9:55 AM
    • #10
    Quote from SkyeFire

    The code is in the post you quoted.

    Thank you for your response.

    But the code is not working with Task Windows XP Task Scheduler.
    but when i run exe file independently it runs fine.

  • hermann
    Reactions Received
    406
    Trophies
    9
    Posts
    2,607
    • March 3, 2022 at 12:03 PM
    • #11
    Quote from SkyeFire

    .. It used the Windows Task Scheduler to execute periodically, and worked well. But at some point between KSS 8.2 and KSS 8.3 (probably at the change from WinXP to Win7), the Windows Task Scheduler quit working, even though the script still worked if executed manually. I never did manage to fix the Task Scheduler issue...

    Did you read and understand the post?

  • H3nryk
    Trophies
    1
    Posts
    1
    • January 5, 2023 at 12:38 PM
    • #12
    Quote from asimo

    Hi,

    I needed a tool to automate the archiving process for a KRC2 controller with v5.x software. So I did this small executable file which simulates the mouse clicks in order to trigger an "Archive->All" process. If you run it, you will notice that it simply simulates what you would do on a teach pendant. So if you want to use it to schedule your backups, you will have to use the Windows Scheduler (found under the "Panel Control" of Windows). But by default, the service is not running, so you will not be able to use the scheduler. To activate it, simply enable the service name called "Task Scheduler". You can find the service list again under the "Panel Control" then under "Administrative Tools" and "Services". Simply copy this executable file in a folder name of your choice under the C: drive for example and schedule something to run that executable file. Note that this will not work for OfficeLite, as I have program it for a KRC2 (v5.x) screen resolution and buttons positions.

    IMPORTANT NOTE: As usual, I offer no warranty (:icon_mrgreen:) and you should use this only if you know what you are doing.

    Hope this can be usefull to somebody else.

    HI,

    Where can I download the "mall executable file which simulates the mouse click"

    mentioned by ASIMO?

  • panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,076
    • January 5, 2023 at 2:27 PM
    • #13

    you can make one yourselves using programming language of your choice. it simply uses Windows API. one convenient way to play with this is scripting. for example AutoIt3 comes with tons of examples and if needed, scripts can be compiled into EXE.

    example MuseClick.au3

    Code
    #include <AutoItConstants.au3>
    
    ; Double click at the current mouse position.
    MouseClick($MOUSE_CLICK_LEFT)
    MouseClick($MOUSE_CLICK_LEFT)
    
    ; Double click at the x, y position of 0, 500.
    MouseClick($MOUSE_CLICK_LEFT, 0, 500, 2)
    
    ; Double click at the x, y position of 0, 500. This is a better approach as it takes into account left/right handed users.
    MouseClick($MOUSE_CLICK_PRIMARY, 0, 500, 2)
    Display More

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

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