home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
suite.zip
/
pct.zip
/
pctempl.ext
< prev
next >
Wrap
Text File
|
1999-12-20
|
18KB
|
695 lines
@Prefab VpConstructs
%Open & center window
$parse value VpWindow(window,"GETSCREENSIZE") with x y
parse value VpWindow(window,"GETSIZE") with xsize ysize
x=(x-xsize)/2
y=(y-ysize)/2
CALL VpWindow window,"SETPOS", x, y, xsize, ysize
@Work with files
%File open
$filename = VpFileDialog(window,'OPEN','*.*','Open File')
IF LENGTH(filename) > 0 THEN
DO
DO WHILE LINES(filename)
value=LINEIN(filename)
/* insert here to use value */
END
rc=stream(filename,'c','close')
END
%File save
$filename = VpFileDialog(window,'SAVE','*.*','Save As')
IF LENGTH(filename) > 0 THEN
DO
DO index = 1 to 10 by 1
/* insert here to load value */
rc=LINEOUT(filename,value)
END
rc=LINEOUT(filename) /*close*/
END
%Picture open
$filename = VpFileDialog(window,'OPEN','*.*','Open Picture')
IF LENGTH(filename) > 0 THEN
DO
value = VpLoadPicture('FILE',filename)
/* insert here to use value */
END
%Load picture
$value = VpLoadPicture('FILE',filename)
%Load bitmap from BLOB
$value = VpLoadPicture('BLOB',value)
%Load file icon
$value = VpLoadPicture('FILEICON',filename)
%Load system icon
$/* valid index 1 - 22 */
value = VpLoadPicture('SYSICON',index)
%Load system bitmap
$/* valid index 1 - 48 */
value = VpLoadPicture('SYSBITMAP',index)
%Release graphic
$CALL VpFreePicture value
%Load resource icon
$value = VpLoadPicture('RESICON',index)
%Load resource bitmap
$value = VpLoadPicture('RESBMP',index)
@Message boxes
%Plain
$response=VpMessageBox(window,'title','message')
%OK/Cancel
$response=VpMessageBox(window,'title','message')
%Yes/No
$response=VpMessageBox(window,'title','message','YESNO')
%Yes/No/Cancel
$response=VpMessageBox(window,'title','message','YESNOCNCL')
%Retry/Cancel
$response=VpMessageBox(window,'title','message','RETRY')
%Ignore/Cancel
$response=VpMessageBox(window,'title','message','IGNORE')
@Rexx Constructs
%If-THEN-else
$IF value = 0 THEN
DO
END
ELSE
DO
END
%Iterative loop
$DO index = 1 to 100 by 1
END
%Do while loop
$DO WHILE value > 0
END
%Do until loop
$DO UNTIL value > 0
END
%Select when
$SELECT
WHEN value > 0
THEN
WHEN value = 0
THEN
WHEN value < 0
THEN
OTHERWISE
END
%Greater than
$>
%Less than
$<
%Equal
$= or ==
%Not equal
$<> or \=
%CrLf
$crlf=d2c(13)||d2c(10)
%And
$&
%Or
$|
%Not
$^ or \
%Procedure
$PROCEDURE EXPOSE Valuename /* Procedure must follow imidiately after the label ! */
%Signal
$SIGNAL labelname
%Signal off
$SIGNAL OFF ERROR
SIGNAL OFF FAILURE
SIGNAL OFF HALT
SIGNAL OFF NOVALUE
SIGNAL OFF SYNTAX
SIGNAL OFF NOTREADY
%Signal on
$SIGNAL ON ERROR NAME labelname
SIGNAL ON FAILURE NAME labelname
SIGNAL ON HALT NAME labelname
SIGNAL ON NOVALUE NAME labelname
SIGNAL ON SYNTAX NAME labelname
SIGNAL ON NOTREADY NAME labelname
@Window management
%Size/position window
$CALL VpWindow window,"SETPOS", x, y, xsize, ysize
%Get window size
$parse value VpWindow(window,"GETSIZE") with x y
%Get window position
$parse value VpWindow(window,"GETPOS") with x y
%Set window title
$CALL VpWindow window,"SETTITLE",value
%Close window
$CALL VpWindow window,"CLOSE"
%Show window
$CALL VpWindow window,"SHOW"
%Hide window
$CALL VpWindow window,"HIDE"
%Make window active
$CALL VpWindow window,"ACTIVATE"
%Minimize window
$CALL VpWindow window,"MINIMIZE"
%Maximze window
$CALL VpWindow window,"MAXIMIZE"
%Restore window
$CALL VpWindow window,"RESTORE"
%Get screen size
$parse value VpWindow(window,"GETSCREENSIZE")with x y
%Set window icon
$CALL VpWindow window, "SETICON", value
%Set form parent
$call VpWindow window, 'SETPARENT', parent
%Set form owner
$call VpWindow window, 'SETOWNER', owner
%Load resource string
$value=VpWindow(window, 'LOADSTRING', id)
%Set window icon
$call VpWindow window, 'SETICON', iconhandle
%Set RGB forecolor
$call VpWindow window, 'FORECOLORRGB', rgbvalue
%Set RGB backcolor
$call VpWindow window, 'BACKCOLORRGB', rgbvalue
%Set forecolor
$call VpWindow window, 'FORECOLOR', colorname
%Set backcolor
$call VpWindow window, 'BACKCOLOR', colorname
%Get RGB forecolor
$rc=VpWindow(window, 'GETFORECOLORRGB')
%Get RGB backcolor
$rc=VpWindow(window, 'GETBACKCOLORRGB')
%Set font
$call VpWindow window, 'FONT', '10.Helv'
%Get font
$rc=VpWindow(window, 'GETFONT')
%Set pointer position
$call VpWindow window, 'SETPOINTERPOS', x, y
%Get pointer position
$xy=VpWindow(window, 'GETPOINTERPOS')
%Set information line text
$CALL VpWindow window, "SETINFOLINE", value
@Miscellaneous
%Get date
$value = DATE()
%Get time
$value = TIME()
%Beep
$/* 1000 Hz for 200 millisec */
CALL VpBeep 1000,200
%Set form drag info
$/* max num items, type, rendering, moveok, copyok, linkok, default */
CALL VpWindow window,"SETFORMDRAGINFO",1,"Plain Text","<DRM_OS2FILE,DRF_TEXT>",1,1,1,"MOVE"
%Start drag
$draginfo.0=1 /* count */
draginfo.1=1 /* moveable */
draginfo.2=1 /* copyable */
draginfo.3=1 /* linkable */
draginfo.4=0 /* optional icon */
draginfo.1.1="Plain Text" /* type */
draginfo.1.2="<DRM_OS2FILE,DRF_TEXT>" /* rendering */
draginfo.1.3="c:\" /* source dir */
draginfo.1.4=filename /* source */
draginfo.1.5=filename /* target */
CALL VpWindow window,"DRAGSTART","DRAGINFO."
%Set pointer
$CALL VpWindow window,"SETPOINTER",value
%Start timer
$/* duration in 1/1000 secs */
CALL VpWindow window,"STARTTIMER",duration
%Stop timer
$CALL VpWindow window,"STOPTIMER"
%Set clipboard
$CALL VpWindow window,"SETCLIPBOARD","TEXT",value
%Get clipboard
$value=VpWindow(window,"GETCLIPBOARD","TEXT")
@Threads
%Start thread
$tid=VpThread('START',window, filename, arg1, arg2)
%Kill thread
$rc=VpThread('KILL', tid)
%Suspend a thread
$rc=VpThread('SUSPEND', tid)
%Resuming a thread
$rc=VpThread('RESUME', tid)
%Get process identifier
$pid=VpThread('GETPID')
%Get thread identifier
$tid=VpThread('GETTID')
%Change thread priority
$rc=VpThread('SETPRIORITY', priority, tid)
%Get thread list
$rc=VpThread('GETIDLIST', 'threadlst.')
%Pause thread execution
$rc=VpThread('SLEEP', time)
@Application variables
%Set variable
$CALL VpAppVariable 'SET', variable, value
%Get variable
$value=VpAppVariable('GET', variable)
@Semaphores
%Create MUTEX
$semid=VpSemaphore('MUTEX', 'CREATE', semname, initstate)
%Open MUTEX
$semid=VpSemaphore('MUTEX', 'OPEN', semname)
%Request access MUTEX
$rc=VpSemaphore('MUTEX', 'WAITREQUEST', semid, timeout)
%Release access MUTEX
$rc=VpSemaphore('MUTEX', 'POSTRELEASE', semid)
%Query MUTEX
$value=VpSemaphore('MUTEX', 'QUERY', semid, 'OWNER.')
%Close MUTEX
$rc=VpSemaphore('MUTEX', 'CLOSE', semid)
%Close event
$semid=VpSemaphore('EVENT', 'CREATE', semname, initstate)
%Open event
$semid=VpSemaphore('EVENT', 'OPEN', semname)
%Wat for event
$rc=VpSemaphore('EVENT', 'WAITREQUEST', semid, timeout)
%Post event
$rc=VpSemaphore('EVENT', 'POSTRELEASE', semid)
%Reset event
$rc=VpSemaphore('EVENT', 'RESET', semid)
%Query event
$value=VpSemaphore('EVENT', 'QUERY', semid)
%Close event
$rc=VpSemaphore('EVENT', 'CLOSE', semid)
%Load VpSemaphore
$Call RxFuncAdd 'VpSemaphore','VPUtil','VpSemaphore'
%Drop VpSemaphore
$Call RxFuncDrop 'VpSemaphore'
@VpPrint & VpFont
%Print List
$CALL VpPrint window, "title", "subtitle", "Page %d", "LIST","10.Helvetica"
%Print Array
$CALL VpPrint window, "title", "subtitle", "Page %d", "ARRAY","10.Helvetica","DATA."
%Print Form
$CALL VpPrint window, "title", "subtitle", "Page %d", "FORM","10.Helvetica"
%Font Dialog
$value=VpFontDialog(window, "10.Courier")
%Load Print/Font Dialog
$Call RxFuncAdd 'VpPrint','VPUtil','VpPrint'
Call RxFuncAdd 'VpFontDialog','VPUtil','VPFontDialog'
%Drop Print/Font Dialog
$Call RxFuncDrop 'VpPrint'
Call RxFuncDrop 'VpFontDialog'
%Load VpUtil
$Call RxFuncAdd 'VpUtilLoadFuncs','VPUtil','VpUtilLoadFuncs'
Call VpUtilLoadFuncs
%Drop VpUtil
$Call RxFuncDrop 'VpUtilLoadFuncs'
@VpSharedMemory
%Access
$memhandle=VpSharedMemory("GETSHARED",name)
%Allocate
$memhandle=VpSharedMemory("ALLOC",name,size)
%Free
$CALL VpSharedMemory "FREE", memhandle
%Get contents
$value=VpSharedMemory("GET", memhandle)
%Set contents
$CALL VpSharedMemory "SET", memhandle, value
@Rexxutil
%Query & Load
$IF RxFuncQuery('SysDropFuncs')
THEN DO;
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
call SysLoadFuncs;
END;
%Load RexxUtil
$/* Load RexxUtil.DLL */
CALL RxFuncAdd 'SysLoadFuncs','Rexxutil','SysLoadFuncs'
CALL SysLoadFuncs
%Query RexxUtil
$rc = RxFuncQuery('SysloadFuncs') /* rc is 0 if SysLoadFuncs is not loaded */
%Drop RexxUtil
$CALL SysDropFuncs
%RxMessageBox
$Action = RxMessageBox(text,title,bottom,symbol)
@System Information
%Get Boot drive
$/* Gets boot_drive, letter only */
boot_drive = left(value('runworkplace',,'os2environment'),1)
%Set BeginLibPath
$/* Set BeginLibPath */
set BeginLibPath value
@Sys - object functions
%SysCopyObject
$rc = SysCopyObject(source,destination)
%SysCreateObject
$rc = SysCreateObject('WPProgram', 'title', '<WP_DESKTOP>','EXENAME=filename;STARTUPDIR=dir;PROGTYPE=PM;', 'U')
%SysDeregisterObjectClass
$rc = SysDeregisterObjectClass(classname)
%SysDestroyObject
$rc = SysDestroyObject(objectname)
%SysMoveObject
$rc = SysMoveObject(source,destination)
%SysOpenObject
$rc = SysOpenObject(objectname, display, mark)
%SysQueryClassList
$CALL SysQueryClassList 'stem.'
%SysRegisterObjectClass
$rc = SysRegisterObjectClass(name,module)
@Sys - file functions
%SysDriveInfo
$Info = SysDriveInfo(drive)
%SysDriveMap
$List = SysDriveMap(drive,options)
%SysFileTree
$CALL SysFileTree filename,'List',option,attribute
%SysFileSearch
$CALL SysFileSearch search value,file,'List',options
%SysGetMessage
$Message = SysGetMessage(number,file)
%SysIni - query value
$value = SysIni(file,app,key)
%SysIni - query all apps
$rc = SysIni(file,'ALL:','List')
%SysMkDir
$CALL SysMkDir directory
%SysPutEA
$CALL SysPutEA file, EAname, value
%SysRmDir
$CALL SysRmDir directory
%SysSetIcon
$rc = SysSetIcon(file,iconfile)
%SysTempFileName
$file = SysTempFileName(template,filter)
@Sys - other functions
%SysCls
$CALL SysCls
%SysCurPos
$pos = SysCurPos(row,col)
%SysCurState
$CALL SysCurState 'ON' or 'OFF'
%SysGetKey
$key = SysGetKey('ECHO')
key = SysGetKey('NOECHO')
%SysOS2Ver
$Version = SysOS2Ver()
%SysSleep
$CALL SysSleep seconds
%SysTextScreenRead
$line = SysTextScreenRead(row,col,length)
%SysTextScreenSize
$rc =SysTextScreenSize()
@File Info
%Charin file to a variable
$/* Charin file to a variable */
value = CHARIN(filename,1,(CHARS(filename))
rc=STREAM(filename,'c','close')
%Close file
$/* Close file */
CALL STREAM filename, 'C', 'CLOSE'
%Does file exist?
$/* Does file exist? */
value = (STREAM(filename, 'C', 'QUERY EXISTS') <> '')
%Get file date & time stamp
$/* Get file date & time stamp */
Parse Value STREAM(filename, 'C', 'QUERY DATETIME') With fdate ftime
Parse Var fdate mm '-' dd '-' 'yy'
Parse Var ftime hh ':' mm ':' ss
%Get file size in bytes
$/* Get file size in bytes */
value = STREAM(filename, 'C', 'QUERY SIZE')
%Get file status
$/* Get file status */
value = STREAM(filename, 'S')
%Get file status with error code
$/* Get file status with error code */
value = STREAM(filename, 'D')
%More characters in the file?
$/* More characters in the file? */
value = CHARS(file)
%More lines in the file?
$/* More lines in the file? */
value = LINES(file)
%Open file for reading
$/* Open file for reading */
/* rc will hold 'READY' if successful */
rc = STREAM(filename, 'C', 'OPEN READ')
%Open file for reading & writing
$/* Open file for reading & writing */
/* rc will hold 'READY' if successful */
rc = STREAM(filename, 'C', 'OPEN')
%Open file for writing
$/* Open file for writing */
/* rc will hold 'READY' if successful */
rc = STREAM(filename, 'C', 'OPEN WRITE')
%Read a character from the file
$/* Read a character from the file */
value = CHARIN(filename)
%Read a line from the file
$/* Read a line from the file */
value = LINEIN(filename)
%Set read/write position in file backward from current position
$/* Set read/write position in file backward from current position */
Call STREAM filename, 'C', 'SEEK -'value
%Set read/write position in file forward from current position
$/* Set read/write position in file forward from current position */
Call STREAM filename, 'C', 'SEEK +'value
%Set read/write position in file from end of file
$/* Set read/write position in file from end of file */
Call STREAM filename, 'C', 'SEEK <'value
%Set read/write position in file from start of file
$/* Set read/write position in file from start of file */
Call STREAM filename, 'C', 'SEEK ='value
%Write a line to the file
$/* Write a line to the file */
CALL LINEOUT filename, value
%Write a string of characters to the file
$/* Write a string of characters to the file */
CALL CHAROUT filename, value
@I/O functions
%Address
$ADDRESS environment
%Charin
$Value = CHARIN(name,start,length)
%Charin file to variable
$value = CHARIN(filename,1,(CHARS(filename))
rc=stream(filename,'c','close')
%Charout
$CALL CHAROUT filename,string
%Chars
$value = CHARS(filename)
%Directroy
$Value = DIRECTORY() /* returns current directory */
CALL DIRECTORY directory /* switch to directory */
%Filespec
$Value = FILESPEC('D',filename) /* returns drive */
Value = FILESPEC('P',filename) /* returns the path */
Value = FILESPEC('N',filename /* returns the filename */
%Linein
$value = LINEIN(filename,line)
%Lineout
$CALL LINEOUT filename,string,line
%Lines
$lines = LINES(filename)
@Parse
%Parse Arg
$PARSE ARG string
%Parse Pull
$PARSE PULL string
%Parse Source
$PARSE SOURCE string
%Parse Value
$PARSE VALUE function WITH template /* Parse Value TIME() with Std ':' Min ':' Sec */
%Parse Var
$PARSE VAR string first rest
%Parse Version
$PARSE VERSION REXXVERSION
@Stream
%Stream - Open
$CALL STREAM file,'C','OPEN'
%Stream - Open Read
$CAll STREAM file,'C','OPEN READ'
%Stream - Open Write
$CALL STREAM file,'C','OPEN WRITE'
%Stream - Seek
$CALL STREAM file,'C','SEEK number'
%Stream - Close
$CALL STREAM file,'C','CLOSE'
%Stream - filename
$filename = STREAM(file,'C','QUERRY EXIST')
%Stream - size
$size = STREAM(file,'C','QUERRY SIZE')
%Stream - time/Date
$timeinfo = STREAM(file,'C','QUERRY DATETIME')
%Stream - description
$Value = STREAM(file,'D')
%Stream - status
$Value = STREAM(file,'S')
@Queue
%RxQueue - GET
$Queue = RxQueue('GET')
%RxQueue - Create
$Name = RxQueue('CREATE',name)
%RxQueue - Set
$rc = RxQueue('SET',name)
%RxQueue - Delete
$rc = RxQueue('DELETE',name)
%Queued
$Zeilen = QUEUED() /* returns the number of lines in queue */
%Queue
$QUEUE value /* append value to the end of the queue */
%Pull
$PULL Zeile /* get 1. line of queue */
%Push
$PUSH value /* insert value at the beginning of the queue */
@Strings
%B2X
$value = B2X(char)
%Center
$value = CENTER(string,lenght,fillchar)
%Chars
$value = CHARS(name)
%Compare
$value = COMPARE(string1,string2)
%Copies
$value = COPIES(string,number)
%C2D
$value = C2D(char)
%C2X
$value = C2X(char)
%Delstr
$value = DELSTR(string,start,length)
%Delword
$value = DELWORD(string,start,length)
%D2C
$value = D2C(number)
%D2X
$value = D2X(number)
%Insert
$value = INSERT(new,target,start)
%Lastpos
$value = LASTPOS(needle,haystack,start)
%Left
$value = LEFT(string,length,fillchar)
%Length
$value = LENGTH(string)
%Pos
$value = POS(needle,haystack,start)
%Overlay
$value = OVERLAY(new,target,start,length,fillchar)
%Reverse
$value = REVERSE(string)
%Right
$value = RIGHT(string,length,fillchar)
%Space
$value = SPACE(string,number,fillchar)
%Strip
$value = STRIP(string,option,fillchar)
%Substr
$value = SUBSTR(string,start,length)
%Subword
$value = SUBWORD(string,start,length)
%Translate
$value = TRANSLATE(string) /* convert string to uppercase */
/* replace a character within the string with an other character */
value = TRANSLATE(string,tableo,tablei,pad)
%Verify
$value = VERIFY(string1,string2)
%Word
$value = WORD(string,pos)
%Wordindex
$index = WORDINDEX(string,word)
%Wordlength
$value = WORDLENGTH(string,pos)
%Wordpos
$value = WORDPOS(needle,haystack,start)
%Words
$value = WORDS(string)
%X2B
$value = X2B(hex char)
%X2C
$value = X2C(hex char)
%X2D
$value = X2D(hex char)
%Xrange
$value = XRANGE(start,end)
@Math functions
%ABS
$value = ABS(number)
%Digits
$value = DIGITS()
%Format
$value = FORMAT(number,before,after)
%Form
$value = FORM()
%Fuzz
$value = FUZZ()
%Numeric Digits
$NUMERIC DIGITS value
%Numeric Form
$NUMERIC FORM 'SCIENTIFIC' or 'ENGINEERING'
%Numeric Fuzz
$NUMERIC FUZZ value
%Max
$value = MAX(number1,number2,...,number20)
%Min
$value = MIN(number1,number2,....,number20)
%Random
$value = RANDOM(min,max)
%Sign
$value = SIGN(number)
%Trunc
$Value = TRUNC(number,n)
@Other functions
%Abbrev
$value = ABBREV(information,info,length)
%Beep
$CALL BEEP frequency,duration
%Condition
$rc = CONDITION('C') /* Condition Name */
rc = CONDITION('I') /* Condition Instruction */
rc = CONDITION('D') /* Condition Description */
rc = CONDITION('S') /* Condition Status */
%Datatype
$Type = DATATYPE(string)
%Date
$value = DATE() /* dd mm yyyy */
value = DATE('B') /* days since January 1, 0001 */
value = DATE('D') /* days since January 1, of the current year */
value = DATE('E') /* dd/mm/yy European format */
value = DATE('L') /* language-dependent format*/
value = DATE('M') /* name of the month */
value = DATE('N') /* dd mon yyyy */
value = DATE('O') /* yy/mm/ddt */
value = DATE('S') /* yyyymmdd */
value = DATE('U') /* mm/dd/yy */
value = DATE('W') /* day of week */
%Drop
$DROP value
%Sourceline
$line = SOURCELINE(line)
%Symbol
$status = SYMBOL(value)
%Time
$value = TIME() /* hh:mm:ss */
value = TIME('C') /* hh:mmxx */
value = TIME('E') /* Elapsed */
value = TIME('H') /* hh */
value = TIME('M') /* mmmm since midnight */
value = TIME('L') /* hh:mm:ss:uu0000 */
value = TIME('N') /* hh:mm:ss */
value = TIME('R') /* Reset elapsed */
%value
$value = VALUE(name,newvalue,environment)
/* example */
path = VALUE('Path',,'OS2ENVIRONMENT')