Good day everyone, after installing Directory Loader, we checked the example program attached in the manual, judging by the code, the addon should transfer the src file to a new one created, which will be named 1. It creates a folder, but does not copy the file there. KSS version 8.5.8. The most interesting thing is that it works great on KSS 8.6. What can be wrong? Thank you in advance!
Code
1 DEF DirectoryLoaderExample(PGNO:IN, OLD_PGNO:IN)
2 DESCRIPTION
34
INT PGNO ; New program number (program to load)
5 INT OLD_PGNO ; Old program number (program to delete)
67
; Declarations for CWRITE commands
8 DECL STATE_T STAT
9 DECL MODUS_T MODE
10
11 ; Declarations for string functions
12 INT OFFSET
13
14 ; Set DirectoryLoader variables
15 DLCopyToKrc = TRUE
16 DLEditModule = FALSE
17 DLEnableBackup = TRUE
18 DLDeleteTarget = TRUE
19 DLDeleteSource = FALSE
20 DLEnableAllOpModes = FALSE
21 DLResetTrigger = FALSE
22
23 ; DirectoryLoader already active?
24 IF (DLACT OR $FLAG[27]) THEN
25 RETURN
26 ENDIF
27
28 ; Only start DirectoryLoader in EXT mode
29 IF (NOT DLEnableAllOpModes AND NOT $EXT) THEN
30 RETURN
31 ENDIF
32
33 ; Stop and cancel running robot program
34 IF ($PRO_STATE1 <> #P_FREE) THEN
35 MODE = #SYNC
36
37 CWRITE($CMD, STAT, MODE, "STOP 1")
38 WAIT SEC 0.1
39
40 CWRITE($CMD, STAT, MODE, "CANCEL 1")
41 WAIT SEC 0.1
42 ENDIF
43
44 ; Build source directory string
45 IF (NOT STRCLEAR(DLSourceDir[])) THEN
46 ;******************************************
47 ;* Error clearing source directory string *
48 ;* Handle error! *
49 ;******************************************
50 ENDIF
51
52 OFFSET = 0
53 SWRITE(DLSourceDir[], STAT, OFFSET, "D:\DirectoryLoader\
%d\", PGNO)
54
55 ; Build target directory string
56 IF (NOT STRCLEAR(DLTargetDir[])) THEN
57 ;******************************************
58 ;* Error clearing target directory string *
59 ;* Handle error!
*
60 ;******************************************
61 ENDIF
62
63 OFFSET = 0
64 SWRITE(DLTargetDir[], STAT, OFFSET, "KRC:\R1\Program\%d
\", PGNO)
65
66 ; Build backup directory string
67 IF (NOT STRCLEAR(DLBackupDir[])) THEN
68 ;******************************************
69 ;* Error clearing backup directory string *
70 ;* Handle error!
71 ;******************************************
72 ENDIF
73
74 OFFSET = 0
75 SWRITE(DLBackupDir[], STAT, OFFSET, "D:\DirectoryLoader\
%d\Backup\", PGNO)
76
77 ; Start DirectoryLoader and stop submit interpreter
78 ;********************************
79 ;* Adjust to configured trigger *
80 ;********************************
81 $FLAG[27] = TRUE
82 END
1 GLOBAL DEF DirectoryLoaderSub()
2 DESCRIPTION
3
4; Init
5 INT PGNO, OLD_PGNO
6 PGNO = 2
7 OLD_PGNO = 1
8
9; Loop
10 IF ($FLAG[28] AND NOT DLACT) THEN
11 DirectoryLoaderExample(PGNO, OLD_PGNO)
12 ENDIF
13
14 IF ($FLAG[28] AND DLRDY AND NOT DLERR) THEN
15 ; -> DirectoryLoader finished
16 $FLAG[27] = FALSE
17 $FLAG[28] = FALSE
18 WAIT SEC 0
19 ENDIF
20
21 IF ($FLAG[28] AND DLERR) THEN
22 ; -> An error occurred on execution
23 ; -> Call error handling
24 $FLAG[27] = FALSE
25 $FLAG[28] = FALSE
26 WAIT SEC 0
27 ENDIF
28 END
Display More