0% found this document useful (0 votes)
55 views71 pages

T b23 7 e ScreenWorks T (Macro)

The ScreenWorks-T Macro Manual provides essential information for safely operating the ScreenWorks-T product, including safety precautions and usage guidelines. It outlines macro functions, execution conditions, and programming details, emphasizing the importance of following the manual for safe operation. The document also includes a revision history and related instruction manuals for comprehensive user support.

Uploaded by

Leonette
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views71 pages

T b23 7 e ScreenWorks T (Macro)

The ScreenWorks-T Macro Manual provides essential information for safely operating the ScreenWorks-T product, including safety precautions and usage guidelines. It outlines macro functions, execution conditions, and programming details, emphasizing the importance of following the manual for safe operation. The document also includes a revision history and related instruction manuals for comprehensive user support.

Uploaded by

Leonette
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

ScreenWorks-T

Macro Manual

Operation Manual
FOREWORD
Thank you very much for purchasing our ScreenWorks-T.

■ For safety use of this product, read carefully this manual and other related individual instruction
manuals. Furthermore, keep these manuals at an easily accessible place so as to be ready for
reading any time as necessary.

■ Distributor or dealer of this product is kindly requested to hand over this manual to end user
without fail.

■ This product is protected by Japanese copyright laws. It is strictly prohibited to use or copy the
whole or a part of this software without the permission of the manufacturer.

■ MITSUBISHI ELECTRIC ENGINEERING CO.,LTD. is not responsible for any consequence


resulting from the use of this software and the manual.

■ The specifications of this software and the topics described in this manual are subject to change
without notice.

ScreenWorks is registered trademark of MITSUBISHI ELECTRIC ENGINEERING CO.,LTD..


Microsoft, MS, MS-DOS, Windows, and Windows 2000/XP/Vista/7/8.1/10 are registered
trademarks of Microsoft Corporation in the United States of America and other countries.
Other company and product names appearing herein are trademarks or registered trademarks of
their respective companies.
Hereafter, ScreenWorks-T is described as ScreenWorks.

About the notation


When using a product, the item of the required following is described.

Point
The supplementary information about operation, description, and a setup is described.

Point

Note
When using a product, in order that a user may ensure safety, the cautions about handling have described
the required item.
The important information about operation, description, and a setup is described.

Note

i
FOR SAFETY OPERATION
When using ScreenWorks, read the manual included with each product as well as any related
manuals described therein. Observe all safety precautions when using ScreenWorks.
The safety precautions described herein are ranked as "Cautions".

The term "Caution" is applied in situations when improper handling of a


product could result in injuries of medium severity, light wounds, and/or
property damage.

□ Use this product under an environment which meets the


environmental general specification specified in this Manual.

□ Topics described under the "Caution" heading may, depending


On the situation, have severe consequences.
All of the safety precautions contain very important information.
Make sure to follow those directions carefully.

□ Keep the manuals of this product readily available for


referencing as required, and make sure that they are provided
to the end-user of this product.

□ Configure an interlock circuit on the program by using


communication status information, so that the system will
function safely in the event of an ScreenWorks communication
fault. Illegal output or malfunction may lead to accidents.

Product Application
・ This product is neither designed nor manufactured for the purpose of being used in devices or
systems in life-threatening situations.
・ Ask our customer service any questions regarding special usage of this product in devices or systems,
including but not limited to the following fields: vehicle, medical equipment, aerospace related,
nuclear related, electric power generation and relays stations of a sub-marine cable.
・Although this product was manufactured under strict quality standards, safety devices must be
installed when it is used in conjunction with other equipment and when a malfunction could lead to
a severe accident and serious damage.

ii
Revision history of instruction manual
The revision code of the instruction manual is described as a part of the control number on the
back cover of the instruction manual.

Instruction Manual No.

T - B23 - * - E

N:Japanese , E:English
Series No. Revision code

Revision No. Date of Revision Content of revision


1 August 2011 1st Edition

2 May 2012 TOYODA brand logo added on the front cover


Added description of a large message box for
3 August 2013 MSGBOX.
front cover
4 December 2013
Format unification
5 May 2018 Windows10 added on the supported OS

6 November 2019 Corrected description of GETNUMVAL instruction

7 April 2022 TOYODA brand logo removed

COMPOSITION OF RELATED INSTRUCTION MANUAL


Instruction
manual Name Overview
number
ScreenWorks-T
The fundamental handling of ScreenWorks-T Builder, a
T-B20N (BUILDER)
function, specification, etc. are explained.
Operation manual
ScreenWorks-T (Install) Installation uninstallation of ScreenWorks-T Builder and
T-B21N
Operation manual the starting / end method are explained.
ScreenWorks-T (Tutorial) The operation method of ScreenWorks-T Builder and the
T-B22N
Operation manual function are explained while creating a sample screen.
ScreenWorks-T
The outline of the reference function of ScreenWorks-T is
T-B24N (Reference)
explained.
Operation manual

iii
CONTENTS
・ Introduction
・ Notes for Safe Use
・ Instruction manual revision history
・ Related manuals

1. Macro Functions: An Overview ......................................................................................................................... 1-1


1.1. What is a Macro? ......................................................................................................................................... 1-1
1.2. Macro Execution Conditions ........................................................................................................................ 1-1
1.3. Macro Programming ................................................................................................................................... 1-11
2. Function Description ......................................................................................................................................... 2-1
2.1. Function Arguments Table ........................................................................................................................... 2-1
2.2. Function Details ........................................................................................................................................... 2-6
3. Error Messages ................................................................................................................................................. 3-1
3.1. Error Messages ............................................................................................................................................ 3-1
Appendix-1 DLL for DFC Commands ..................................................................................................... Appendix1-1

C-1
1. Macro Functions: An Overview
This chapter describes an overview of basic instructions and settings of macro programming.

1.1. What is a Macro?


The macro function allows the user to create and add simple programs for functions not included in the
basic ScreenWorks functions, such as arithmetic operations, file processing, and the decision making.

A single macro can contain up to 1024 characters or numbers. A linefeed is counted as two characters.
There is no limit on the number of lines you can have.

Example:

’max. input ... 9 characters + linefeed (2 characters), count comments.

$W0 = 10; ... 7 characters + linefeed (2 characters)

STRCPY ($W10, “ABCDE”); ... 21 characters

This macro contains 41 characters.

1.2. Macro Execution Conditions


The timing for executing a macro is referred to as the macro execution condition. Macro functions can be
registered in projects, on screens, and in functional objects. The execution conditions for each of these can
be selected.
Macro execution conditions vary for each object. The following describes each of the conditions.

Execution conditions for projects


The following are the macro execution conditions available for a project.
Select an execution condition and create a macro from the [Macro] tab of the [Project Properties] in the
[Settings] menu.
For details on how to do this, refer to “Registering to a project” of “6-1 Registering Macros” in the
ScreenWorks BUILDER manual.

Macro execution
Description
condition
When Loading a Project Executes immediately before opening the project and loading the initial
screen.
When Unloading a Executes immediately before exiting the project.
Project
Fix cycle Executes in specified intervals. The interval range is between 100msec
and 600,000 sec (10 min.) in units of 100msec.
Fix cycle from the Starts executing at a specified time in specified intervals. Specify the hour
specified time and minutes for the time. The interval range is between 1 minute to 1,440
minutes (24 hours), adjustable in units of 1 minute.
Alarm/Event ON Timing Executes when an alarm occurs.
Alarm/Event OFF Timing Executes when an alarm is deactivated.

1-1
Note
The operation of large processes such as displaying or communication can disrupt and lengthen
the intervals of the [Fix cycle] or [Fix cycle from the specified time] options of the execution
condition.
Therefore, perform processes that require short and precise intervals in external devices or other
applications.

Executed

Macro function
Executed

Other task

1-2
Execution conditions for screens
The following are the macro execution conditions available for a screen.
Select an execution condition and create a macro from the [Macro] tab of the [Screen Properties] in the
[Settings] menu.
For details on how to do this, refer to “Registering to a Screen” under “6-1 Registering Macros” in the
ScreenWorks BUILDER manual.
Macro Execution
Description
Condition
When Loading a Screen Executes immediately before opening and displaying the screen.
When Unloading a Screen Executes immediately before closing the screen and switching a page.
Fixed Cycle Executes in specified intervals. The interval range is between 100msec
and 600,000 msec (10 min.), adjustable in units of 100msec.

Execution conditions for functional objects


The following are the macro execution conditions available for a functional object. Select an execution
condition and create a macro from the [Macro] tab in the [Properties] dialog box of each functional object.
For details on how to do this, refer to “Registering to a functional object” under “6-1 Registering Macros” in
the ScreenWorks BUILDER manual.
Macro Execution
Description
Condition
Touch ON Timing Executes the moment a functional object is pressed.
Touch OFF Timing Executes the moment a functional object is released.
Before inputting Executes immediately before displaying the keypad or virtual
string/numeral keyboard used for numeral and string input.
Before writing Executes immediately before sending the numeral and string input to
string/numeral an address.
After writing Executes immediately after sending the numeral and string input to an
string/numeral address.
When changed Executes when the value of the address changes.
string/numeral
When list is Executes immediately after a list is selected, and a list is selected in a
selected combo box.
When pressing an Executes the moment the display area of the alarm display is
alarm display area pressed.
When selecting an Executes immediately after selecting each alarm/event displayed in
Alarm/Event [Alarm/Event Summary&History].
After data block Executes immediately after each data block is selected.
selected
When bit field was Executes the moment the field, which sets the data format of the
touched ON/OFF Button in the data block table, is pressed.

