home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / suite.zip / pct.zip / addon.ext next >
Text File  |  1999-12-20  |  26KB  |  932 lines

  1. @Prefab VpConstructs
  2. %Open & center window
  3. $parse value VpWindow(window,"GETSCREENSIZE")with x y
  4. parse value VpWindow(window,"GETSIZE") with xsize ysize
  5. x=(x-xsize)/2
  6. y=(y-ysize)/2
  7. CALL VpWindow window,"SETPOS", x, y, xsize, ysize
  8. %Open folder (PSoft directory container)
  9. $/* Place in "When double clicked" event for container */
  10. valindex=VpGetItemValue(window,1101,index)
  11. value=valindex||'\'
  12. Do Forever
  13.   index=VpGetIndex(window,1101,'PARENT',index)
  14.   If index=0 Then Leave
  15.   valindex=VpGetItemValue(window,1101,index)
  16.   value=valindex||'\'||value
  17. End
  18.  
  19. value=Strip(value,'T','\')
  20. If value<>'' Then Do
  21.   rc=SysSetObjectData(value,'OPEN=DEFAULT;')
  22.   rc=SysSetObjectData(value,'OPEN=DEFAULT;')
  23. End
  24. @Work with files
  25. %File open
  26. $filename = VpFileDialog(window,'OPEN','*.*','Open File')
  27. IF LENGTH(filename) > 0 THEN
  28.    DO
  29.       DO WHILE LINES(filename)
  30.          value=LINEIN(filename)
  31.          /* insert here to use value */
  32.       END
  33.       rc=stream(filename,'c','close')
  34.    END
  35. %File save
  36. $filename = VpFileDialog(window,'SAVE','*.*','Save As')
  37. IF LENGTH(filename) > 0 THEN
  38.    DO
  39.       DO index = 1 to 10 by 1
  40.          /* insert here to load value */
  41.          rc=LINEOUT(filename,value)
  42.       END
  43.       rc=LINEOUT(filename) /*close*/
  44.    END
  45. %Charin file to variable
  46. $value = CHARIN(filename,1,CHARS(filename))
  47. rc=stream(filename,'c','close')
  48. %Picture open
  49. $filename = VpFileDialog(window,'OPEN','*.*','Open Picture')
  50. IF LENGTH(filename) > 0 THEN
  51.    DO
  52.      value = VpLoadPicture('FILE',filename)
  53.      /* insert here to use value */
  54.    END
  55. %Load picture
  56. $value = VpLoadPicture('FILE',filename)
  57. %Load bitmap from BLOB
  58. $value = VpLoadPicture('BLOB',value)
  59. %Load file icon
  60. $value = VpLoadPicture('FILEICON',filename)
  61. %Load system icon
  62. $/* valid index 1 - 22 */
  63. value = VpLoadPicture('SYSICON',index)
  64. %Load system bitmap
  65. $/* valid index 1 - 48 */
  66. value = VpLoadPicture('SYSBITMAP',index)
  67. %Release graphic
  68. $CALL VpFreePicture value
  69. %Load resource icon
  70. $value = VpLoadPicture('RESICON',index)
  71. %Load resource bitmap
  72. $value = VpLoadPicture('RESBMP',index)
  73.  
  74. @Message boxes
  75. %Plain
  76. $response=VpMessageBox(window,'title','message')
  77. %OK/Cancel
  78. $response=VpMessageBox(window,'title','message')
  79. %Yes/No
  80. $response=VpMessageBox(window,'title','message','YESNO')
  81. %Yes/No/Cancel
  82. $response=VpMessageBox(window,'title','message','YESNOCNCL')
  83. %Retry/Cancel
  84. $response=VpMessageBox(window,'title','message','RETRY')
  85. %Ignore/Cancel
  86. $response=VpMessageBox(window,'title','message','IGNORE')
  87.  
  88. @Window management
  89. %Size/position window
  90. $CALL VpWindow window,"SETPOS", x, y, xsize, ysize
  91. %Get window size
  92. $parse value VpWindow(window,"GETSIZE") with x y
  93. %Get window position
  94. $parse value VpWindow(window,"GETPOS") with x y
  95. %Set window title
  96. $CALL VpWindow window,"SETTITLE",value
  97. %Close window
  98. $CALL VpWindow window,"CLOSE"
  99. %Show window
  100. $CALL VpWindow window,"SHOW"
  101. %Hide window
  102. $CALL VpWindow window,"HIDE"
  103. %Make window active
  104. $CALL VpWindow window,"ACTIVATE"
  105. %Minimize window
  106. $CALL VpWindow window,"MINIMIZE"
  107. %Maximze window
  108. $CALL VpWindow window,"MAXIMIZE"
  109. %Restore window
  110. $CALL VpWindow window,"RESTORE"
  111. %Get screen size
  112. $parse value VpWindow(window,"GETSCREENSIZE")with x y
  113. %Set window icon
  114. $CALL VpWindow window, "SETICON", value
  115. %Set form parent
  116. $call VpWindow window, 'SETPARENT', parent
  117. %Set form owner
  118. $call VpWindow window, 'SETOWNER', owner
  119. %Load resource string
  120. $value=VpWindow(window, 'LOADSTRING', id)
  121. %Set window icon
  122. $call VpWindow window, 'SETICON', iconhandle
  123. %Set RGB forecolor
  124. $call VpWindow window, 'FORECOLORRGB', rgbvalue
  125. %Set RGB backcolor
  126. $call VpWindow window, 'BACKCOLORRGB', rgbvalue
  127. %Set forecolor
  128. $call VpWindow window, 'FORECOLOR', colorname
  129. %Set backcolor
  130. $call VpWindow window, 'BACKCOLOR', colorname
  131. %Get RGB forecolor
  132. $rc=VpWindow(window, 'GETFORECOLORRGB')
  133. %Get RGB backcolor
  134. $rc=VpWindow(window, 'GETBACKCOLORRGB')
  135. %Set font
  136. $call VpWindow window, 'FONT', '10.Helv'
  137. %Get font
  138. $rc=VpWindow(window, 'GETFONT')
  139. %Set pointer position
  140. $call VpWindow window, 'SETPOINTERPOS', x, y
  141. %Get pointer position
  142. $xy=VpWindow(window, 'GETPOINTERPOS')
  143. %Set information line text
  144. $CALL VpWindow window, "SETINFOLINE", value
  145.  
  146. @VpControls
  147. %Get PM StyleWord
  148. $value=VpItem(window, 1000, 'GETSTYLEWORD')
  149. %Set PM StyleWord
  150. $CALL VpItem window, 1000, 'SETSTYLEWORD', value
  151. %MLE-Cut selected text to clipboard 
  152. $CALL VpItem window,ITEMID,'SENDMSG','0x01d8' 
  153. %MLE-Copy selected text to clipboard 
  154. $CALL VpItem window,ITEMID,'SENDMSG','0x01d9' 
  155. %MLE-Paste text from clipboard 
  156. $CALL VpItem window,ITEMID,'SENDMSG','0x01da' 
  157. %MLE-Delete selected 
  158. $CALL VpItem window,ITEMID,'SENDMSG','0x01db' 
  159. %MLE-Set word wrap on 
  160. $CALL VpItem window,ITEMID,'SENDMSG','0x01b4','1','0' 
  161. %MLE-Set word wrap off 
  162. $CALL VpItem window,ITEMID,'SENDMSG','0x01b4','0','0' 
  163. %MLE-Set read only on 
  164. $CALL VpItem window,ITEMID,'SENDMSG','0x01b8','1','0' 
  165. %MLE-Set read only off 
  166. $CALL VpItem window,ITEMID,'SENDMSG','0x01b8','0','0' 
  167. %CB-Show listbox 
  168. $CALL VpItem window,ITEMID,'SENDMSG','0x0170','1','0' 
  169. %CB-Hide listbox 
  170. $CALL VpItem window,ITEMID,'SENDMSG','0x0170','0','0' 
  171. %CB-Is listbox showing 
  172. $flag=VpItem(window,ITEMID,'SENDMSG','0x0172','0','0') 
  173. %EF-Cut text to clipboard 
  174. $CALL VpItem window,ITEMID,'SENDMSG','0x0144' 
  175. %EF-Copy text to clipboard 
  176. $CALL VpItem window,ITEMID,'SENDMSG','0x0145' 
  177. %EF-Delete selected 
  178. $CALL VpItem window,ITEMID,'SENDMSG','0x0146' 
  179. %EF-Paste from clipboard 
  180. $CALL VpItem window,ITEMID,'SENDMSG','0x0147' 
  181. %EF-Set insert mode on 
  182. $CALL VpItem window,ITEMID,'SENDMSG','0x014c','1','0' 
  183. %EF-Set insert mode off 
  184. $CALL VpItem window,ITEMID,'SENDMSG','0x014c','0','0' 
  185. %EF-Align center 
  186. $rc=VpItem(window,ITEMID,'SETSTYLEBIT',0,1) 
  187. %EF-Align left 
  188. $rc=VpItem(window,ITEMID,'SETSTYLEBIT',0,0) 
  189. %EF-Align right 
  190. $rc=VpItem(window,ITEMID,'SETSTYLEBIT',1,1) 
  191. %EF-Set read only off 
  192. $rc=VpItem(window,ITEMID,'SETSTYLEBIT', 5, 0) 
  193. %EF-Set read only on 
  194. $rc=VpItem(window,ITEMID,'SETSTYLEBIT', 5, 1) 
  195. %CHBx-Set 3-state style on 
  196. $rc=VpItem(window,ITEMID,'SETSTYLEBIT',2,1) 
  197. %CHBx-Set 3-state style off 
  198. $rc=VpItem(window,ITEMID,'SETSTYLEBIT',2,0) 
  199. %Set clip siblings off 
  200. $rc=VpItem(window,ITEMID,'SETSTYLEBIT',28,0) 
  201. %Set clip siblings on 
  202. $rc=VpItem(window,ITEMID,'SETSTYLEBIT',28,1) 
  203.  
  204. @Miscellaneous
  205. %Get date
  206. $value = DATE()
  207. %Get time
  208. $value = TIME()
  209. %Beep
  210. $/* 1000 Hz for 200 millisec */
  211. CALL VpBeep 1000,200
  212. %Set form drag info
  213. $/* max num items, type, rendering, moveok, copyok, linkok, default */
  214. CALL VpWindow window,"SETFORMDRAGINFO",1,"Plain Text","<DRM_OS2FILE,DRF_TEXT>",1,1,1,"MOVE"
  215. %Start drag
  216. $draginfo.0=1 /* count */
  217. draginfo.1=1 /* moveable */
  218. draginfo.2=1 /* copyable */
  219. draginfo.3=1 /* linkable */
  220. draginfo.4=0 /* optional icon */
  221. draginfo.1.1="Plain Text" /* type */
  222. draginfo.1.2="<DRM_OS2FILE,DRF_TEXT>" /* rendering */
  223. draginfo.1.3="c:\"    /* source dir */
  224. draginfo.1.4=filename /* source */
  225. draginfo.1.5=filename /* target */
  226. CALL VpWindow window,"DRAGSTART","DRAGINFO."
  227. %Set pointer
  228. $CALL VpWindow window,"SETPOINTER",value
  229. %Start timer
  230. $/* duration in 1/1000 secs */
  231. CALL VpWindow window,"STARTTIMER",duration
  232. %Stop timer
  233. $CALL VpWindow window,"STOPTIMER"
  234. %Set clipboard
  235. $CALL VpWindow window,"SETCLIPBOARD","TEXT",value
  236. %Get clipboard
  237. $value=VpWindow(window,"GETCLIPBOARD","TEXT")
  238. %Delete range in MLE
  239. $rc=VpItem(window,1000,'SENDMSG','0x01c6',first,last)
  240. %Get mouse position in MLE
  241. $parse value vpitem(window,1000,'MOUSEPOS') with x y
  242. %Mouse button 1 up
  243. $/* Mouse button 1 up */
  244. rc=VpItem(window,1000,'SENDMSG','0x0072',x,y,'0','0')
  245. %Mouse button 1 down
  246. $/* Mouse button 1 down */
  247. rc=VpItem(window,1000,'SENDMSG','0x0071',x, y,'0','0')
  248.  
  249. @Threads
  250. %Start thread
  251. $tid=VpThread('START',window, filename, arg1, arg2)
  252. %Kill thread
  253. $rc=VpThread('KILL', tid)
  254. %Suspend a thread
  255. $rc=VpThread('SUSPEND', tid)
  256. %Resuming a thread
  257. $rc=VpThread('RESUME', tid)
  258. %Get process identifier
  259. $pid=VpThread('GETPID')
  260. %Get thread identifier
  261. $tid=VpThread('GETTID')
  262. %Change thread priority
  263. $rc=VpThread('SETPRIORITY', priority, tid)
  264. %Get thread list
  265. $rc=VpThread('GETIDLIST', 'threadlst.')
  266. %Pause thread execution
  267. $rc=VpThread('SLEEP', time)
  268.  
  269. @Application variables
  270. %Set variable
  271. $CALL VpAppVariable 'SET', variable, value
  272. %Get variable
  273. $value=VpAppVariable('GET', variable)
  274.  
  275. @Semaphores
  276. %Create MUTEX
  277. $semid=VpSemaphore('MUTEX', 'CREATE', semname, initstate)
  278. %Open MUTEX
  279. $semid=VpSemaphore('MUTEX', 'OPEN', semname)
  280. %Request access MUTEX
  281. $rc=VpSemaphore('MUTEX', 'WAITREQUEST', semid, timeout)
  282. %Release access MUTEX
  283. $rc=VpSemaphore('MUTEX', 'POSTRELEASE', semid)
  284. %Query MUTEX
  285. $value=VpSemaphore('MUTEX', 'QUERY', semid, 'OWNER.')
  286. %Close MUTEX
  287. $rc=VpSemaphore('MUTEX', 'CLOSE', semid)
  288. %Create event
  289. $semid=VpSemaphore('EVENT', 'CREATE', semname, initstate)
  290. %Open event
  291. $semid=VpSemaphore('EVENT', 'OPEN', semname)
  292. %Wat for event
  293. $rc=VpSemaphore('EVENT', 'WAITREQUEST', semid, timeout)
  294. %Post event
  295. $rc=VpSemaphore('EVENT', 'POSTRELEASE', semid)
  296. %Reset event
  297. $rc=VpSemaphore('EVENT', 'RESET', semid)
  298. %Query event
  299. $value=VpSemaphore('EVENT', 'QUERY', semid)
  300. %Close event
  301. $rc=VpSemaphore('EVENT', 'CLOSE', semid)
  302. %Load VpSemaphore
  303. $Call RxFuncAdd 'VpSemaphore','VPUtil','VpSemaphore'
  304. %Drop VpSemaphore
  305. $Call RxFuncDrop 'VpSemaphore'
  306.  
  307. @VpPrint & VpFont
  308. %Print List
  309. $CALL VpPrint window, "title", "subtitle", "Page %d", "LIST","10.Helvetica"
  310. %Print Array
  311. $/*****************************
  312. data.index.1 = '1st row of data'
  313. data.index.2 = '2nd row of data'
  314. data.index.3 = '3rd row of data'
  315. data.0=index                /* # of rows of data  */
  316. data.1 = 3                /* columns            */
  317. data.0.1 = ''                /* Column 1 title     */
  318. data.0.2 = ''                /* Column 2 title     */
  319. data.0.3 = ''                /* Column 3 title     */
  320. data.colwidth.1 = 1        /* Column 1 width     */
  321. data.colwidth.2 = 4        /* Column 2 width     */
  322. data.colwidth.3 = 1        /* Column 3 width     */
  323. data.colalign.1 = 'LEFT'    /* Column 1 alignment */
  324. data.colalign.2 = 'LEFT'    /* Column 2 alignment */
  325. data.colalign.3 = 'RIGHT'    /* Column 3 alignment */
  326. CALL VpPrint window, "title", "subtitle", "Page %d", "ARRAY","10.Helvetica","data."
  327. ******************************/
  328. %Print Form
  329. $CALL VpPrint window, "title", "subtitle", "Page %d", "FORM","10.Helvetica"
  330. %Font Dialog
  331. $value=VpFontDialog(window, "10.Courier")
  332. %Load Print/Font Dialog
  333. $Call RxFuncAdd 'VpPrint','VPUtil','VpPrint'
  334. Call RxFuncAdd 'VpFontDialog','VPUtil','VPFontDialog'
  335. %Drop Print/Font Dialog
  336. $Call RxFuncDrop 'VpPrint'
  337. Call RxFuncDrop 'VpFontDialog'
  338. %Load VpUtil
  339. $Call RxFuncAdd 'VpUtilLoadFuncs','VPUtil','VpUtilLoadFuncs'
  340. Call VpUtilLoadFuncs
  341. %Drop VpUtil
  342. $Call RxFuncDrop 'VpUtilLoadFuncs'
  343.  
  344. @VpSharedMemory
  345. %Access
  346. $memhandle=VpSharedMemory("GETSHARED",name)
  347. %Allocate
  348. $memhandle=VpSharedMemory("ALLOC",name,size)
  349. %Free
  350. $CALL VpSharedMemory "FREE", memhandle
  351. %Get contents
  352. $value=VpSharedMemory("GET", memhandle)
  353. %Set contents
  354. $CALL VpSharedMemory "SET", memhandle, value
  355.  
  356. @WPS
  357. %Open color pallette
  358. $rc=SysSetObjectData('<WP_HIRESCLRPAL>','OPEN=DEFAULT;')
  359.  
  360. @Rexxutil
  361. %Query & Load RexxUtil
  362. $IF RxFuncQuery('SysDropFuncs')
  363.   THEN DO
  364.      call RxFuncAdd  'SysLoadFuncs',  'RexxUtil',  'SysLoadFuncs'
  365.      call SysLoadFuncs
  366.   END
  367. %Load RexxUtil
  368. $/* Load RexxUtil.DLL */
  369. CALL RxFuncAdd 'SysLoadFuncs','Rexxutil','SysLoadFuncs'
  370. CALL SysLoadFuncs
  371. %Query RexxUtil
  372. $rc = RxFuncQuery('SysloadFuncs') /* rc is 0 if  SysLoadFuncs is not loaded */
  373. %Drop RexxUtil
  374. $CALL SysDropFuncs
  375. %RxMessageBox
  376. $value = RxMessageBox(text,title,bottom,symbol)
  377.  
  378. @System Information
  379. %Get Boot drive
  380. $/* Gets boot_drive, letter only */
  381. boot_drive = left(value('runworkplace',,'os2environment'),1)
  382. %Get Boot drive(2nd version)
  383. $/* Gets boot_drive, letter and colon */
  384. parse upper value VALUE( 'PATH',, 'OS2ENVIRONMENT' ) with ':\OS2\SYSTEM' -1 boot_drive +2
  385. %Get Boot drive(3rd version)
  386. $/* Gets boot_drive, letter and colon */
  387. os2bootPath = SysSearchPath('PATH', 'os2boot') 
  388.   if os2bootpath \= '' 
  389.   then boot_Drive = filespec('drive', os2bootPath) 
  390. %Set BeginLibPath
  391. $/* Set BeginLibPath */
  392. set BeginLibPath value
  393. %Set BeginLibPath (in VisPro)
  394. $/* Set BeginLibPath */
  395. 'SET BEGINLIBPATH='strip(directory(),'T','\')||';'
  396. %Environment variables
  397. $/*================================
  398. Possibilities - path dpath classpath prompt runworkplace temp tmp rxqueue beginlibpath endlibpath
  399. comspec help bookshelf autostart autorefreshfolders DELDIR
  400. Examples:
  401. path=value('path', ,'OS2ENVIRONMENT')
  402. dpath=value('dpath', ,'OS2ENVIRONMENT')
  403. classpath=value('classpath', ,'OS2ENVIRONMENT')
  404. =================================*/
  405. %Get system and command processor
  406. $parse source ThisSystem CommandProcessor ThisProgram
  407. %Get Drive FreeSpace
  408. $parse value SysDriveInfo(drive) with . FreeSpace . .
  409. %Get Drive Type
  410. $/* From Bernd Schemmers Tips and Tricks */
  411. curFileSystem = "UNKNOWN"
  412. "@chkdsk " testDrive || ": /dfdad 2>nul | rxqueue 2>NUL 1>&2"
  413. do while queued() <> 0
  414.   curLine = lineIN( "QUEUE:" )
  415.   if abbrev(curLine, "Dateisystemtyp für den Datenträger ist:") | abbrev(curLine, "The type of file system for the disk is") then do
  416.     curFileSystem = word( curLine, words( curLine ) )
  417.     if right( curFileSystem,1 ) == "." then curFileSystem = dbrright(curFileSystem,1)
  418.   end
  419. end
  420. RETURN curFileSystem
  421.  
  422. @Rexx Constructs
  423. %If-then-else
  424. $IF value = 0 THEN
  425.    DO
  426.    END
  427. ELSE
  428.    DO
  429.    END
  430. %Iterative loop
  431. $DO index = 1 to 100 by 1
  432. END
  433. %Do
  434. $DO index = 1 to 100 by 1
  435. END
  436. %Do while loop
  437. $DO WHILE value > 0
  438. END
  439. %Do until loop
  440. $DO UNTIL value > 0
  441. END
  442. %Select when
  443. $SELECT
  444.    WHEN value > 0
  445.       THEN
  446.    WHEN value = 0
  447.       THEN
  448.    WHEN value < 0
  449.       THEN
  450.    OTHERWISE
  451. END
  452. %Count
  453. $do numeric_value
  454. %Greater than
  455. $>
  456. %Less than
  457. $<
  458. %Equal
  459. $= or ==
  460. %Not equal
  461. $<> or \=
  462. %CrLf
  463. $crlf=d2c(13)||d2c(10)
  464. %And
  465. $&
  466. %Or
  467. $|
  468. %Not
  469. $^ or \
  470. %Procedure
  471. $PROCEDURE EXPOSE Valuename /* Procedure must follow immediately after the label! */
  472. %Signal
  473. $SIGNAL labelname
  474. %Signal off
  475. $SIGNAL OFF ERROR
  476. SIGNAL OFF FAILURE
  477. SIGNAL OFF HALT
  478. SIGNAL OFF NOVALUE
  479. SIGNAL OFF SYNTAX
  480. SIGNAL OFF NOTREADY
  481. %Signal on
  482. $SIGNAL ON ERROR NAME labelname
  483. SIGNAL ON FAILURE NAME labelname
  484. SIGNAL ON HALT NAME labelname
  485. SIGNAL ON NOVALUE NAME labelname
  486. SIGNAL ON SYNTAX NAME labelname
  487. SIGNAL ON NOTREADY NAME labelname
  488.  
  489. @Sys - object functions
  490. %SysCopyObject
  491. $rc = SysCopyObject(source,destination)
  492. %SysCreateObject
  493. $rc = SysCreateObject('WPProgram', 'title', '<WP_DESKTOP>','EXENAME=filename;STARTUPDIR=dir;PROGTYPE=PM;', 'U')
  494. %SysCreateShadow
  495. $SysCreateShadow(Object, target)
  496. %SysDeregisterObjectClass
  497. $rc = SysDeregisterObjectClass(classname)
  498. %SysDestroyObject
  499. $rc = SysDestroyObject(objectname)
  500. %SysMoveObject
  501. $rc = SysMoveObject(source,destination)
  502. %SysOpenObject
  503. $rc = SysOpenObject(objectname, display, mark)
  504. %SysQueryClassList
  505. $CALL SysQueryClassList 'stem.'
  506. %SysRegisterObjectClass
  507. $rc = SysRegisterObjectClass(name,module)
  508. %SysSaveObject
  509. $SysSaveObject(name, dAsync)
  510. %SysSetObjectData
  511. $SysSetObjectData(name, config)
  512.  
  513. @Sys - file functions
  514. %SysDriveInfo
  515. $Info = SysDriveInfo(drive)
  516. %SysDriveMap
  517. $List = SysDriveMap(drive,options)
  518. %SysFileDelete
  519. $rc = SysFileDelete(filename)
  520. %SysFileTree
  521. $CALL SysFileTree filename,'List',option,attribute
  522. %SysFileSearch
  523. $CALL SysFileSearch search value,filename,'List',options
  524. %SysGetMessage
  525. $Message = SysGetMessage(number,filename)
  526. %SysIni - query value
  527. $value = SysIni('USER',app,key) /* 'USER' 'SYSTEM' or 'BOTH' */
  528. %SysIni - query all apps
  529. $rc = SysIni('USER','ALL:','List') /* 'USER' 'SYSTEM' or 'BOTH' */
  530. %SysMkDir
  531. $CALL SysMkDir directory
  532. %SysRmDir
  533. $CALL SysRmDir directory
  534. %SysGetEA
  535. $CALL SysGetEA filename, EAname, value
  536. %SysPutEA
  537. $CALL SysPutEA filename, EAname, value
  538. %SysSearchPath
  539. $rc = SysSearchPath(path, filename)
  540. %SysSetIcon
  541. $rc = SysSetIcon(filename,iconfile)
  542. %SysTempFileName
  543. $filename = SysTempFileName(template,filter)
  544.  
  545. @Sys - other functions
  546. %SysCls
  547. $CALL SysCls
  548. %SysCurPos
  549. $pos = SysCurPos(row,col)
  550. %SysCurState
  551. $CALL SysCurState 'ON' or 'OFF'
  552. %SysGetKey
  553. $key = SysGetKey('ECHO')
  554. key = SysGetKey('NOECHO')
  555. %SysOS2Ver
  556. $Version = SysOS2Ver()
  557. %SysSleep
  558. $CALL SysSleep seconds
  559. %SysTextScreenRead
  560. $line = SysTextScreenRead(row,col,length)
  561. %SysTextScreenSize
  562. $rc = SysTextScreenSize()
  563. %SysWaitNamedPipe
  564. $SysWaitNamedPipe(name, [time_limit])
  565.  
  566. @File Info
  567. %Charin file to variable
  568. $/* Charin file to a variable */
  569. value = CHARIN(filename,1,CHARS(filename))
  570. rc=STREAM(filename,'c','close')
  571. %Close file
  572. $/* Close file */
  573. CALL STREAM filename, 'C', 'CLOSE'
  574. %Does file exist?
  575. $/* Does file exist? */
  576. value = (STREAM(filename, 'C', 'QUERY EXISTS') <> '')
  577. %Get file extension
  578. $/* Get extension even with multiple dots */
  579. parse value Reverse(filename) with Extension '.' .
  580. Extension = Reverse(Extension)
  581. %Get file Name spec
  582. $Value = FILESPEC('N',filename /* returns the filename */
  583. %Get file Path spec
  584. $Value = FILESPEC('P',filename) /* returns the path */
  585. %Get file Drive spec
  586. $Value = FILESPEC('D',filename) /* returns drive */
  587. %Get file size
  588. $/* Get file size in bytes */
  589. value = STREAM(filename, 'C', 'QUERY SIZE')
  590. %Get file date & time stamp
  591. $/* Get file date & time stamp */
  592. Parse Value STREAM(filename, 'C', 'QUERY DATETIME') With fdate ftime
  593. Parse Var fdate mm '-' dd '-' 'yy'
  594. Parse Var ftime hh ':' mm ':' ss
  595. %Get file status
  596. $/* Get file status */
  597. value = STREAM(filename, 'S')
  598. %Get file status with error code
  599. $/* Get file status with error code */
  600. value = STREAM(filename, 'D')
  601. %More chars in the file?
  602. $/* More characters in the file? */
  603. value = CHARS(filename)
  604. %More lines in the file?
  605. $/* More lines in the file? */
  606. value = LINES(filename)
  607. %Open file for reading
  608. $/* Open file for reading */
  609. /* rc will hold 'READY' if successful */
  610. rc = STREAM(filename, 'C', 'OPEN READ')
  611. %Open file for reading & writing
  612. $/* Open file for reading & writing */
  613. /* rc will hold 'READY' if successful */
  614. rc = STREAM(filename, 'C', 'OPEN')
  615. %Open file for writing
  616. $/* Open file for writing */
  617. /* rc will hold 'READY' if successful */
  618. rc = STREAM(filename, 'C', 'OPEN WRITE')
  619. %Read a char from a file
  620. $/* Read a character from the file */
  621. value = CHARIN(filename)
  622. %Read a line from a file
  623. $/* Read a line from the file */
  624. value = LINEIN(filename)
  625. %Set read/write position in file backward from current position
  626. $/* Set read/write position in file backward from current position */
  627. Call STREAM filename, 'C', 'SEEK -'value
  628. %Set read/write position in file forward from current position
  629. $/* Set read/write position in file forward from current position */
  630. Call STREAM filename, 'C', 'SEEK +'value
  631. %Set read/write position in file from end of file
  632. $/* Set read/write position in file from end of file */
  633. Call STREAM filename, 'C', 'SEEK <'value
  634. %Set read/write position in file from start of file
  635. $/* Set read/write position in file from start of file */
  636. Call STREAM filename, 'C', 'SEEK ='value
  637. %Write a line to a file
  638. $/* Write a line to the file */
  639. CALL LINEOUT filename, value
  640. %Write a string of chars to a file
  641. $/* Write a string of characters to the file */
  642. CALL CHAROUT filename, value
  643. %Change file extension
  644. $/* Change file extension to "txt" */
  645. TextFile = left(filename,lastpos('.',filename))||'txt'
  646.  
  647. @I/O functions
  648. %Address
  649. $ADDRESS environment
  650. %Charin
  651. $Value = CHARIN(name,start,length)
  652. %Charin file to variable
  653. $/* Charin file to a variable */
  654. value = CHARIN(filename,1,CHARS(filename))
  655. rc=STREAM(filename,'c','close')
  656. %Charout
  657. $CALL CHAROUT filename,string
  658. %Chars
  659. $value = CHARS(filename)
  660. %Directory
  661. $Value = DIRECTORY() /* returns current directory */
  662. CALL DIRECTORY directory /* switch to directory */
  663. %Filespec
  664. $Value = FILESPEC('D',filename) /* returns drive */
  665. Value = FILESPEC('P',filename) /* returns the path */
  666. Value = FILESPEC('N',filename /* returns the filename */
  667. %Linein
  668. $value = LINEIN(filename,line)
  669. %Lineout
  670. $CALL LINEOUT filename, string, line
  671. %Lines
  672. $value = LINES(filename)
  673.  
  674. @Parse
  675. %Parse Arg
  676. $PARSE ARG string
  677. %Parse Linein
  678. $parse [Upper] linein [template]
  679. %Parse Pull
  680. $PARSE PULL string
  681. %Parse Source
  682. $PARSE SOURCE string
  683. %Parse Value
  684. $PARSE VALUE function WITH template /* Parse Value TIME() with Std ':' Min ':' Sec */
  685. %Parse Var
  686. $PARSE VAR string first rest
  687. %Parse Version
  688. $PARSE VERSION REXXVERSION
  689.  
  690. @Stream
  691. %Stream - Open
  692. $CALL STREAM filename,'C','OPEN'
  693. %Stream - Open Read
  694. $CAll STREAM filename,'C','OPEN READ'
  695. %Stream - Open Write
  696. $CALL STREAM filename,'C','OPEN WRITE'
  697. %Stream - Seek
  698. $CALL STREAM filename,'C','SEEK number'
  699. %Stream - Close
  700. $CALL STREAM filename,'C','CLOSE'
  701. %Stream - filename
  702. $filename = STREAM(filename,'C','QUERY EXIST')
  703. %Stream - size
  704. $size = STREAM(filename,'C','QUERY SIZE')
  705. %Stream - time/Date
  706. $timeinfo = STREAM(filename,'C','QUERY DATETIME')
  707. %Stream - description
  708. $Value = STREAM(filename,'D')
  709. %Stream - status
  710. $Value = STREAM(filename,'S')
  711.  
  712. @Queue
  713. %RxQueue - GET
  714. $Queue = RxQueue('GET')
  715. %RxQueue - Create
  716. $Name = RxQueue('CREATE',name)
  717. %RxQueue - Set
  718. $rc = RxQueue('SET',name)
  719. %RxQueue - Delete
  720. $rc = RxQueue('DELETE',name)
  721. %Queued
  722. $value = QUEUED() /* returns the number of lines in queue */
  723. %Queue
  724. $QUEUE value /* append value to the end of the queue */
  725. %Pull
  726. $PULL value /* get 1. line of queue */
  727. %Push
  728. $PUSH value /* insert value at the beginning of the queue */
  729. %Pipe output to RxQueue
  730. $'@dir *.* 2>&1 | rxqueue'
  731. "@chkdsk " testDrive || ": /dfdad 2>nul | rxqueue 2>NUL 1>&2"
  732.  
  733. @Strings
  734. %B2X
  735. $value = B2X(char)
  736. %Center
  737. $value = CENTER(string,length,fillchar)
  738. %Chars
  739. $value = CHARS(name)
  740. %Compare
  741. $value = COMPARE(string1,string2)
  742. %Copies
  743. $value = COPIES(string,number)
  744. %C2D
  745. $value = C2D(char)
  746. %C2X
  747. $value = C2X(char)
  748. %Delstr
  749. $value = DELSTR(string,start,length)
  750. %Delword
  751. $value = DELWORD(string,start,length)
  752. %D2C
  753. $value = D2C(number)
  754. %D2X
  755. $value = D2X(number)
  756. %Insert
  757. $value = INSERT(new,target,start)
  758. %Lastpos
  759. $value = LASTPOS(needle,haystack,start)
  760. %Left
  761. $value = LEFT(string,length,fillchar)
  762. %Length
  763. $value = LENGTH(string)
  764. %Pos
  765. $value = POS(needle,haystack,start)
  766. %Overlay
  767. $value = OVERLAY(new,target,start,length,fillchar)
  768. %Reverse
  769. $value = REVERSE(string)
  770. %Right
  771. $value = RIGHT(string,length,fillchar)
  772. %Space
  773. $value = SPACE(string,number,fillchar)
  774. %Strip
  775. $value = STRIP(string,option,fillchar)
  776. %Substr
  777. $value = SUBSTR(string,start,length)
  778. %Subword
  779. $value = SUBWORD(string,start,length)
  780. %Translate
  781. $value = TRANSLATE(string) /* convert string to uppercase */
  782. /* replace a character within the string with an other character */
  783. value = TRANSLATE(string,tableout,tablein,pad)
  784. %Verify
  785. $value = VERIFY(string1,string2)
  786. %Word
  787. $value = WORD(string,pos)
  788. %Wordindex
  789. $index = WORDINDEX(string,word)
  790. %Wordlength
  791. $value = WORDLENGTH(string,pos)
  792. %Wordpos
  793. $value = WORDPOS(needle,haystack,start)
  794. %Words
  795. $value = WORDS(string)
  796. %X2B
  797. $value = X2B(hex char)
  798. %X2C
  799. $value = X2C(hex char)
  800. %X2D
  801. $value = X2D(hex char)
  802. %Xrange
  803. $value = XRANGE(start,end)
  804.  
  805. @Math functions
  806. %ABS
  807. $value = ABS(number)
  808. %Digits
  809. $value = DIGITS()
  810. %Format
  811. $value = FORMAT(number,before,after)
  812. %Form
  813. $value = FORM()
  814. %Fuzz
  815. $value = FUZZ()
  816. %Numeric Digits
  817. $NUMERIC DIGITS value
  818. %Numeric Form
  819. $NUMERIC FORM 'SCIENTIFIC' /* or 'ENGINEERING' */
  820. %Numeric Fuzz
  821. $NUMERIC FUZZ value
  822. %Max
  823. $value = MAX(number1,number2,...,number20)
  824. %Min
  825. $value = MIN(number1,number2,....,number20)
  826. %Random
  827. $value = RANDOM(min,max)
  828. %Sign
  829. $value = SIGN(number)
  830. %Trunc
  831. $Value = TRUNC(number,n)
  832.  
  833. @Other functions
  834. %Abbrev
  835. $value = ABBREV(information,info,length)
  836. %Beep
  837. $CALL BEEP frequency,duration
  838. %BitAnd
  839. $bitand(string1, string2, fill)
  840. %BitOr
  841. $bitor(string1, string2, fill)
  842. %BitXOr
  843. $bitxor(string1, string2, fill)
  844. %Condition
  845. $rc = CONDITION('C') /* Condition Name */
  846. rc = CONDITION('I') /* Condition Instruction */
  847. rc = CONDITION('D') /* Condition Description */
  848. rc = CONDITION('S') /* Condition Status */
  849. %Datatype
  850. $Type = DATATYPE(string)
  851. %Date
  852. $value = DATE() /* dd mm yyyy */
  853. value = DATE('B') /* days since January 1, 0001 */
  854. value = DATE('D') /* days since January 1, of the current year */
  855. value = DATE('E') /* dd/mm/yy European format */
  856. value = DATE('L') /* language-dependent format*/
  857. value = DATE('M') /* name of the month */
  858. value = DATE('N') /* dd mon yyyy */
  859. value = DATE('O') /* yy/mm/ddt */
  860. value = DATE('S') /* yyyymmdd */
  861. value = DATE('U') /* mm/dd/yy */
  862. value = DATE('W') /* day of week */
  863. %Drop
  864. $DROP value
  865. %Errortext
  866. $errortext(n)
  867. %Endlocal
  868. $endlocal()
  869. %Setlocal
  870. $setlocal()
  871. %Sourceline
  872. $line = SOURCELINE(line)
  873. %Symbol
  874. $status = SYMBOL(value)
  875. %Time
  876. $value = TIME() /* hh:mm:ss */
  877. value = TIME('C') /* hh:mmxx */
  878. value = TIME('E') /* Elapsed */
  879. value = TIME('H') /* hh */
  880. value = TIME('M') /* mmmm since midnight */
  881. value = TIME('L') /* hh:mm:ss:uu0000 */
  882. value = TIME('N') /* hh:mm:ss */
  883. value = TIME('R') /* Reset elapsed */
  884. %Trace
  885. $trace(definition)
  886. %value
  887. $value = VALUE(name,newvalue,environment)
  888. /* example */
  889. path = VALUE('Path',,'OS2ENVIRONMENT')
  890.  
  891. @Screen colors (ANSI-Sequences)
  892. %Standard
  893. $CALL CHAROUT 'CON:',''
  894. %Bright - foreground
  895. $CALL CHAROUT 'CON:',''
  896. %Invers
  897. $CALL CHAROUT 'CON:',''
  898. %Invisible
  899. $CALL CHAROUT 'CON:',''
  900. %Foreground black
  901. $CALL CHAROUT 'CON:',''
  902. %Foreground red
  903. $CALL CHAROUT 'CON:',''
  904. %Foreground white
  905. $CALL CHAROUT 'CON:',''
  906. %Background black
  907. $CALL CHAROUT 'CON:',''
  908. %Background red
  909. $CALL CHAROUT 'CON:',''
  910. %Background white
  911. $CALL CHAROUT 'CON:',''
  912. %Clear screen
  913. $CALL CHAROUT 'CON:',''
  914. %Delete line
  915. $CALL CHAROUT 'CON:',''
  916. %Coursor position
  917. $CALL CHAROUT 'CON:','x;yH'
  918. %Coursor up
  919. $CALL CHAROUT 'CON:','yA'
  920. %Coursor down
  921. $CALL CHAROUT 'CON:','yB'
  922. %Coursor to right
  923. $CALL CHAROUT 'CON:','xC'
  924. %Coursor to left
  925. $CALL CHAROUT 'CON:','xD'
  926. %Cursor position restore
  927. $CALL CHAROUT 'CON:','u'
  928. %ANSI on
  929. $ADDRESS CMD 'ANSI ON'
  930. %ANSI off
  931. $ADDRESS CMD 'ANSI OFF'
  932.