QuickScript — различия между версиями

Материал из archestra.info
Перейти к: навигация, поиск
(Получения координат курсора)
(Работа с ListBox)
Строка 39: Строка 39:
 
Способ 1 приведен в документации Wonderware '''Tech Note 463''' InTouch® Add-On Functions Master Index (см. приложение к письму)
 
Способ 1 приведен в документации Wonderware '''Tech Note 463''' InTouch® Add-On Functions Master Index (см. приложение к письму)
  
=== Работа с ListBox ===
+
==== Работа с ListBox ====
 
см встроенную справку: Getting or Setting the Value of a List Item  
 
см встроенную справку: Getting or Setting the Value of a List Item  
 
Use the '''wcGetItemData'''() function to find the integer value associated with the list item identified by the item index.  
 
Use the '''wcGetItemData'''() function to find the integer value associated with the list item identified by the item index.  
 
Use the '''wcSetItemData'''() function to assign an integer value to the item in the list specified by item index. This assigns a number to a string.
 
Use the '''wcSetItemData'''() function to assign an integer value to the item in the list specified by item index. This assigns a number to a string.

Версия 16:10, 9 сентября 2013

QuickScript (для InTouch)

QuickScript .NET (для Application Server)


Вопросы

Передача данных из InTouch в Open|MS Office

Для передачи данных из InTouch в Open|MS Office:

Вариант 1: скриптами InTouch записывать данные в файл .CSV, а затем открывать в MS Office или Open Office Для этого используется функция: FileWriteFields (filename, offset, starttag, numberoffields); Например так: FileWriteFields("c:\set.csv",0,"RecipeTag1",4);

Вариант 2: по протоколу DDE получить данные с InTouch в открытый в Open Office файл Здесь можно посмотреть как это реализуется со стороны OpenOffice: http://wiki.i-rs.ru/wiki/RU/kb/00000641 Например так: в пустой ячейке написать (при запущенном WindowViewer):

  • Для OpenOffice Cals: =DDE("view";"tagname";"$ApplicationVersion";0)
  • Для MS Office Excel: =VIEW|Tagname!'$ApplicationVersion'

Вариант 3: написать свой .Net или ActiveX объект для экспорта

Вывод в файл csv

FileWriteFields (filename, offset, starttag, numberoffields); FileWriteFields("c:\set.csv",0,"RecipeTag1",4);

Получения координат курсора

  • Способ 1: использовать функцию GetCursorPosition("Xtag", "Ytag", UseDesktop) из библиотеки CursorFn.dll.Для это необходимо:
    • в InTouch приложение импортировать указанную библиотеку (Поместить файл CursorFn.dll, CursorFN.wdf and CursorFn.hlp в директорию с InTouch и переоткрыть InTouch приложение)
    • создать в InTouch приложении три тега типа Memory Integer Xtag, Ytag, UseDesktop
    • в скрипте вызвать функцию GetCursorPosition("Xtag", "Ytag", UseDesktop)
    • передать теги Xtag, Ytag в AA символ использую Custom Properties символа
  • Способ 2: использовать .NET библиотеку System.Windows.Forms
    • импортировать библиотеку в IDE: Galaxy-Import-Script Function Libtrary выбрать файл System.Windows.Forms.dll (из папки: \Windows\Microsoft.NET\Framework\v2.0…)
    • в скрипте использовать конструкции типа Integer:
      • System.Windows.Forms.Cursor.Position.X и System.Windows.Forms.Cursor.Position.Y
      • или System.Windows.Forms.Control.MousePosition.X и System.Windows.Forms.Control.MousePosition.Y

Способ 1 приведен в документации Wonderware Tech Note 463 InTouch® Add-On Functions Master Index (см. приложение к письму)

Работа с ListBox

см встроенную справку: Getting or Setting the Value of a List Item Use the wcGetItemData() function to find the integer value associated with the list item identified by the item index. Use the wcSetItemData() function to assign an integer value to the item in the list specified by item index. This assigns a number to a string.