1-3
The following are the execution conditions available for each functional object.

After writing string/numeral


Touch ON Timing

Before inputting

After data block


When changed

string/numeral
string/numeral

string/numeral

Before writing

When bit field


was touched
When list is
Touch OFF

selected

selected
Timing
Functional object

ON/OFF Button   − − − − − − −
Word Button   − − − − − − −
Command Button   − − − − − − −
Bit Lamp − −  − − − − − −
Word Lamp − −  − − − − − −
Numeral Display&Input − −     − − −
String Display&Input − −     − − −
Thumbwheel Switch − −    − − −
Label − − − − − − − − −
List Selection − − − − − −  − −
Level Meter − − − − − − − − −
Broken-line Graph − − − − − − − − −
Bitmap − − − − − − − − −
Analogue Meter − − − − − − − − −
Date − − − − − − − − −
Time − − − − − − − − −
Data Log Display − − − − − − − − −
Data Block Table − − −    − − 
Data Block Selector − − − − − − −  −
Data Block Field   − − − − − − −
Data Block Command   − − − − − − −

[Alarm/Event Objects]
When pressing When selecting
Functional Object
a display area an Alarm/Event
Alarm/Event Display  −
Alarm/Event Summary&History − 
The execution timing for each functional object is described below.

1-4
Macro executions for write button type functional objects
• ON/OFF Button
• Word Button
Stops macro and
object write
processes when
macro function
RETURN is
executed with an
argument value
other than zero.

Selects a menu Executes the write


when the word Executes “Touch process when Executes “Touch
button pop-up ON Timing” specifying shared OFF Timing”
menu is macro. memory for the macro.
displayed. address.

Turns on the write


Displays write communication Executes the write
Displays
Click the confirmation request flag when communication of
password input
functional object. dialog box. specifying a local the local address.
dialog box.
address (*1) for
the address.

Stops object write


processes when Aborts the writing
input is cancelled to the object if
or when there is “No” is selected.
an input error.

∗1:A local address is any address other than those for shared memory, such as the address for
an external device.

1-5
Macro executions for process button type functional objects
 Command Button
 Data Block Command
Stops macro and
object write
processes when
macro function
RETURN is
executed with an
argument value
other than zero.

Executes “Touch Executes “Touch


ON Timing” OFF Timing”
macro. macro.

Displays Executes the


Click the
password input process of the
functional object.
dialog box. functional object.

Stops object
processes when
input is cancelled
or when there is
an input error.

1-6
Macro execution timings for numeral/string input type functional objects
• Numeral Display&Input
• String Display&Input
• Data Block Field
• Data Block Table

Stops macro Stops macro


and object and object
write write
processes processes
when macro when macro
function function
RETURN is RETURN is
executed executed
with an with an
argument argument
value other value other
than zero. than zero.

Executes
Executes the write
macro Executes process Executes
“before “Before when “After
inputting” writing” specifying writing”
macro. macro. shared macro.
memory for
the address.

Turns on the
write Executes
Displays Opens the Checks
Displays communica-ti the write
Click the
password input input range
write on request communi
functional
input dialog keyboard. (for inputting
confirmation flag when ca-tion of
object.
box. numeral)
dialog box specifying a the local
local address.
address for
the address.

Stops object processes


Stops object write
when input is cancelled
processes when “No”
or when there is an input
is selected.
error.

1-7
Macro execution timings for value/string monitor type functional objects
• Bit Lamp
• Word Lamp
• Numeral Display&Input (When changing values)
• String Display&Input (When changing values)
• Thumbwheel Switch (When changing values)

Executes
“When
Changing
Value” macro.

Compares
Executes previous values Updates display Executes
communication for each with the read communication
(read). functional value. (read).
object.

Nothing
happens if the
value does not
change.

Point
As for the "When Changing Value" macro, only the screen where the corresponding object is placed
becomes effective.
When executing "When changing Value" macro on the multi-screen which are placed in the sheet
screen, it is likely not to work normally as switching the screen.
In that case, use fixed period macro of project.

1-8
Macro executions for list type functional objects
• List Box
• Alarm/Event Summary&History
• Data Block Selector

Stops macro and


object write processes
when macro function
RETURN is executed
with an argument
value other than zero.

Executes “When list is selected” (List Selection)


“When Selecting an Alarm/Event” (Alarm/Event
Summary&History) or “After been selected” (Data
Block Selector) macro.

Click the selection Displays


Executes process
bar for the password input
after selection.
functional object. dialog box.

Stops object
processes when
input is cancelled
or when there is
an input error.

Macro executions for alarm display functional objects


• Alarm/Event Display

Stops macro and


object write
processes when
macro function
RETURN is
executed with an
argument value
other than zero.

Executes “When
Pressing a Display
Area” macro.

Displays Executes
Click the
password input processes for
functional object.
dialog box. functional objects.

Stops object
processes when
input is cancelled
or when there is
an input error.

1-9
Macro executions for Thumbwheel Switch functional objects
• Thumbwheel Switch

Stops macro and


object write
processes when
macro function
RETURN is
executed with an
argument value
other than zero.

Executes the write


process when
Executes “Before Executes “After
specifying shared
writing” macro. writing” macro.
memory for the
address.

Turns on the write


communication Executes the write
Displays Displays write
Click the request flag when communication of
password input confirmation
functional object. specifying a local the local address.
dialog box. dialog box.
address for the
address.

Stops object
processes when Stops object write
input is cancelled processes when
or when there is “No” is selected.
an input error.

1-10
1.3. Macro Programming
This section describes the statement and syntax of macro programming.

Programming syntax

Program separator
A programming line must end with a semicolon ( ; ). However, the lines for IF ( ), ELSE, ELSEIF ( ) and
ENDIF ( ) do not end with a semicolon. In addition, FOR ( ) and NEXT do not require a semicolon if there
is no other operation on the same line.
Example:
CW0 = 2;
IF(CW0 >= 10 )
CW5 = CW0-CW2;
ELSE
CW5 = CW0+CW2;
ENDIF

Comments
To write a comment in a program, put an apostrophe ( ’ ) at the beginning of the sentence. The comment
starts at the apostrophe and ends at the end of the line.
Example:
CW0 = 100; ’comment
’comment
IF(CW1== 200)

.....

Writing programming statements


The programming statements used in this program are not case sensitive; therefore, you may write them
with or without upper case letters.
You may also mix upper case and lower case letters within a statement for clarity. There is no restriction
on the number of digits for the address, and you are free to use zeros as placeholders or not.
•“MovePopwDown( )” and “MOVEPOPWDOWN( )” are both processed as the same function.
•“CW002” and “cw2” are both processed as the same address.

1-11
Programming statements
The following describes the statements used in this function.

Variables
The variable types used in a macro program are shown below.

