SITEMAP   PRIVACY   JAPANESE
FAWEB
  JAPAN   HOME  |  Product  |  Support  |  Knowledge  |  Download  |  Sales  |  Company  |  Contact
wonderware

Wonderware
Inside MELSEC
Advanced OPC
Wonder World
You are Here : HOME > Knowledge Base > Wonder World BACK

Because it is also serious that even every corner reads the manual, I easily introduce the one used well though a lot of very convenient script functions are prepared in InTouch.

Commentor
Commentor / M.Ike


InTouch Script Tips
Method of changing static character string
If the object is selected and "Ctrl+L" is pushed, the character string written on the screen statically is revokable.


Startup Application
To start an arbitrary application when the button etc. are pushed, it describes it by the script as follows. The note pad stands up in this example.
StartApp "Notepad.exe";


Printing Hardcopy of Screen
The hard copy of an arbitrary InTouch screen can be printed if it describes it as follows by the script such as buttons.
The screen of InTouch of the name of "Window1" is printed in this example.
PrintWindow("Window1", 1, 1, 0, 0, 0);
Note 1: Please set "1" to the last argument Option to prevent it from expanding when there is a bit map in the window.
Note 2: The font might collapse when the hard copy of the window where the control is arranged is printed.


Print the character string
The printer port is specified for the file name by filing and writing and using function (FileWriteMessage) to output character string "test" to printer port "LPT1" (print).
FileWriteMessage("LPT1", -1,"Test", 1);


Export Message to WWLOGGER
An arbitrary message (character string) can be output to Wonderware WWLOGGER if it describes it as follows by the script such as buttons.
LogMessage("The appication was started");


Shut down Windows
For shutting down Windows, it is neccesary to copy "/Wwcdfunc/Wwtech32/WWTech32.dll" and "/Wwcdfunc/Wwtech32/WWTech32.wdf" in Factory Suite 2000's CD-ROM "COMPREHENSIVE SUPPORT KNOWLEDGE BASE CD" to InTouch directory(C:/Program Files/FactorySuite/InTouch)

1. Windows 95
WWShutDownWin95(Flag);

2. Windows NT
WWShutDownWinNT(Flag);
Flag 1:LOGOFF, 2:SHUT DOWN


End operation of arbitrary application.
The "ALT+F4" message can be ended by the post it for the application that wants to end.
SendKeys "%({F4})";


Save as CSV file
The value of an arbitrary tag variable can be exported to the CSV file if it describes it as follows by the script such as buttons. The character string of Comma Separated Value is stored in message type tag "strCsvOneRec" in the example below, and the value of "D0-D4" is output to the end of "c:\test.csv" by one record.

1. When generating it by one record
strCsvOneRec = Text( D0, "##" ) + "," + Text( D1, "##" ) + "," + Text( D2, "##.#" )+ "," + Text( D3, "##" )+ "," + Text( D4, "##" );
FileWriteMessage( "c:\test.csv", -1, strCsvOneRec, 1 );

2. For a consecutive tag name
FileWriteFields( "c:\test.csv", -1, "D0", 5 );


Delete File
1. To delete an arbitrary file, it describes it by the script as follows.
FileDelete("c:\test.csv");

2. Deletion of two or more files
When two or more files are deleted in the lump, Command Shell is executed.
StartApp("COMMAND /C DEL " + "C:\MYDIR\*.*");


Sound Reproduction
An arbitrary sound (WAV file) can be reproduced.
PlaySound("Windows NT LOGON.wav", 1);


Reading and writing of INI file
For Reading and writing of INI file, it is neccesary to copy "/Wwcdfunc/Wwtech32/WWTech32.dll" and "/Wwcdfunc/Wwtech32/WWTech32.wdf" in Factory Suite 2000's CD-ROM "COMPREHENSIVE SUPPORT KNOWLEDGE BASE CD" to InTouch directory(C:/Program Files/FactorySuite/InTouch)

1. Writing to INI file
INIWriteString("Test.ini","App","ExcelPath","c:\Excel\");
INIWriteIntger("Test.ini","App","LogSpan",1);

2. Reading from INI file
Tag1=INIReadString("Test.ini","App","ExcelPath");
Tag2=INIReadInteger("Test.ini","App","LogSpan");


DDE Connection from EXCEL to InTouch
Viewer of InTouch has the function of the DDE server, and can acquire the value of the tag variable of InTouch by describing it in the cell of Excel as follows.
=view|tagname!'$Hour
=view|tagname!'$Minute
=view|tagname!'$Second
=view|tagname!'D0


The latest data is displayed by a historical trend
The display the following and the latest functions are called by the window script function to display a historical trend in real time at regular intervals.
HTUpdateToCurrentTime("HistTrend1");


Expansion display of historical trend(vertical direction)
1. Making of Scuta
- The scooter symbol is made
- The symbol is set at the bottom of the trend graph, the width of the movement to the under is adjusted in the vertical slider input, and the width of the movement on "0" is adjusted to the height of the graph.
- Tag variable Cursor1 (real type of the memory) is defined, the value of bottom is set, and the value of "0" and the top is set in "1".

2. It is a script that expands ten times as for the graph.
HistTrend1.MinRange = (((HistTrend1.MaxRange - HistTrend1.MinRange) * Cursor1) + HistTrend1.MinRange ) - 5;
HistTrend1.MaxRange = HistTrend1.MinRange + 10;
Cursor3 = 0.5;

Scroll of historical trend
HistTrend.ChartStart = HistTrend.ChartStart + HistTrendPanMins*60*2;
HTUpdateToCurrentTime( HistTrendCurrentName);
IF HistTrend.ChartStart > HistTrendCurrent.ChartStart THEN
  HistTrend.ChartStart = HistTrendCurrent.ChartStart;
ENDIF;


Display of list of recipe file
1. Recipe composition
- The recipe name is defined by the character string in the template definition.
- Recipe name and tag cRcpName are put up in unit name List in the unit definition and the string is put up.
- Even 1- RECIPE_MAX is defined by the recipe name.

2. Window Open Script
wcClear("lstRecipe");
FOR I = 1 TO RECIPE_MAX
  nErr = RecipeLoad( cRecipeFilePath + "Recipe.csv","List",Text(I, "#" ) );
  IF nErr < 0 THEN
    EXIT FOR;
  ENDIF;
  IF cListRcpName <> "" THEN
    lstStr1 = "Recipe"+Text(I,"#")+StringSpace(5-StringLen(Text(I,"#")))+cRcpName+StringSpace(20-StringLen(cRcpName))+cDateTime;
    wcAddItem("lstRecipe",lstStr1);
  ENDIF;
NEXT;


BACK

Copyright © 1998-2006 TAKEBISHI Corporation All rights reserved.

FAWEB.NET
TAKEBISHI Corporation
29 Mamedacho Nishikyogoku Ukyoku Kyoto 615-8501, JAPAN
TEL: +81-75-325-2171 / FAX: +81-75-325-2273 fa-support@takebishi.co.jp