Item Description
Shared memory CB, CW:
Bit The allotted range depends on the setting of
CB (including the system “Shared memory (Number of points to be
CB) used)” field in the [Initial Setting] tab of the
SB [RUN parameter setting] dialog box
Word ([Settings] − [RUN parameter setting].
CW (including the system SB:SB0 to SB2047
CW) SW:SW0 to SW2047
SW
Example:
CW100 = CW0 + 1; ’The sum of CW0 + 1 is set to CW100
Index variable Modifies the index for bit variables and word variables. By adding this to the end of
an address, it is processed as an address of [the specified address + the value of
the index variable].
There are ten points: I0~I9.
Example:
I0 = 20;
CW0I0 = 123; ’operates as CW20 = 123

1-12
Variable qualifiers
Variable qualifiers are written as shown below.
Qualifiers are used for processing 32 bit data or handling numeric values of bit variables.

Item Description
Long (32-bit) access of a Adds an L after the variable name. This uses two words.
word variable (16-bit)
CW0L = 1000000; ’accesses CW0 and CW1 as 32-bits
CW100L = 1000∗1000;’accesses CW100 and CW101 as 32-bits

Numeral access of bit Adds an ‘:n’ after the variable name. The ‘n’ specifies the number of
variables bits. Up to 32 bits can be specified in increments of 4 bits.
If n = 16, put a W at the end. If n = 32 put an L at the end.

CB0:4 = 3:sets 3 (0011) for the four bits of CB0 to CB3


CB0W = 12345;sets 12345 (0011000000111001)to the 16 bits of
CB0 to CB15

Point
This macro automatically converts the data type of the right side to the data of the left side. If the
data type on the left side is smaller, the data on the right side is automatically cut off.
Example:
CW10L = CW0; ’the value of CW0 is set to CW10 and CW11
CW0 = CW10L; ’the value of CW10 is set to CW0

Constant
The following describes the constants used in a macro program as well as their syntax.
Item Description
Decimal constant When using word data (16-bit) − 32768 to 32767
When using 2 word data (32-bit) − 2147483648 to 2147483647
Hexadecimal When using word data (16-bit) H0 to HFFFF
constant When using word data (32-bit) H0 to HFFFFFFFF
Floating point The range of double
String In double quotations.
Example: “ABCDE”

1-13
Decision structure
The syntax used for conditional programming is shown below.
Item Description
IF IF and ELSEIF are followed by the conditional expression in ( ). The IF statement
ELSEIF must end with ENDIF. The statement can be nested up to eight levels.
ELSE
ENDIF Example:
IF (CW100 == 1) ’if CW100 is equal to 1
CW99 = 1;
ELSEIF (CW100 == 2)’if CW100 is equal to 2
CW99 = 2;
ELSE ’if CW100 is something other than 1 and 2
CW99 = 3;
ENDIF;

Conditional expressions
The conditional expressions used for IF statements are shown below.
Item Description
A == B True when A and B are equal
A>B True when A is greater than B
A >= B True when A is equal to or greater than B
A<B True when A is smaller than B
A <= B True when A is equal to or smaller than B
A <> B, True when A and B are not equal
A != B
A && B True when condition A and condition B are both true (AND)
A AND B
A || B True when condition A or condition B is true (OR)
A OR B

1-14
Program structure
The syntax used for program structure is shown below.
Command Description
RETURN Ends the macro. If a macro does not have the RETURN command, the
program will execute to the end. If a value other than 0 is returned from a
macro that is allocated to a functional object, the following process is
aborted.

Example:

RETURN(0) ;
CW100 = 0; ’This line is not executed

FOR, NEXT Repeats the specified code between FOR and NEXT. The statement can be
nested up to eight levels.

Example:
FOR(5)
CW100 = CW100 + 1;
NEXT; ’Repeats the FOR~NEXT statement five times

FOR, BREAK Aborts the loop of the program.

Example:
FOR(3)
CW100 = CW100 + 1;
IF (CW100>10 && CB100 == 1)
BREAK;
ENDIF ’The FOR loop ends if CW100>10 and CB100 == 1
NEXT;
FOR, CONTINUE Repeats the program.
Example:
FOR(3)
IF (CW100 == 1)
CONTINUE;
ENDIF
NEXT
’If CW100=1 is true, go back to the beginning of the FOR loop

1-15
Basic operation instruction
The basic operation command used in a macro program are shown below.
Item Symbol Example Definition
Assignment = A=B Assigns the value of B to A.
Addition + C =A+ B Sets the sum and A+B to C.
Subtraction - C =A- B Sets the value of A-B to C.
Multiplication ∗ C =A∗ B Sets the value of A x B to C.
Division / C =A/ B Sets the value of A/B to C.
Remainder % C =A% B Sets the remainder of A and B to C.
Logical-sum | C=A|B Applies the operation OR of A and B to C.
Logical-product & C =A& B Applies the operation AND of A and B to C.
Negation ! C=!A Sets the opposite value of A to C.
Exclusive-OR ^ C = A^ B Applies the exclusive-OR comparison of A and
B to C.
Complement of 1 ~ B=~A Sets the compliment of A to B.
Bitwise Left Shift << C = A << B Shifts the bit of B positions to the left and sets
the value to C.
Bitwise Right Shift >> C = A >> B Shifts the bit of B positions to the right and sets
the value to C.
Multiple operators can be used in any combination.
Example:
A = (B + C)∗(D+E/2)

The operator priority is shown below.


Item Symbol
High ()
~,!
∗,/,%
+,-
<< , >>
&
ˆ
|
Low =

Point
For the calculation result of division, truncate decimal place.

1-16
Function list
The functions used in a macro program are shown below.
Function Function name
String ←→ numeric String type Numeral type
value Decimal 16-bit length ATOI/ATOIW
conversion String →
32-bit length ATOL /ATOLW
numeric value
Hexadecimal 16-bit length HTOI/HTOIW
32-bit length HTOL/HTOLW
String type Numeral type
Decimal 16-bit length ITOA/ITOAW
Numeric value
32-bit length LTOA/LTOAW
→ string
Hexadecimal 16-bit length ITOH/ITOHW
32-bit length LTOH/LTOHW
BCD ←→ BIN Numeric value (BIN code) → BCD code BCD
conversion BCD code → numeric value (BIN code) BIN
Upper case ←→ lower Upper case → lower case STRLWR/STRLWRW
case conversion Lower case → upper case STRUPR/STRUPRW
Copy all Copies bits BITCPY
Copies words MEMCPY
Set all Sets bits BITSET
Sets words MEMSET
String operations Copies string STRCPY/STRCPYW
Compares string (case sensitive) STRCMP/STRCMPW
Compares string (not case sensitive) STRICMP/STRICMPW
Attaches strings STRCAT/STRCATW
String length STRLEN/STRLENW
Takes specified number of characters from the STRLEFT/STRLEFTW
string starting from the left
Takes specified number of characters from the STRMID/STRMIDW
string starting from the specified position
Takes specified number of characters from the STRRIGHT/STRRIGHTW
string starting from the right
Deletes left spaces STRLTRIM/STRLTRIMW
Deletes left and right spaces STRTRIM/STRTRIMW
Deletes right spaces STRRTRIM/STRRTRIMW
Returns the first character code of the specified ASC/ASCW
string
String operations Converts the string from multi-byte code to STRM2W
unicode
Converts the string from unicode to multi-byte STRW2M
code
Statistic Average AVERAGE
Sum SUM
Sort (ascending) USORT
Sort (descending) DSORT
Maximum value GETMAX
Minimum value GETMIN
Compare values Returns the larger value MAX
Returns the smaller value MIN

1-17
Function Function name
Arithmetic operations Absolute value ABS
Exponentiation POW
Time Obtains the current time (elapsed seconds) TIME
Converts the elapsed seconds to mm/dd/yy LOCALTIME
hh:mm:ss
Converts the mm/dd/yy hh:mm:ss to elapsed MKTIME
seconds
Converts seconds to hh:mm:ss SEC2HMS
Sets the time SETTIME
Data block Loads the data block LOADDB
Saves the data file SAVEDB
Writes to the data block record WRITEDB
Reads the data block record READDB
Selects record in data block SELECTDBREC
Gets record number in data block GETDBREC
Alarm/event Saves the alarm/event history data SAVEALARMLOG
History Clears the alarm/event history data RSTALARMLOG
Restarts the alarm/event count RSTALARMCNT
Macro error log Saves the macro error log SAVEERRORLOG
Restarts the macro error log RSTERRORLOG
Operation log Saves the operation log SAVEOPELOG
Restarts the operation log RSTOPELOG
Data log Stops the data log STOPDATALOG
Starts the data log STARTDATALOG
Saves the data log SAVEDATALOG
Clears the data log RSTDATALOG
HMI exclusive Obtains numeric values to be written, and GETNUMVAL
commands changed values
Switches screen SHOWPAGE
Moves the object display area MOVEPARTS
Displays the message dialog box MSGBOX
Sends the label character code SENDCAPTION
HMI Exclusive Sends the character code SENDKEY
Commands Makes a hard copy of the screen SENDSTR
HMI Exclusive
Obtains the display field of the object HARDCOPY
Commands
Redraws the specified rectangular area GETPARTS
Resizes the outer frame of the object REDRAW
Switches the specified functional object to RESIZEPARTS
input mode
Sets the coordinate origin for the view position SETFOCUS
of the object on the screen
Sends the display command to the specified SETVIEWPOS
functional object
Sends the click event to the specified page SENDCMD
Reverses operation screen CLICKEVEVT
Forwards operation screen PREVPAGE
Moves the pop-up screen NEXTPAGE
Moves the pop-up screen up MOVEPOPW
Moves the pop-up screen down MOVEPOPWUP

1-18
Function Function name
Moves the pop-up screen to the left MOVEPOPWDOWN
Moves the pop-up screen to the right MOVEPOPWLEFT
Closes the pop-up screen MOVEPOPWRIGHT
Finds a screen name CLOSEPOPW
Maximizes the specified screen WINFIND
Minimizes the specified screen WINMAX
Moves the specified screen to the front WINMIN
Exits the specified screen WINTOP
Starts the application WINTERM
Calls the DLL EXEC
Sends the character code DFC

1-19
2. Function Description
This chapter describes how to use the basic functions.
2.1. Function Arguments Table
The following are the variable and value types that can be specified as arguments of a macro function.
The letters used in the argument examples (e.g. S, D, n, x, y) represent the parameters used in the
“Format” section of each function detail.
Shared memory

specification
Constant
specification

External
Floating
Variable

address

INDEX
String
point
Function name

Digit
CB CW
SB SW

ABS S    
ASC (W) S   
ATOI (W) S   
ATOL (W) S   
AVERRAGE S   
n    
BCD S    
BIN S     
BITCPY D 
S 
n    
BITSET D 
c  
n    
CLICKEVENT n    
x    
y    
CLOSEPOPW n    
DFC S1   
S2   
DSORT D   
S   
n     
EXEC S1   
S2   
S3    
GETDBREC n    
GETMAX S   
n    

2-1
Shared memory

specification
specification

Constant

External
Floating
Variable

address

INDEX
String
point
Digit
Function name CB CW
SB SW

GETMIN S   
n    
GETNUMVAL - - - - - - - - -
GETPARTS n    
Left,
Top,
 
Right,
Bottom
HARDCOPY S   
HTOI(W) S   
HTOL(W) S   
ITOA(W) D  
S    
ITOH(W) D  
S    
LOADDB n    
LOCALTIME D  
S   
LTOA(W) D  
S    
LTOH D     
S     
MAX S1     
S2     
MEMCPY D   
S   
n    
MEMSET D   
c   
n    
MIN S1     
S2     
MKTIME S  
MOVEPARTS n    
x    
y    

2-2
Shared memory

specification
specification

Constant

External
Floating
Variable

address

INDEX
String
point
Digit
Function name CB CW
SB SW

MOVEPOPW n    
x    
y    
MOVEPOPWDOWN n    
y    
MOVEPOPWLEFT n    
x    
MOVEPOPWRIGHT n    
x    
MOVEPOPWUP n    
y    
MSGBOX S1   
S2   
S3    
NEXTPAGE - - - - - - - - -
POW S1     
S2     
PREVPAGE - - - - - - - - -
READDB n     
REDRAW Left,
Top,
   
Right,
Bottom
RESIZEPARTS n    
Left,
Top,
   
Right,
Bottom
RSTALARMCNT S    
RSTALARMLOG S    
RSTDATALOG n    
RSTERRORLOG - - - - - - - - -
RSTOPELOG - - - - - - - - -
SAVEALARMLOG S     
SAVEDATALOG n    
SAVEDB n    
SAVEERRORLOG - - - - - - - - -

2-3
Shared memory

specification
specification

Constant

External
Floating
Variable

address

INDEX
String
point
Digit
Function name CB CW
SB SW

SAVEOPELOG - - - - - - - - -
SEC2HMS D  
S   
SELECTDBREC n1    
n2    
SENDCAPTION - - - - - - - - -
SENDCMD W    
n    
S    
SENDKEY S    
SENDSTR S   
SETFOCUS S    
SETTIME S 
SETVIEWPOS x    
y    
SHOWPAGE S    
STARTDATALOG n    
STOPDATALOG n    
STRCAT(W) D  
S   
STRCMP(W) S1, S2   
STRICMP(W) S1, S2   
STRCPY(W) D  
S   
STRLEFT(W) D  
S   
n    
STRLEN(W) S   
STRLTRIM(W) D  
S   
STRLWR(W) D  
S   
STRMID(W) D  
S   
n1,n2    

2-4
Shared memory

specification
specification

Constant

External
Floating
Variable

address

INDEX
String
point
Digit
Function name CB CW
SB SW

STRM2W D  
S   
STRRIGHT(W) D  
S   
n    
STRRTRIM(W) D  
S   
STRTRIM(W) D  
S   
STRUPR(W) D  
S   
STRW2M D  
S   
SUM S   
n    
TIME D  
USORT D   
S   
n    
WINFIND S1  
S2   
WINMAX S1  
S2    
WINMIN S1  
S2     
WINTERM S1  
S2    
WINTOP S1  
S2    
WRITEDB n    

2-5
2.2. Function Details
This section describes the basic function details used in macro programming.

ABS Absolute value

Format ABS(S)

Function Returns the absolute value of S.

Return Value Absolute value

Exampl CW0 = ABS (CW1); ’Sets the absolute value of CW1 to CW0

ASC(W) Returns the first character code of the specified string

Format ASC(S)  Multi-byte code


ASCW(S)  Unicode

Function Returns the first character code of string S.

Return Value Character code

Exampl CW0 = ASC(“ABC”); ’Sets A (= 65) to CW0.

Decimal string →
ATOI(W)
numeric value (16-bit) conversion

Format ATOI(S) ⋅⋅⋅ Multi-byte code


ATOIW(S) ⋅⋅⋅ Unicode

Converts a decimal string to a 16-bit numeric value.


Function
The conversion takes place from S until "-" or a non-numeral character is
found in the string.
The conversion range is -32,768 to 32,767.
If a string exceeding this ranbge is specified, the exceeding digits are
truncated. If the string might exceed the range, use the ATOL ( ) function.

Return Value Numeric value (16-bit)

STRCPY (CW0, “1234”);


Example
’Sets the “1234” string to CW0 to CW2.
CW10 = ATOI(CW0);
’Sets the numeric value 1234 to CW10.

2-6
Decimal string →
ATOL(W)
numeric value (32-bit) conversion

Format ATOL(S) ⋅⋅⋅ Multi-byte code


ATOLW(S) ⋅⋅⋅ Unicode

Converts a decimal string to a 32-bit numeric value.


Function
The conversion takes place from S until “-” or a non-numeral character is
found in the string.
The conversion range is -2,147,483,648 to 2,147,483,647.
If a string exceeding this range is specified, the exceeding digits are
truncated.
Numeric value (32-bit)
Return Value

STRCPY (CW0, “99999”)


Example
’Sets the string “99999” to CW0 to CW2.
CW10L = ATOL (CW0);
’Sets the numeric value 99999 to CW10 to CW11.

AVERAGE Calculates average

AVERAGE(S, n)
Format

Calculates the average for the n number of values from S.


Function

A calculated average
Return Value

CW100 = AVERAGE (CW0, 100);


Example
’Sets the average of CW0 to CW99, to CW100.

2-7
BCD Numeric value → BCD code conversion

Format BCD(S)

Converts the numeric value stored in S to BCD code.


Function
The conversion range is 0 to 99,999,999.
If a string exceeding this range is specified, the exceeding digits are
truncated.
0 is set to the end of the string.

BCD code
Return Value

CW0 = 1234; ’Sets the numeric value 1234 to CW0.


Example
CW10 = BCD (CW0); ’Sets the BCD code (H1234) to CW10.
CW20L = 12345678;
’Sets the numeric value 12,345,678 to CW20 to CW21.
CW22L = BCD (CW20L);
’Sets the BCD code (H12345678) to CW22 to W23.

BIN BCD code → numeric value conversion

BIN(S)
Format

Converts the BCD code stored in S to a numeric value.


Function
The conversion range of the BCD code is H0 to H99999999.

Return Value Numeric value

CW0 = H1234; ’Sets the BCD code (H1234) to CW0.


Example
CW10 = BIN(CW0); ’Sets 1234 to CW10.
CW20L = H334455;
’Sets BCD code (H334455) to CW20 to CW21
CW22L = BIN(CW20L); ’Sets 334455 to CW22 to CW23.

2-8
BITCPY Block copy (bit)

BITCPY(D, S, n)
Format

Copies n number of bits from S to D.


Function

n/a
Return Value

BITCPY (CB10, CB0, 5);


Example
’Copies the value of CB0 to CB4, to CB10 to CB14.

BITSET Transfers all (bit)

BITSET(D, c, n)
Format

Sets n number of c’s to D. Specify 0, 1, or a bit variable for c.


Function

n/a
Return Value

BITSET (CB0, 0, 10); ’Clears CB0 to CB9 with 0.


Example

CLICKEVENT Sends the click event to the specified page

CLICKEVENT(n,x,y)
Format

Sends the click event to the coordinates (x, y) of the screen page number
Function
n.
Specifies -1 for the base screen.

Return Value 0: normal termination


-1: no specified page

CLICKEVENT (-1,20,35);
Example
’Sends the click event to the coordinates of the base screen (20, 35).

2-9
CLOSEPOPW Closes the pop-up screen

CLOSEPOPW (n)
Format

Closes the pop-up screen of screen page n.


Function

n/a
Return Value

CLOSEPOPW (15);
Example
’Closes the pop-up screen of screen page 15.

DFC Calls DLL

DFC(S1,S2 , Arg)
Format

Function Adds an argument to function S2 of DLL name S1, and calls the DLL.
Stores DLL in the folder where ScreenWorks was installed.
(The default location is
C:¥Program Files¥ScreenWorks.)

The return value of the function


Return Value

DFC (“ABC”, “Init”, “/p”) ;


Example
’Calls the Init function of the ABC.dll and calls the /p argument.

DSORT Sort (descending)

Format DSORT(D, S, n)

Sorts an n number of values from S in descending order and stores them


Function
to D.

n/a
Return Value

DSORT (CW100, CW0, 100) ;


Example
’Sorts CW0 to CW99 in descending order, then stores them to CW100 to
CW199.

2-10
EXEC Starts an application

Format EXEC(S1, S2,S3)

Executes the command specified by S1, and displays a screen with the
Function
screen title of S2 and the screen style of S3.
Specify a startup file or startup variable for S1.
(Separate the startup file and startup variable with a space.)
S2 : screen title (if “ ”, the default screen title is displayed)
S3 : 0 = standard 1 = minimized 2 = maximized 3 = hide
Note : when specifying a string variable for S1 or S2, use unicode.

0: normal termination
Return Value
-1: startup error

EXEC (“CALC.EXE”, “Calculator”, 2);


Example
’Executes CALC.EXE and displays a maximized screen with the title
“Calculator”.

GETDBREC Gets record number in data block

Format GETDBREC(n)

Function Gets record number which is currently selected in data block No.n.
You can specify any number between 1..100 for n, which is available for
entry.

Return Value -1: No specified data block


Others: Record number

Example CW10 = GETDBREC (1);


‘Stores selected record number in data block No.1 into CW10.

2-11
GETMAX Calculates maximum valu

Format GETMAX(S,n)

Searches the maximum value through an n number of values from S.


Function

Maximum Value
Return Value

CW100 = GETMAX (CW0, 100);


Example
’Sets the maximum values for CW0 to CW99, to CW100.

GETMIN Calculates minimum value

GETMIN(S,n)
Format

Searches the minimum value through an n number of values from S.


Function

Minimum Value
Return Value

CW100 = GETMIN (CW0, 100);


Example
’Sets the minimum values for CW0 to CW99, to CW100.

GETNUMVAL Obtains numeric values to be written, and changed values

GETNUMVAL( )
Format

Obtains numeric values to be written, and changed values for or from the
Function
Numeral Display&Input object.
This is used for macros with the [Before Writing Numeral] , [After Writing
Numeral] and [When Changing Numeral] execution conditions selected for
the Numeral Display & Input object.
If it is used in a “Before Inputting Numeral” macro, a macro program
execution error will occur.

Input Numeric value


Return Value

CW0 = GETNUMVAL ( ) ; ’Sets the write value to CW0.


Example

2-12
GETPARTS Obtains the display rectangle of the object

Format GETPARTS(n,Left,Top,Right,Bottom);

Function Obtains the display rectangle of the object with the ID number n. The top
left (Left, Top) and bottom right (Right, Bottom) coordinates of the
rectangle are set.

(Left,Top)

(Right,Bottom)

Return Value 0: normal termination


-1: no object specified

Example GETPARTS (1, CW0, CW1, CW2, CW3);


’Sets the coordinates of the display rectangle that has the object with the
ID number 1 to (CW0, CW1) − (CW2, CW3).

HARDCOPY Makes a hard copy of the screen

Format HARDCOPY(S)

Function Prints a hard copy of the current screen with the title S.

Return Value None

Example HARDCOPY (“TEST”) ;


’Prints a hard copy of the current screen with the title “TEST”.

2-13
HTOI(W) Hexadecimal String → Numeric value (16-bit) Conversion

Format HTOI(S)  Multi-byte code


HTOIW(S)  Unicode

Function Converts a hexadecimal string to a 16-bit numeric value. The conversion


takes place from S until a non-numeral character is found in the string.
The conversion range is H0000 to HFFFF. If a string exceeding this range
is specified, the exceeding digits are truncated. If the range might be
exceeded, use the HTOL ( ) function.

Return Value Numeric value (16-bit)

Example STRCPY (CW0, “FFFF”)


’Sets the string “FFFF” to CW0 to CW2.
CW10 = HTOI (CW0) ; ’Sets HFFFF (-1) to CW10.

HTOL(W) Hexadecimal string →numeric value (32-bit) conversion

Format HTOL(S)  Multi-byte code


HTOLW(S)  Unicode

Function Converts a hexadecimal string to a 32-bit numeric value. The conversion


takes place from S until a non-numeral character is found in the string.
The conversion range is 0 to HFFFFFFFF. If a string exceeding this range
is specified, the exceeding digits are truncated.

Return Value Numeric value (32-bit)

Example STRCPY (CW0, “FFFFFFFF”);


’Sets the string to CW0 to CW4.
CW10L = HTOL (CW0) ;
’Sets the number HFFFFFFFF(-1) to CW10 to CW11.

2-14
ITOA(W) Numeric value (16-bit) →decimal string conversion

Format ITOA(D, S)  Multi-byte code


ITOAW(D, S)  Unicode

Function Converts the numeric value S (16-bit) to a decimal string, then sets it to D.
The start number of the string is specified for D, and a 0 is added to the
end of the string.

Return Value n/a

Example ITOA (CW0, 100); ’Sets 100 to CW0 to CW1.

ITOH(W) Numeric value (16-bit) →hexadecimal string conversion

Format ITOH(D, S)  Multi-byte code


ITOHW(D, S)  Unicode

Function Converts the numeric value S (16-bit) to a hexadecimal string.


The start number of the string is specified for D, and a 0 is added to the
end of the string.

Return Value n/a

Example ITOH (CW0, H100); ’Sets 100 to CW0 to CW1.

LOADDB Loads data block file

Format LOADDB(n)

Function Loads the data block file of data block number n.


You can specify a number between 1 and 100 (the allotted number of data
block registries) for n.

Return Value 0: normal termination


-1: no specified block

Example LOADDB (1);


’Load the data block file of data block 1.

2-15
LOCALTIME Converts the elapsed seconds to yyyy/mm/dd/ hh:mm:ss

Format LOCALTIME(D,S)

Function Stores the elapsed number of seconds from the Greenwich mean time
1970/1/1/00:00:00 to D to D+7 in the format of yyyy/mm/dd/ hh:mm:ss
S must be a 32-bit number to obtain correct results.
Do not specify a value exceeding the setting range for the first variable that
stores the results for D.
The following values are set for D:
D:seconds (0 to 59)
D+1: minutes (0 to 59)
D+2: time (0 to 23)
D+3: day (1 to 31)
D+4: month (1 to 12)
D+5: year (1900 to)
D+6: day of the week (0: Sun, 1: Mon, 2: Tue, 3: Wed, 4: Thu, 5: Fri, 6: Sat)
D+7: the elapsed days from January 1st (0 to365)

Return Value n/a

Example LOCALTIME (CW10, CW0L);


’Setting the elapsed seconds from the Greenwich mean time
1970/1/1/00:00:00 to CW0 sets the current date, day of the week, and
elapsed days to CW10 to CW17.

LTOA(W) Numeric value (32-bit) →decimal string conversion

Format LTOA(D, S)  Multi-byte code


LTOAW(D, S)  Unicode

Function Converts the numeric value S (32-bit) to a decimal string, then sets it to D.
0 is added to the end of the
string.

Return Value n/a

Example LTOA (CW0, 100000);


’Sets the string “100000” to CW0 to CW3.

2-16
LTOH Numeric value (32-bit) →hexadecimal string conversion

Format LTOH(D, S)  Multi-byte code


LTOHW(D, S)  Unicode

Function Converts the numeric value S (32-bit) to a hexadecimal string, then sets it
to D.
0 is added to the end of the string.

Return Value n/a

Example LTOH (CW0L, H100000);


’Sets the string “100000” to CW0 to CW3.

MAX Compares numeric values(return value: larger value)

Format MAX(S1, S2)

Function Returns the larger numeric value between S1 and S2.

Return Value Larger value

Example CW0 = MAX (CW1 , CW2);


’Sets the larger numeric value of CW1 and CW2, to CW0.

MEMCPY Copies all

Format MEMCPY(D, S, n)

Function Copies an n number of values from S to D

Return Value n/a

Example MEMCPY (CW10, CW0, 5);


’Copies the values of CW0 to CW4, to CW10 to CW14.

2-17
MEMSET Sets all

Format MEMSET(D, c, n)

Function Sets n number of c’s to D.

Return Value n/a

Example MEMSET (CW0, 0, 10); ’Clears CW0 to CW9 with 0.

MIN Compares numeric values(return value: smaller value)

Format MIN(S1, S2)

Function Returns the smaller numeric value between S1 and S2.

Return Value Smaller value

Example CW0 = MIN (CW1, CW2);


’Sets the smaller numeric value of CW1 and CW2, to
CW0.

2-18
Converts the date and time to the number of elapsed seconds
MKTIME
from the Greenwich mean time 1970/1/1 00:00:00

Format MKTIME(S)

Function Sets the date and time to S to S+5 to return the number of elapsed
seconds from the Greenwich mean time 1970/1/1/00:00:00.
The following values are set for S:
S: seconds (0 to 59)
S+1: minutes (0 to 59)
S+2: time (0 to 23)
S+3: day (1 to 31)
S+4: month (1 to 12)
S+5: year (1900 to)

Return Value Returns the elapsed seconds (32-bit value) from the Greenwich mean time
1970/1/1/00:00:00.
The value between –1 : S to S+5 is incorrect.

Example CW10L = MKTIME (CW0);


’Setting the current date and time to CW0 to CW5 sets the elapsed
seconds from the Greenwich mean time 1970/1/1/00:00:00 to CW11.

MOVEPARTS Moves the object’s display location

Format MOVEPARTS (n,x,y)

Function Moves the object with the ID number n to the specified coordinates (x, y).
Specify the top left coordinates of the object for x and y.

Return Value 0: normal termination


-1: no object specified

Example MOVEPARTS (3,150,200);


’Moves the object with the ID number 3 to the specified location (150, 200).

2-19
MOVEPOPW Moves the pop-up screen

Format MOVEPOPW(n,x,y)

Function Moves the top left of the pop-up screen of screen page n to the specified
coordinates (x, y).

Return Value 0: normal termination


-1: no specified page

Example CW0 = MOVEPOPW (10, 140, 160);


’After moving the pop-up screen of screen page 10 to the coordinates (140,
160), 0 is returned to CW0.
’If the pop-up screen is not displayed, -1 is returned to CW0.

MOVEPOPWDOWN Moves the pop-up screen down

Format MOVEPOPWDOWN(n,y)

Function Moves the pop-up screen of screen page n down dot(s) y.

Return Value 0: normal termination


-1: no specified page

Example CW0 = MOVEPOPWDOWN (10, 32);


’After moving the pop-up screen of screen page 10 down 32 dots, 0 is
returned to CW0.
’If the pop-up screen is not displayed, -1 is returned to CW0.

MOVEPOPWLEFT Moves the pop-up screen to the left

Format MOVEPOPWLEFT (n,x)

Function Moves the pop-up screen of screen page n to the left x dot (s).

Return Value 0: normal termination


-1: no specified page

Example CW0 = MOVEPOPWLEFT (10, 32) ;


’After moving the pop-up screen of screen page 10 to the left 32 dots, 0 is
returned to CW0.
’If the pop-up screen is not displayed, -1 is returned to CW0.

2-20
MOVEPOPWRIGHT Moves the pop-up screen to the right

Format MOVEPOPWRIGHT(n,x)

Function Moves the pop-up screen of screen page n to the right x dot(s).

Return Value 0: normal termination


-1: no specified page

Example

MOVEPOPWUP Moves the pop-up screen up

Format MOVEPOPWUP (n,y)

Function Moves the pop-up screen of screen page n up y dot(s).

Return Value 0: moved


-1: no specified page

Example CW0 = MOVEPOPWUP (10, 32);


’After moving the pop-up screen of screen page 10 up 32 dots, 0 is
returned to CW0.
’If the pop-up screen is not displayed, -1 is returned to CW0.

2-21
MSGBOX Displays the message dialog box

Format MSGBOX(S1,S2,S3)

Function Displays a specified type of message box.


S1: message string
S2: title bar string
S3: the icon type and response of the icon displayed in the message box
Last four bits (B4 to B7)
0: STOP mark 1: QUESTION mark
2: EXCLAMATION mark 3: INFORMATION mark

Upper eight bits (B8 to B15)


0: only the [OK] button
1: [OK] and [Cancel] buttons
2: [Retry] and [Cancel] buttons
3: [Yes] and [No] buttons
4: [Yes], [No], and [Cancel] buttons
5: [Abort], [Retry], and [Ignore] buttons

Return Value 0: [OK] button selected 1: [Cancel] button selected


2: [Yes] button selected 3: [No] button selected
4: [Ignore] button selected 5: [Retry] button selected
6: [Abort] button selected

Example CW0 = MSGBOX (“START?”, “TEST”, H31);


IF (CW0 == 2)
........... ’write a process when YES is selected
ELSE
........... ’ write a process when NO is selected
ENDIF
For the above example, the following message box is displayed.

Point
When you specify "0: only the [OK] button", "1: [OK] and [Cancel] buttons" or "3: [Yes] and [No]
buttons" as the response buttons, a large message box is displayed.
In this case, the number of characters that can be displayed per line is limited.
For details, refer to "Write (expansion tab" in "3-1 Common Functions of Functional Objects" of
the ScreenWorks-T Reference Manual.

2-22
NEXTPAGE Next screen

Format NEXTPAGE( )

Function Forwards to the next screen.


Moves between screens in the screen display history.

Return Value n/a

Example ’If the screen display history recorded that you viewed screen page 1 to 10
to 7, and you moved back to the previous page (7 to 10)...
NEXTPAGE ( ); ’goes to screen page 7.

POW To the power of

Format POW (S1,S2)

Function Returns the value of S1 to the power of S2.

Return Value To the power of

Example CW1 = POW (2, 3); ’sets 8 (23) to CW1.

PREVPAGE Previous to operation screen

Format PREVPAGE( )

Function Goes back a screen.


Moves back through screens in the screen display history.

Return Value n/a

Example ’If the screen display history has screen page number 1 to 3 to 10 to 7
recorded
PREVPAGE ( ); ’returns to screen page 10.

2-23
READDB Reads the data block record

Format READDB(n)

Function Sets the value of the “Read Address” to the record that is currently
selected in data block n.
You can specify a number between 1 and 100 (the allotted number of data
block registries) for n.

Return Value 0: read completed


-1: no specified block

Example READDB (1);


’Sets the value of the “Read Address” to the record selected in data block
1.

REDRAW Redraw the specified rectangular area

Format REDRAW(Left,Top,Right,Bottom)

Function Redraws a rectangular area with the given top left (Left, Top) and bottom
right (Right, Bottom) coordinates.

(Left, Top)

(Right, Bottom)

Return Value n/a

Example REDRAW (CW0, CW1, CW2, CW3);


’Redraws the rectangular area based on the given CW0, CW1 and CW2,
CW3 coordinates.

2-24
RESIZEPARTS Resizes the outer rectangle of the object

Format RESIZEPARTS(n,Left,Top,Right,Bottom)

Function Changes the framed rectangle of the object with the ID number n to a
rectangle with the given top left (Left, Top) and bottom right (Right, Bottom)
coordinates.

(Left, Top)

(Right, Bottom)

Return Value 0: normal termination


-1: no object specified

Example RESIZEPARTS (3,CW0, CW1, CW2, CW3);


’Changes the framed rectangle of the object with the ID number 3 to a
rectangle based on the given coordinates (CW0, CW1 and CW2, CW3).

RSTALARMCNT Clears the alarm/event count

Format RSTALARMCNT(S)

Function If the S value is 0, the alarm count is cleared. If the value is 1, the event
count is cleared.

Return Value 0: normal termination


-1: no supported function

Example RSTALARMCNT(0); ’Clears the alarm count.


RSTALARMCNT(1); ’Clears the event count.

RSTALARMLOG Clears the alarm/event history data

Format RSTALARMLOG(S)

Function If the S value is 0, the alarm history data is cleared. If the value is 1, the
event history data is cleared.

Return Value 0: normal termination


-1: no supported function

Example RSTALARMLOG(0); ’Clears the alarm history data


RSTALARMLOG(1); ’Clears the event history data

2-25
RSTDATALOG Clears the data log

Format RSTDATALOG(n)

Function Clears the data of data log group n.


You can specify a number between 1 and 100 (the allotted number of data
block registries) for n.

Return Value 0: normal termination


-1: no supported function

Example RSTDATALOG (1);


’Clears the data of data log group 1.

RSTERRORLOG Restarts the macro error log

Format RSTERRORLOG()

Function Clear the data of the macro error history

Return Value 0: normal termination


-1: no supported function

Example RSTERRORLOG();

RSTOPELOG Restart the operation log

Format RSTOPELOG()

Function Clear the data of the operation history (functional object operation log,
screen operation history, macro execution history).

Return Value 0: normal termination


-1: no supported function

Example RSTOPELOG( );

2-26
SAVEALARMLOG Saves the alarm/event log data

Format SAVEALARMLOG(S)

Function If 0 is specified for S, the data of the alarm log is saved to “Alarm.log ”. If
the value is 1, the data of the event log is saved to “Event.log” .
Each time this function is executed, the original file is overwritten.

Return Value 0: normal termination


-1: file error

Example SAVEALARMLOG(0); ’Saves the alarm log.


SAVEALARMLOG(1); ’Saves the event log.

SAVEDATALOG Saves the data log

Format SAVEDATALOG(n)

Function Saves the data of data log group n to the csv file called Trend#.log
(# stands for the group number).
Each time this function is executed for the same data group, the original
file is overwritten.

Return Value 0: normal termination


-1: file error

Example SAVEDATALOG(1);
’Saves the data of data log group 1 to the file.

SAVEDB Saves the data block file

Format SAVEDB(n)

Saves all of data of the data block in data block n. Each time this function is
Function
executed for the same data block number, the original file is overwritten.

0: normal termination
Return Value
-1: no block specified

SAVEDB(5);
Example
’Saves all of the data in data block 5 to the file.

2-27
SAVEERRORLOG Saves the macro error log

Format SAVEERRORLOG()

Saves the macro error log to the file called MacroErr.log .


Function
Each time this function is executed, the original file is overwritten.

0: normal termination
Return Value
-1: file error

SAVEERRORLOG( );
Example

SAVEOPELOG Saves the operation log data

Format SAVEOPELOG();

Saves the operation log to the file called Operat.log.


Function
Each time this function is executed, the original file is overwritten.

0: normal termination
Return Value
-1: file error

SAVEOPELOG( );
Example

SEC2HMS Converts seconds to hh:mm:ss

Format SEC2HMS(D,S)

The number of specified seconds for S is converted to hours, minutes, and


Function
seconds, which are stored in D to D+2.
Set the start variable where the results are to be stored for D.
The following results are stored to D:
D: seconds (0 to 59)
D+1:minutes (0 to 59)
D+2:hours (0 to 23)

n/a
Return Value

SEC2HMS(CW0, 3670);
Example
’Sets the value 10 to CW0, 1 to CW1, and 1 to CW2.

2-28
SELECTDBREC Selects record in data block

Format SELECTDBREC(n1,n2)

Function Selects the record specified with n2 in the data block specified with n1.
You can specify any number between 1..100 for n1, which is available for
entry.
You can specify the CW number where the record number is stored in, or
any number between 0..1023 for n2.
In case that the specified record number doesn’t exist, macro program
error will occur when excuting the macro.

Return Value n/a

Example SELECTDBREC(1, CW100);


’Selects the record specified with CW100 in data block No.1

SENDCAPTION Send the string of the label to the focus location

Format SENDCAPTION()

Sends the string, set to the label, to the functional object of the focus
Function
location.

0: normal termination
Return Value
-1: transmission error

SENDCAPTION ( );
Example

2-29
SENDCMD Sends the display command to the specified functional object

Format SENDCMD(W,n,S)

Function Sends the control code, which is specified in S, to the functional object with
the ID number n from the page specified by W. To specify the base screen,
set W to -1.
11: HOME...moves the focus to the data input object at the top left of the
screen
12: F UP......moves the focus to the next data object up
13: F DOWN...moves the focus to the next data object down
14: F LEFT...moves the focus to the next data object to the left.
15: F RIGHT...moves the focus to the next data object to the right
16: F NEXT...moves the focus to the next registered (ascending order)
data input object
17: F PREV...moves the focus to the previous registered
(descending order) data input object
18: S PAGEUP...moves up one page for list selection, combo box,
alarm/event summary & history, data block table, and
data block selector
19: S PAGEDOWN...moves down one page for list selection, combo box,
alarm/event summary & history, data block table, and
data block selector
20: S LINEUP...moves list selection, combo box, alarm/event summary &
history, data block table, and data block selector objects up
one line
21: S LINEDOWN...moves list selection, combo box, alarm/event summary
& history, data block table, and data block selector
objects down one line
22: S RIGHT...right-scrolls the data block object
23: S LEFT...left-scrolls the data block object
0: normal termination
Return Value
-1: transmission error; the specified functional object not supported

SENDCMD(-1, 2, 19);
Example
’Sends a pagedown command to the functional object on base screen [
ID 2.

2-30
SENDKEY Sends a control character code to the focus location

Format SENDKEY(S)

Function Sends the control character code specified in S to the functional object in
the focus location.
Specify the following values for S.
1: LFET...moves the cursor one character to the left
(equivalent to the [BS] key)
2: RIGHT...moves the cursor one character to the right
(equivalent to the [Space] key)
3: CLR...clears the whole input area
4: CAN...cancels the input
5: BS...the backspace (BS) key
6: DEL...the DEL key
7: RET...confirms the input
8: ENT...confirms the input and shifts the focus to the next Input location
9: ±...switches the +, - signs
10:. ...enters decimal points

Return Value 0: normal termination


-1: communication error

Example SENDKEY (8); ’confirms the input character.

SENDSTR Sends specified character code to the focus location

Format SENDSTR(S)

Function Sends the string specified in S to the functional object of the focus location.

Return Value 0: normal termination


-1: the specified functional object does not permit input

Example SENDSTR (“ABC”); ’sends ABC

2-31
SETFOCUS Sets the specified functional object to input mode

Format SETFOCUS(S)

Function Places the functional object with ID number n in input mode.

Return Value 0: normal termination


-1: the specified functional object does not permit input

Example SETFOCUS (3);


’ Places the functional object 3 in input mode.

SETTIME Sets the system clock

Format SETTIME(S)

Function Specifies the time and date for variables S to S+5 to modify the system
clock.
Specify the following values for S1 to S7.
S: seconds (0 to 59)
S+1: minutes (0 to 59)
S+2: hour (0 to 23)
S+3: day (1 to 31)
S+4: month (1 to 12)
S+5: year (1980 to 2038)

Return Value n/a

Example CW0 = 0; CW1 = 10; CW2 = 12;


CW3 = 10; CW4 = 12; CW5 = 2000;
SETTIME (CW0); ’Changes the system clock to 2000/12/10/12:10:00.

2-32
SETVIEWPOS Sets the display point in the screen

Format SETVIEWPOS(x,y)

Function Specifies the coordinates (x, y) of the display point in the screen.

Return Value 0: normal termination


-1: coordinate error

Example SETVIEWPOS (640, 0);


’Sets the display point of the screen to 640, 0.

SHOWPAGE Switches screen

Format SHOWPAGE(S)

Function Switches to the screen of the screen page specified in S.


Note:if the screen of the specified page is a pop-up screen, a pop-up
screen is displayed.

Return Value n/a

Example SHOWPAGE(10); ’Switches to screen page 10.

Point
When using switch screen macro functions SHOWPAGE and CLOSEPOPW, the screen will switch at the
moment the macro is executed. Therefore, any processes that come after these macros will not be
executed. To avoid this, other processes used in combination with SHOWPAGE and CLOSEPOPW in the
same macro should be placed before SHOWPAGE and CLOSEPOPW

2-33
STARTDATALOG Restarts the data log

Format STARTDATALOG(n)

Function Restarts the logging of data log group n.

Return Value 0: restarted


-1: no supported function

Example STARTDATALOG (1);


’Restarted the logging of data log group 1.
STOPDATALOG (1);
’Stopped the logging of data group 1.

STOPDATALOG Stop the data log

Format STOPDATALOG(n)

Function Stops the logging of data log group n.

Return Value 0: restarted


-1: no supported function

Example STOPDATALOG (1);


’Stopped the logging of data group 1.
STARTDATALOG (1);
’Restarted the logging of data log group 1.

STRCAT(W) Attaches strings

Format STRCAT(D, S)  Multi-byte code


STRCATW(D, S)  Unicode

Function Attaches string S to string D.

Return Value n/a

Example STRCPY (CW0, “ABC”); ’Sets ABC to CW0 to CW1.


STRCPY (CW10, “DEF”); ’Sets DEF to CW10 to CW11.
STRCAT (CW0, CW10); ’Sets ABCDEF to CW0 to CW3.

2-34
STRCMP(W),
Compares strings
STRICMP(W)

Format STRCMP(S1, S2) STRICMP(S1, S2) ... Multi-byte code


STRCMPW(S1, S2) STRICMPW(S1, S2) ... Unicode

Function Compares strings.


STRCMP(W) case sensitive
STRICMP(W) not case sensitive

Return Value -1: S1 < S2


0: S1 = S2
1: S1 > S2

Example STRCPY (CW0, “ABC”); ’Sets ABC to CW0 to CW1


CW10 = STRCMP (CW0, “DEF”);
’Compares ABC and DEF and returns the result -1 to CW10.

STRCPY(W) Copies string

Format STRCPY(D, S) ... Multi-byte code


STRCPYW(D, S) ... Unicode

Function Copies the string from S to D.


The copies continues until it reaches a null value. (null is included)

Return Value n/a

Example STRCPY (CW0, “ABC”); ’Sets ABC, to CW0 to CW1.

Takes a specified number of characters of the string starting


STRLEFT(W)
from the left.

Format STRLEFT(D, S, n) ... Multi-byte code


STRLEFTW(D, S, n) ... Unicode

Function Copies an n number of characters counting from the left of string S to D.

Return Value n/a

Example STRLEFT (CW0, “ABCDEFG”, 3);


’Copies ABC, to CW0 to CW1.

2-35
STRLEN(W) String length

Format STRLEN(S) ... Multi-byte code


CSTRLENW(S) ... Multi-byte code

Function Returns the length (bytes) of string S.

Return Value String length

Example STRCPY (CW0, “ABC”);


CW10 = STRLEN(CW0);
’Sets 3 to CW10.

STRLTRIM(W) Trims left spaces of string

Format STRLTRIM(D, S) ... Multi-byte code


STRLTRIMW(D, S) ... Unicode

Function Trims the spaces off the left end of the string S, then copies the string to D.

Return Value n/a

Example STRLTRIM(CW0, “ ABC”);


’Copies ABC to CW0 to CW1.

STRLWR(W) Upper case → lower case conversion

Format STRLWR(D, S) ... Multi-byte code


STRLWRW(D, S) ... Unicode

Function Converts the upper case characters of string S to lower cases, then sets it
to D.

Return Value n/a

Example STRCPY(CW0, “ABC”);


STRLWR(CW10, CW0); ’sets abc to CW10 to CW11.

2-36
Takes the specified number of characters starting from the
STRMID(W)
specified character.

Format STRMID(D, S, n1, n2) ... Multi-byte Code


STRMIDW(D, S, n1, n2) ... Unicode

Function Copies the specified portion of string S to D. n1 indicates the start position
in string S, and n2 indicates the number of characters to copy. (The start
position, n1, is counted as the first character to copy.)

Return Value n/a

Example STRMID (CW0, “ABCDEFG”, 2, 3);


’Copies BCD to CW0 to CW1.

STRM2W Converts the string from multi-byte code to unicode

Format STRM2W(D, S)

Function Converts string S to unicode and copies it to D.

Return Value n/a

Example STRM2W (CW0, “ABC”);


’Converts ABC to Unicode, then copies it to CW0 to CW2.
IGHT(W)

Takes specified number of characters from the string starting


STRRIGHT(W)
from the right

Format STRRIGHT(D, S, n)  Multi-byte code


STRRIGHTW(D, S, n)  Unicode

Function Gets an n number of characters from the right end of the string, then
copies the string to D.

Return Value n/a

Example STRLEFT (CW0, “ABCDEFG”, 3);


’Copies EFT to CW 0 to CW1.

2-37
STRRTRIM(W) Trims right spaces of string

Format STRRTRIM(D, S) ... Multi-byte code


STRRTRIMW(D, S) ... Unicode

Function Trims the spaces off the right end of string S, then copies the string to D.

Return Value n/a

Example STRRTRIM (CW0, “ABC ”);


Copies ABC to CW 0 to CW 1.

STRTRIM(W) Trims left and right spaces of string

Format STRTRIM(D, S) ... Multi-byte code


STRTRIMW(D, S) ... Unicode

Function Trims the spaces off of both ends of string S, then copies the string to D.

Return Value n/a

Example STRTRIM (CW0, “ ABC ”);


’Copies ABC to CW 0 to CW 1.

STRUPR(W) Lower case → upper case conversion

Format STRUPR(D, S) ... Multi-byte code


STRUPRW(D, S) ... Unicode

Function Converts the lower case characters of string S to upper case characters,
then sets it to D.

Return Value n/a

Example STRCPY (CW0, “abc”);


STRUPR (CW10, CW0); ’ Sets ABC to CW10 to CW11.

2-38
STRW2M Convert the string from unicode to Multi-byte code

Format STRW2M(D,S)

Function Converts the unicode string S to multi-byte code and copies it to D.

Return Value n/a

Example STRW2M (CW0, “ABC”);


’Converts ABC to multi-byte code, then copies it to CW0 to CW1.

SUM Calculates sum

Format SUM(S, n)

Function Calculates the sum of an n number of values from S.

Return Value Total

Example CW100 = SUM (CW0, 100);


’Sets the sum of CW0 to CW99, to CW100.

Converts the time to the number of elapsed seconds from the


TIME Greenwich mean time 1970/1/1 00:00:00

Format TIME(D)

Function Sets the elapsed number of seconds from the Greenwich mean time
1970/1/1/00:00:00 to D.
If a 16-bit variable is specified for D, only the lower 16-bit is set.

Return Value n/a

Example TIME (CW0L);


’Sets the elapsed seconds from the Greenwich mean time
1970/1/1/00:00:00 to CW0 to CW1.

2-39
USORT Sort (Ascending)

Format USORT(D, S, n)

Function Sorts a n number of values from S in ascending order and stores them to
D.

Return Value n/a

Example USORT(CW100, CW0, 100);


’Sorts CW0 to CW99 in ascending order, then sets them to CW100 to
CW199.

WINFIND Find a screen name

Format WINFIND(S1, S2)

Function Checks if the screen specified in S1 is open.


Specify the search parameters of the screen in S2 using the following bits.
Bits 0 to 30:targets screens with exact match with S1
1:targets screens with the exact number of characters as S1
2:targets screens with the exact number of characters as S1
(folders not included)
Bit 4 0:stops search when found
1:searches for all matching screens

Return Value Number of search results


(0: non, 1 or more: screen(s) found)

Example WINFIND (“Calculator”,0);


’Searches for the screen with the title “Calculator”.

2-40
WINMAX Maximizes the specified screen

Format WINMAX(S1, S2)

Function Maximizes the screen specified in S1


Specify the search conditions of the screen in S2 using the following bits.
Bits 0 to 30:targets screens with exact match with S1
1:targets screens with the exact number of characters as S1
2:targets screens with the exact number of characters as S1
(folders not included)

Return Value 0: normal termination


-1: no specified screen

Example WINMAX (“TEST”, 0);


’Maximizes the screen called TEST.

WINMIN Minimizes the specified screen

Format WINMIN(S1, S2)

Function Minimizes (puts in icon) the screen specified in S1.


Specify the search conditions of the screen in S2 using the following bits.
Bits 0 to 30:targets screens with exact match with S1
1:targets screens with the exact number of characters as S1
2:targets screens with the exact number of characters as S1
(folders not included)

Return Value 0: normal termination


-1: no specified screen

Example WINMIN (“TEST”,0);


’Minimizes the screen called TEST.

2-41
WINTERM Exits the specified screen

Format WINTERM(S1, S2)

Function Exits the screen specified in S1


Specify the search conditions of the screen in S2 using the following bits.
Bits 0 to 30:targets screens with exact match with S1
1:targets screens with the exact number of characters as S1
2:targets screens with the exact number of characters as S1
(folders not included)
Bit 4 0:sends the WOM_CLOSE message to the specified screen.
1:sends the WM_DESTORY message to the specified screen.
Example: For Microsoft Word
If Bit 4 equals0:displays the “Do you want to save Doc1?” message, then
exits Microsoft Word after confirmation.
If Bit 4 equals1:exits without any confirmation message, regardless of any
changes.

Return Value 0: normal termination


-1: no specified screen

Example WINTERM (“TEST”,0); ’Exits the screen called TEST.

2-42
WINTOP Brings the specified screen to the front

Format WINTOP(S1, S2)

Function Moves the screen specified in S1 to the front.


Set the search conditions of the screen to S2.
Bits 0 to 30: targets screens with exact match with S1
1: targets screens with the exact number of characters as S1
2: targets screens with the exact number of characters as S1
(folders not included)

Return Value 0: normal termination


-1: no specified screen

Example WINTOP (“TEST”, 0);


’Brings the screen called TEST to the front.

WRITEDB Writes the data block record

Format WRITEDB(n)

Function Sets the value of the record currently selected in data block n to the “Write
Address”.
Specify a number between the allotted number of data block registries (1 to
100) for n.

Return Value 0: normal termination


-1: no block specified

Example WRITEDB (1);


’Sets the value of the record selected in data block 1 to the “Write
Address”.

2-43
3. Error Messages
This chapter describes the various error messages of the error check executed when adding a macro
function to a project, screen, or functional object.

3.1. Error Messages


The following are the error messages displayed in the error list box after running the error check.

Error Message Definition


Format error An invalid variable name, function name, or programming terminology,
which cannot be interpreted, was used.
Variable name error Invalid variable name.
( is missing A bracket is missing in a function or If statement.
No. of ( ) does not Insufficient number of ( ).
agree
Position of , is incorrect A comma is located in an invalid location.
Function argument Wrong function argument was used
error (e.g. word memory was set where only bit memory is allowed).
= command error An invalid assignment statement such as 3= CB0;.
End of program is The ending of the program is not completed.
incomplete
IF sentence error Syntax error in IF, ELS, or ENDIF.
, or ; is missing A comma missing after the function argument. Or a semicolon, used or
separating programs, is missing.
Grammar error with Syntax error in NEXT, BREAK, or CONTINUE.
FOR command
Too many FOR The FOR statement can only be nested up to 8 levels. Nest the statement
command (Max 8) within 8 levels.

3-1
Appendix-1 DLL for DFC Commands
This section describes the definitions for DLL functions used for DFC commands, as well as related
precautions.

Defining functions
DLL functions used for DFC commands must be defined in the following format (for function
samples where the return value is short).
short WINAPI Sample(
void ∗pHandle, // Handle passed to the IPSS function
// (The value for this variable should not be changed in the function.)
_TCHAR ∗szArg) // Argument string for this function when set during a DFC call

Converting character code


Change the second argument in the DLL function to match the character code used in the
function.
An example where multi-byte code is used internally is shown below.

//*************************************************************
/// Check parameter (szArg)
//*************************************************************
// Unicode to multi-byte code
#ifdef _UNICODE
WideCharToMultiByte (CP_ACP, 0, (WCHAR*)szArg, -1, cArg, 256, NULL, NULL);
#else
strcpy(cArg, szArg);
#endif

Precautions when using IPSS functions


When calling an IPSS function, the first argument for the DLL function and the first argument
for the IPSS argument must use the same handle.

Example
short WINAPI Sample(void *pHandle, _TCHAR *szArg)
...
Same handle

IPSSVsmSetCW(pHandle, lOutHeadAddr, ulSize, wDayBuff, 0);

Point
IPSS is a library that provides interface functions with ScreenWorks.

Appendix-1
The content hereof may be subjected to change for improvement
without notice

The products herein may be controlled commodities under the


Foreign Exchange and Foreign Trade law of Japan.

An approval under the law is required for exportation of such product.


All copy right of the contents are reserved.

1st August. /2011


7th April. /2022
∗ We are ready to comply with your request for maintenance,
Please forward: Phone: +81-566-25-8291
FAX: +81-566-25-5469

1-1 Asahimachi, Kariya, Aichi 448-8652 Japan

Instruction Manual No.


© JTEKT CORPORATION 2011-2022. T-B23-7-E
* Specification in this manual are subject to change without notice.
* Products herein may be strategic commodities under the Foreign Exchange and
Foreign Trade Control Law of Japan.
An approval under the law may be required exportation of the products.

You might also like