!SHORTAddBackSlash$ Add backslash to file\path PURPOSE : Add a backslash to a path/filename DECLARATION : DECLARE FUNCTION AddBackSlash (STRING) SYNTAX : Newpath$=AddBackSlash$(Path$) - Path$ = path/file to add the backslash to !SHORTBleep Makes an attention sound PURPOSE : Makes an attention sound DECLARATION : DECLARE FUNCTION Bleep () SYNTAX : Bleep !SHORTBleepBadKey Makes an sound when bad key is pressed PURPOSE : Makes an sound when bad key is pressed DECLARATION : DECLARE FUNCTION BleepBadKey () SYNTAX : BleepBadKey !SHORTBleepDown Makes a 'down' attention sound PURPOSE : Makes a 'down' attention sound DECLARATION : DECLARE FUNCTION BleepDown () SYNTAX : BleepDown !SHORTBleep Makes a 'happy' attention sound PURPOSE : Makes a 'happy' attention sound DECLARATION : DECLARE FUNCTION BleepHappy () SYNTAX : BleepHappy !SHORTCapitalizeAll Capitalizes all first letters of words in a text PURPOSE : Capitalizes all first letters of words in a text DECLARATION : DECLARE FUNCTION CapitalizeAll (STRING) SYNTAX : Call CapitalizeAll (Text$) - Text$ = the text in which all first letters off all words have to be capitalized RETURNVALUES : Text$ !SHORTCapitalizeWord Capitalizes the first letter of a given word PURPOSE : Capitalizes the first letter of a given word DECLARATION : DECLARE FUNCTION CapitalizeWord (STRING) SYNTAX : Call CapitalizeWord (Word$) - Word$ = the word of which the first letter has to be capitalized RETURNVALUES : Word$ !SHORTCapsLockOff Sets CapsLock off PURPOSE : Sets CapsLock off DECLARATION : DECLARE FUNCTION CapsLockOff () SYNTAX : Call CapsLockOff !SHORTCapsLockOn Sets CapsLock on PURPOSE : Sets CapsLock on DECLARATION : DECLARE FUNCTION CapsLockOn () SYNTAX : Call CapsLockOn !SHORTClearKeyBuffer Removes all keystrokes from the keyboardbuffer PURPOSE : Removes all keystrokes from the keyboardbuffer DECLARATION : DECLARE FUNCTION ClearKeyBuffer () SYNTAX : ClearKeyBuffer !SHORTComputerPart Draws computerparts on screen PURPOSE : Draws computerparts on screen DECLARATION : DECLARE FUNCTION ComputerPart(INTEGER,INTEGER,INTEGER,_ INTEGER,INTEGER) SYNTAX : t=ComputerPart(ULRow%,ULCol%,ForeGround%,BackGround%,Type%) - ULRow% = upperleft row of the drawing - ULCol% = upperleft column of the drawing - ForeGround% = attribute for foreground - Background% = attribute for background - Type% 1 = PC + Screen + KeyBoard 2 = Printer !SHORTCopyFile% Copy a file PURPOSE : Copy a file DECLARATION : DECLARE FUNCTION CopyFile (STRING,STRING,INTEGER,INTEGER,_ INTEGER,INTEGER) SYNTAX : CopyFile(SourceFile$,TargetFile$,BarType%,Line%,Foreground%,_ BackGround%) - SourceFile$ = the file that has to be copied - TargetFile$ = the new path\ filename SourceFile$ has to be copied to - BarType% = 1 - a progressionbar will be displayed 0 - no screen output - Line% = the line where progressionbar will be displayed - ForeGround% = attribute for foreground - Background% = attribute for background RETURNVALUES : 0 = filecopy completed succesfully -1 = SourceFile$ not found -2 = Can't create TargetFile$ !SHORTCenterLPrint LPrints a string in the center of the paper PURPOSE : LPrints a string in the center of the paper DECLARATION : DECLARE FUNCTION CenterLPrint (STRING) SYNTAX : Call CenterLPrint(Text$) - Text$ = the string that has to be printed !SHORTCenterPrint Prints a string in the center of a given line PURPOSE : Prints a string in the center of a given line DECLARATION : DECLARE FUNCTION CenterPrint (STRING,INTEGER,INTEGER,INTEGER) SYNTAX : Call CenterPrint(Text$,XPos%,ForeGround%,BackGround%) - Text$ = the string that has to be printed - XPos% = the row the string has to be printed on - ForeGround% = attribute for foreground - Background% = attribute for background !SHORTChangeDir% change directory and returns errorlevel PURPOSE : change directory and returns errorlevel DECLARATION : DECLARE FUNCTION ChangeDir% (STRING) SYNTAX : print ChangeDir% (Directory$) - Directory$ the directory to change to RETURNVALUES : -1 Path not found 0 Directory changed successfully !SHORTCurrentDir$ returns the current directory PURPOSE : returns the current directory DECLARATION : DECLARE FUNCTION Currentdir$ () SYNTAX : print CurrentDir$ !SHORTCurrentDrive$ returns the current drive PURPOSE : returns the current drive DECLARATION : DECLARE FUNCTION Currentdrive$ () SYNTAX : print CurrentDrive$ !SHORTDate2Num& Calculates a number for the given date PURPOSE : Calculates a number for the given date DECLARATION : DECLARE FUNCTION Date2Num& (STRING,INTEGER) SYNTAX : Print Date2number&(Dat$,Type) - Dat$ = the date you want a number to be calculated for - Type% 1= inputdate format is DD-MM-(YY)YY 2= inputdate format is MM-DD-(YY)YY !SHORTDateToWord$ Converts month-figure to word ( only MM-DD-(YY)YY ) PURPOSE : Converts month-figure to word ( only MM-DD-(YY)YY ) DECLARATION : DECLARE FUNCTION DateToWord$ (STRING,INTEGER) SYNTAX : print DateToWord$(Date$,countryCode%) - Date$ is the date-string to be converted - CountryCode 1 = USA, Canada, England 31 = Holland 32 = Belgium ( dutch-speaking part ) 33 = France 34 = Spain 38 = Yougoslavia 39 = Italy 42 = Chechoslowakia 48 = Poland 49 = Germany 62 = Indonesia 358 = Finland REMARK : If you have additions or corrections to this routine for the language of your country or an other language you speak, please send me a list with names of the days of the week and the names of the months. You can reach me : FAX (+31)206388603 BBS (+31)365349430 MAIL Schapenmeent 147 1357 GM Almere-Haven Holland !SHORTDayOfWeek$ Returns day of week in words ( only MM-DD-(YY)YY ) PURPOSE : Returns day of week in words ( only MM-DD-(YY)YY ) DECLARATION : DECLARE FUNCTION DayOfWeek$ (STRING,INTEGER) SYNTAX : print DayOfWeek$(Date$,countryCode%) - Date$ is the date-string of which the day has to be calculated - CountryCode 1 = USA, Canada, England 31 = Holland 32 = Belgium ( dutch-speaking part ) 33 = France 34 = Spain 38 = Yougoslavia 39 = Italy 42 = Chechoslowakia 45 = Danmark 46 = Sweden 47 = Norway 48 = Poland 49 = Germany 62 = Indonesia 351 = Portugal 358 = Finland REMARK : If you have additions or corrections to this routine for the language of your country or an other language you speak, please send me a list with names of the days of the week and the names of the months. You can reach me : FAX (+31)206388603 BBS (+31)365349430 MAIL Schapenmeent 147 1357 GM Almere-Haven Holland !SHORTDirExist% Checks if a given directory exists PURPOSE : Checks if a given directory exists DECLARATION : DECLARE FUNCTION DirExist% (STRING) SYNTAX : print DirExist%(Path$) - Path$ = path to be checked RETURNVALUES : -1 -Directory does not exist 0 -Directory exists !SHORTDiskFree& Calculates free diskspace on a specific drive PURPOSE : Calculates free diskspace on a specific drive DECLARATION : DECLARE FUNCTION DiskFree& (STRING) SYNTAX : Print DiskFree&(Drive$) - Drive$ is the driveletter of the specific drive (no ':') !SHORTDiskUsed& Calculates used diskspace on a specific drive PURPOSE : Calculates used diskspace on a specific drive DECLARATION : DECLARE FUNCTION DiskUsed& (STRING) SYNTAX : Print DiskUsed&(Drive$) - Drive$ is the driveletter of the specific drive (no ':') !SHORTDiskTotal& Calculates total diskspace on a specific drive PURPOSE : Calculates total diskspace on a specific drive DECLARATION : DECLARE FUNCTION DiskTotal& (STRING) SYNTAX : Print DiskTotal&(Drive$) - Drive$ is the driveletter of the specific drive (no ':') !SHORTDosVer$ Returns the Dos Version PURPOSE : Returns the Dos Version DECLARATION : DECLARE FUNCTION DosVer$ () SYNTAX : Print DosVer$ !SHORTEurodate$ Converts USA-date notation to European date notation PURPOSE : Converts USA-date notation to European date notation so, MM-DD-(YY)YY is converted to DD-MM-(YY)YY DECLARATION : DECLARE FUNCTION EuroDate$ (STRING) SYNTAX : print Eurodate$(Date$) - Date$ is the USA notation of the date to be converted !SHORTFileExist% Checks if a given file exists PURPOSE : Checks if a given file exists DECLARATION : DECLARE FUNCTION FileExist% (STRING) SYNTAX : print FileExist%(Path$) - Path$ = path\filename to be checked RETURNVALUES : -1 -File does not exist 0 -File exists !SHORTFilelen& Calculates lenght of a specified file PURPOSE : Calculates lenght of a specified file DECLARATION : DECLARE FUNCTION Filelen& (STRING) SYNTAX : print Filelen&(Filename$) - Filename$ is the name of the file the length has to be calculated from !SHORTFinish Close open files, reset color, quit with errorlevel PURPOSE : Close open files, reset color, quit program with errorlevel DECLARATION : DECLARE FUNCTION FINISH (INTEGER) SYNTAX : Finish(errorlevel%) - errorlevel% = the value for the errorlevel you want to let the program pass to the calling program !SHORTFloppyType% Returns the type of floppydrive installed PURPOSE : Returns the type of floppydrive installed DECLARATION : DECLARE FUNCTION FloppyType (STRING) SYNTAX : print FloppyDrive% (DiskDrive$) - DiskDrive$ A: or B: RETURNVALUES : -1 Not a valid floppydrive 0 Floppydrive not installed 1 360 Kb floppydrive 2 1.2 Mb floppydrive 3 720 Kb floppydrive 4 1.44 Mb floppydrive 5 2.88 Mb floppydrive !SHORTFormatMoney$ converts double-precision var to string PURPOSE : converts double-precision var to string DECLARATION : DECLARE FUNCTION FormatMoney$(DOUBLE) SYNTAX : print FormatMoney$(Number#) - Number# the double precision variable that has to be converted to a string !SHORTFormFeed Sends a formfeed to the printer PURPOSE : Sends a formfeed to the printer DECLARATION : DECLARE FUNCTION FormFeed () SYNTAX : Call FormFeed !SHORTGetAnyKey$ Get the key a user pressed PURPOSE : Get the key a user pressed DECLARATION : DECLARE FUNCTION GetAnyKey () SYNTAX : print GetAnyKey$ !SHORTGetAKey$ Check if the key a user pressed is valid PURPOSE : Get the key a user pressed. This routine only accepts the keys you defined in ACCEPABLE$ DECLARATION : DECLARE FUNCTION GetAKey (STRING,INTEGER) SYNTAX : print GetAKey$(Acceptable$,CaseInt%) - acceptable$ = the keystrokes that you define valid kestrokes - CaseInt% 0 = keystrokes don't have to match upper\lower case 1 = keystrokes have to match upper\lower case !SHORTGetCpu& Returns the type of CPU PURPOSE : Returns the type of CPU DECLARATION : DECLARE FUNCTION GetCpu& SYNTAX : print GetCpu& !SHORTGetCursorPos Gets the coordinates of the cursor PURPOSE : Gets the coordinates of the cursor DECLARATION : DECLARE FUNCTION GetCursorpos (INTEGER,INTEGER) SYNTAX : GetCursorPos (XPos%,YPos%) RETURNVALUES : XPos% = current x-coordinate of the cursor YPos% = current y-coordinate of the cursor !SHORTGetDir Puts filenames matching a filemask to an array PURPOSE : Puts filenames matching a filemask to an array DECLARATION : DECLARE SUB Getdir (STRING ARRAY,STRING,INTEGER) SYNTAX : Call GetDir (FilesFound$(),FileMask$,TotalFiles%) - FilesFound$() = the array that has to be filled - Filemask$ = the mask files have to match to - Totalfiles% = number of files that match FileMask$ REMARK : example to get the directory of all .EXE-files in the directory C:\WINDOWS $COMPILE EXE $LIB ALL - $ERROR ALL- $LINK "PSLIB002.PBL" cls 'þ give the file-mask you want info about filespec$="c:\windows\*.exe" 'þ first lets see how many files match the filemask TotalFiles%=NumOffFiles%(filespec$) redim FilesFound$(TotalFiles%) 'þ check out the directory call GetDir(FilesFound$(),filemask$,TotalFiles%) 'þ print results to screen for x%=1 to TotalFiles% print FilesFound$(x%) next !SHORTGetKeyb% Checks for 101key keyboard and 101key BIOS PURPOSE : Checks for 101key keyboard and 101key BIOS DECLARATION : DECLARE FUNCTION GetKeyb% () SYNTAX : print GetKeyb% RETURNVALUES : 0 no 101key keyboard and BIOS 1 101key keyboard present, no 101key BIOS present 2 no 101key keyboard present, 101key BIOS present 3 101key keyboard present, 101key BIOS present !SHORTGetMath% checks for pressence of Math-coprocessor PURPOSE : checks for pressence of Math-coprocessor DECLARATION : DECLARE FUNCTION GetMath% SYNTAX : print GetMath% RETURNVALUES : 1 = Math-coprocessor found 0 = Math-coprocessor not found !SHORTGetVerify% Returns the status of DOS-verify PURPOSE : Returns the status of DOS-verify DECLARATION : DECLARE FUNCTION GetVerify% () SYNTAX : print GetVerify% RETURNVALUES : 1 = verify is on 2 = cerify is off !SHORTInitColor Check for momochome and give color-codes a name PURPOSE : Assign color-values to color-names DECLARATION : DECLARE FUNCTION InitColor (INTEGER,INTEGER,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER,INTEGER) SYNTAX : CALL InitColor(black%,blue%,green%,cyan%,red%,maganta%,_ brown%, white%, grey%, lblue%, lgreen%,_ lcyan%, lred%, lmaganta%, yellow%,lwhite%) RETURNVALUES : if IsColor% = 1 if IsColor% = -1 ----------------------------------------- black% = 0 black% = 0 blue% = 1 blue% = 0 green% = 2 green% = 0 cyan% = 3 cyan% = 0 red% = 4 red% = 0 maganta% = 5 maganta% = 0 brown% = 6 brown% = 0 white% = 7 white% = 7 grey% = 8 grey% = 0 lblue% = 9 lblue% = 0 lgreen% = 10 lgreen% = 0 lcyan% = 11 lcyan% = 0 lred% = 12 lred% = 0 lmaganta% = 13 lmaganta% = 0 yellow% = 14 yellow% = 0 lwhite% = 15 lwhite% = 15 !SHORTInsertOff Sets insert off PURPOSE : Sets insert off DECLARATION : DECLARE FUNCTION InsertOff () SYNTAX : Call InsertOff !SHORTInsertOn Sets insert on PURPOSE : Sets insert on DECLARATION : DECLARE FUNCTION InsertOn () SYNTAX : Call InsertOn !SHORTIsColor% Check for monochrome PURPOSE : Check if monitor is monochrome or non-monochrome DECLARATION : DECLARE FUNCTION IsColor% SYNTAX : print IsColor% RETURNVALUES : -1 monitor is monochrome 1 monitor is monochrome !SHORTIsDateValid% Check if given date is a valid date PURPOSE : Check if given date is a valid date Only works with USA date-format MM-DD-(YY)YY DECLARATION : DECLARE FUNCTION IsDateValid% (STRING) SYNTAX : print IsDateValid%(Date$) - Date$ is the datestring that has to be checked RETURNVALUES : -1 date is not valid 1 date is valid !SHORTIsDesqView% Checks if DesqView is present PURPOSE : Checks if DesqView is present DECLARATION : DECLARE FUNCTION IsDesqview% () SYNTAX : print IsDesqView% RETURNVALUES : 0 Desqview is not present 1 Desqview is present !SHORTIsPrinterReady% Looks if printer is connected and ready PURPOSE : Looks if printer is connected and ready DECLARATION : DECLARE FUNCTION IsPrinterReady% (INTEGER) SYNTAX : Print IsPrinterReady(LPTport%) - LPTport% = number of the paralelport to be checked !SHORTIsWindows% Checks if Windows is present PURPOSE : Checks if Windows is present DECLARATION : DECLARE FUNCTION IsWindows% () SYNTAX : print IsWindows% RETURNVALUES : 0 Windows is not present 1 Windows is present !SHORTLMask$ Adds given characters to the left of a string PURPOSE : Adds given characters to the left of a string DECLARATION : DECLARE FUNCTION LMask$(STRING,INTEGER,STRING) SYNTAX : print LMask$(Tomask$,NewLen%,CharToAdd$) - ToMask$ = the string to which the characters have to be added - NewLen% = length of the string after characters have been added - CharToAdd = the character that has to be added to the string !SHORTMakeBox Draws a box on screen and fills inside with CHR$(32) PURPOSE : Draws a box on screen and fills inside with CHR$(32) DECLARATION : DECLARE FUNCTION MakeBox(INTEGER,INTEGER,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER) SYNTAX : Call MakeBox(XPos%,YPos%,RowLen%,ColLen%,Type%,_ ForeGround%,BackGround%) - XPos% = upperleft corner of the box in rows - YPos% = upperleft corner of the box in columns - RowLen% = length of the box in rows - ColLen% = depth of the box in columns - Type% = 1. ÚÄ¿ 2. ÉÍ» 3. Õ͸ 4. ÖÄ· ³ ³ º º ³ ³ º º ÀÄÙ Èͼ Ô; ÓĽ 5. ÜÜÜ 6. °°° 7. ±±± 8. ²²² Ý Þ ° ° ± ± ² ² ßßß °°° ±±± ²²² - ForeGround% = attribute for foreground - Background% = attribute for background !SHORTMakeDir% Makes a directory and returns errorlevel PURPOSE : Makes a directory and returns errorlevel DECLARATION : DECLARE FUNCTION MakeDir% (STRING) SYNTAX : print Makedir%(Directory$) - Directory$ = the directory that has to be created RETURNVALUES : 0 = directory created succesfully -1 = path not found -2 = access denied !SHORTMakeLongDir Makes directorys several levels deep PURPOSE : Makes directorys several levels deep DECLARATION : DECLARE FUNCTION MakeLongdir (STRING) SYNTAX : MakeLongdir(DirectoryString$) - DirectoryString$ = summary of directorys to create e.g. MakeLongDir("C:\LEVEL1\LEVEL2\LEVEL3\LEVEL4") maximum levels : 10 !!! DirectoryString$ has to include driveletter: !SHORTMemFree& Check for available memory under 640K PURPOSE : Check for available memory under 640K DECLARATION : DECLARE FUNCTION MemFree& () SYNTAX : print MemFree& !SHORTMessageBox Puts a message on screen in a box PURPOSE : Puts a message on screen in a box DECLARATION : DECLARE FUNCTION MessageBox(STRING,STRING,STRING,INTEGER,_ INTEGER,INTEGER,INTEGER) SYNTAX : Call MessageBox(Msg1$,Msg2$,Msg3$,Boxtype%,ULRow%,_ ForeGround%,Background%,TxtForeGround%) - Msg(x)$ = The message you want to be displayed on the screen. Msg1$ must be greater than "". If Msg2$ and/or Msg3$ have the value "" only resp. 1 or 2 lines wil be displayed and the size of the box will be adjusted. - BoxType% = type of box that will be drawn 1. ÚÄ¿ 2. ÉÍ» 3. Õ͸ 4. ÖÄ· ³ ³ º º ³ ³ º º ÀÄÙ Èͼ Ô; ÓĽ - ULRow% = the upper row of the box - ForeGround% = Foregroundcolor of the box - BackGround% = Backgroundcolor of the box - TxtForeGround% = Foregroundcolor of the text in the box REMARKS : Example off using MessageBox $COMPILE EXE $LIB ALL- $ERROR ALL- 'þ $STRING 4 is the minimal value for Savesreen$ $STRING 4 $LINK "DUTCHLIB.PBL" $INCLUDE"DUTCHLIB.INC" 'þ Check for monochrome and assign colors Call InitColor(black%,blue%,green%,cyan%,red%,maganta%,_ brown%, white%, grey%, lblue%, lgreen%,_ lcyan%, lred%, lmaganta%,yellow%,lwhite%) 'þ Make just a screen color white%,blue% for x%=1 to 25 print string$(80,77); next 'þ Declare your messages msg1$="How many Microsoft engeneers does it take to change a lightbulb ?" msg2$="None !" msg3$="Microsoft declares darkness as a standart" 'þ Save the current screen to Tempscreen$ TempScreen$ = SaveScreen$ 'þ Draw the messagebox on the screen Call MessageBox(Msg1$,Msg2$,Msg3$,1,8,blue%,white%,red%) 'þ Wait till user presses a screen Call GetAnykey$ 'þ Restore the original screen Call RestoreScreen (TempScreen$) !SHORTNewsBar scrolls a text over the steen horizontal PURPOSE : scrolls a text over the steen horizontal DECLARATION : DECLARE FUNCTION NewsBar(STRING, INTEGER, INTEGER, INTEGER,_ SINGLE, INTEGER, INTEGER, INTEGER) SYNTAX : print NewsBar(Text$, Row%, Col%, Len%, Interval!, Direction%,_ fcolor%,bcolor%) - Text$ The textstring that has to be displayed - Row% upper-left row - Col% upper-left column - Interval! display speed ( p.e. 0.1 ) - Direction% 0 = displays from right to left 1 = displays from left to right - Fcolor% foregroend color - Bcolor% background color !SHORTNum2Date$ Calculates a date from a given number PURPOSE : Calculates a date from a given number DECLARATION : DECLARE FUNCTION NumberToDate$ (LONG,INTEGER) SYNTAX : Print Numb2Date$(Number&,Type%) - Number = the number you want a date calculated from - Type 1 date will be displayed like DD-MM-YYYY 2 date will be displayed like MM-DD-YYYY !SHORTNumLockOff Sets NumLock off PURPOSE : Sets NumLock off DECLARATION : DECLARE FUNCTION NumLockOff () SYNTAX : Call NumLockOff !SHORTNumLockOn Sets NumLock on PURPOSE : Sets NumLock on DECLARATION : DECLARE FUNCTION NumLockOn () SYNTAX : Call NumLockOn !SHORTNumOffFiles Returns number of files matching a filemask PURPOSE : Returns number of files matching a filemask DECLARATION : DECLARE FUNCTION NumOffFiles% (STRING) SYNTAX : print NumOffFiles% !SHORTPartCls Fills given part of the screen with given character PURPOSE : Fills given part of the screen with given character DECLARATION : DECLARE FUNCTION PartCls (INTEGER,INTEGER,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER) SYNTAX : Call PartCls(Xpos%,Ypos%,ChrsToRight%,ChrsDown%,ForeGround%_ BackGround%) - XPos% = starting row - Ypos% = starting column - ChrsToRight% = columns to fill - Chr$Down% = rows to fill - ForeGround% = attribute for foreground - Background% = attribute for background !SHORTPopMenu Get user-input using a popmenu PURPOSE : Get user-input using a popmenu DECLARATION : DECLARE FUNCTION PopMenu%(STRING ARRAY,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER,INTEGER,_ INTEGER) SYNTAX : Userchoise%=PopMenu%(MenuItem$(),NumItems%,ULRow%,ULCol%,_ ForeGround,BackGround%,ArrowLeft%,_ ArrowRight%) - MenuItem$ = the items from which teh user can make its choise - NumItems% = number of items to choose from - ULRow% = upperleft row of the popmenu - ULCol% = upperleft column of the popmenu - ForeGround% = attribute for foreground - Background% = attribute for background - ArrowLeft% = the returnvalue you assign to UserChoise% when user presses the left arrow key. If LeftArrow% is zero then left arrow is not a possible choise for user - ArrowRight% = the returnvalue you assign to UserChoise% when user presses the right arrow key. If LeftArrow% is zero then right arrow is not a possible choise for user REMARKS : Example of using PopMenu% $COMPILE EXE $LIB ALL- $ERROR ALL- $LINK "DUTCHLIB.PBL" DECLARE FUNCTION PopMenu%(STRING ARRAY,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER,INTEGER,INTEGER) 'þ Let's fill array MenuItem$ with possible choises DIM MenuItem$(9) MenuItem$(1)=" Choise 1 " MenuItem$(2)=" Choise 2 " MenuItem$(3)=" Choise 3 " MenuItem$(4)=" Choise 4 " MenuItem$(5)=" Choise 5 " MenuItem$(6)=" Choise 6 " MenuItem$(7)=" Choise 7 " MenuItem$(8)=" Choise 8 " MenuItem$(9)=" Choise 9 " 'þ Let user make it's choise and read returnvalue UserChoise%=PopMenu%(MenuItem$(),9,5,36,7,0,98,99) cls print "ReturnValue of PopMenu is : ";Userchoise% !SHORTPrintScreen Makes a PrintScreen PURPOSE : Makes a PrintScreen DECLARATION : DECLARE FUNCTION PrintScreen () SYNTAX : Call Printscreen !SHORTPutCursorPos Locates the cursor on the given coordinates PURPOSE : Locates the cursor on the given coordinates DECLARATION : DECLARE FUNCTION PutCursorPos (INTEGER,INTEGER) SYNTAX : PutCursorPos (XPos%,Ypos%) - XPos% = x-coordinate of the cursor - YPos% = y-coordinate of the cursor !SHORTReboot Reboots the computer PURPOSE : Reboots the computer DECLARATION : DECLARE FUNCTION Reboot () SYNTAX : Call Reboot !SHORTRecords% Returns the number of records in Random Access file PURPOSE : Returns the number of records in Random Access file DECLARATION : DECLARE FUNCTION Records% (STRING, INTEGER) SYNTAX : print Records%(FileName$,RecordLength%) - FileName$ Name of the file to bee examened - RecordLength% length of the records in FileName$ RETURNVALUES : -1 File not found value > 0 number of records in the file !SHORTRemoveBackSlash$ Remove backslash from a file\path PURPOSE : Remove a backslash from a path/filename DECLARATION : DECLARE FUNCTION StripBackSlash (STRING) SYNTAX : Newpath$=StripBackSlash$(Path$) - Path$ = path/file to remove the backslash from !SHORTRemoveDir% Removes a directory and returns an errorlevel PURPOSE : Removes a directory and returns an errorlevel DECLARATION : DECLARE FUNCTION RemoveDir% (STRING) SYNTAX : print Removedir%(Directory$) - Directory$ = the directory that has to be removed RETURNVALUES : 0 = directory removed succesfully -1 = path not found -2 = access denied -3 = current directory !SHORTRestoreScreen Restores string made by Savescreen$ to screen PURPOSE : Restores string made by Savescreen$ to screen DECLARATION : DECLARE FUNCTION RestoreScreen$ (STRING) SYNTAX : Call RestoreScreen$ (Sx$) - Sx$ is the string generated bij SaveScreen$ !SHORTRMask$ Adds given characters to the right a string PURPOSE : Adds given characters to the right of a string DECLARATION : DECLARE FUNCTION RMask$(STRING,INTEGER,STRING) SYNTAX : print RMask$(Tomask$,NewLen%,CharToAdd$) - ToMask$ = the string to which the characters have to be added - NewLen% = length of the string after characters have been added - CharToAdd = the character that has to be added to the string !SHORTRulerDown Draws a Ruler on the screen downwards PURPOSE : Draws a Ruler on the screen downwards DECLARATION : DECLARE FUNCTION RulerDown (INTEGER) SYNTAX : Call RulerDown (XPos%) - XPos% = the top-row off the ruler !SHORTRulerUp Draws a Ruler on the screen upwards PURPOSE : Draws a Ruler on the screen upwards DECLARATION : DECLARE FUNCTION RulerUp (INTEGER) SYNTAX : Call RulerUp (XPos%) - XPos% = the top-row off the ruler !SHORTSaveScreen$ Saves screen to string PURPOSE : Saves screen to string DECLARATION : DECLARE FUNCTION SaveScreen$ () SYNTAX : Sx$ = SaveScreen$ REMARK : You can save as many screens free memory allows you. Each screensave gets its own name p.e. S1$, S2$, S3$. The screensaves can be restored anytime in the program using p.e. RestoreScreen (S2$). Advantage off this methode of screensaving is you can restore your screens in the sequence you like. !SHORTScreenToString Converts part of the screen to a string PURPOSE : Converts part of the screen to a string DECLARATION : DECLARE FUNCTION ScreenToString (INTEGER,INTEGER,INTEGER) SYNTAX : Print ScreenToString$ (Xpos%,Ypos%,Count%) - XPos% = starting row - YPos% = starting column - Count% = number of charcters to be read !SHORTScroller Fullscreen and box scroll-routine PURPOSE : Fullscreen and box scroll-routine DECLARATION : DECLARE SUB Scroller(INTEGER,INTEGER,INTEGER,INTEGER,INTEGER,_ STRING ARRAY,INTEGER,INTEGER,SINGLE) SYNTAX : Call Scroller(ULRow%,ULCol%,RowL%,ColL%,Scrolls%,Text$(),_ ForeGround%,BackGround%,Delee!) - ULRow% = upper left row of the scrollbox - ULCol% = upper left column of the scrollbox - Rowl% = size in rows of the scrollbox - ColL% = size in columns of the scrollbox - Text$() = array with text that has to be scrolled inside the scrollbox - ForeGround% = attribute for foreground - Background% = attribute for background - Delee! = delay while scrolling REMARK : Example off a scrollbox cls $COMPILE EXE $LIB ALL- $ERROR ALL- $LINK"PSLIB002.PBL" DECLARE SUB (INTEGER,INTEGER,INTEGER,INTEGER,INTEGER,_ STRING ARRAY,INTEGER,INTEGER,SINGLE) 'þ lets fill that screen FOR x%=1 TO 25 PRINT STRING$(80,176); NEXT 'þ fill array text$ with rubbish DIM text$(100) FOR x%=1 TO 100 text$(x%)=STRING$(21,59+x%) NEXT 'þ call the actual scroll-routine CALL Scroller(3,30,12,21,100,Text$(),7,0,.1) END !SHORTScrollLockOff Sets ScrollLock off PURPOSE : Sets ScrollLock off DECLARATION : DECLARE FUNCTION ScrollLockOff () SYNTAX : Call ScrollLockOff !SHORTScrollLockOn Sets ScrollLock on PURPOSE : Sets ScrollLock on DECLARATION : DECLARE FUNCTION ScrollLockOn () SYNTAX : Call ScrollLockOn !SHORTSecondsToTime$ Calculate time-notation from seconds PURPOSE : Calculate time-notation from seconds DECLARATION : DECLARE FUNCTION SecondsTotime$ (LONG) SYNTAX : Print SecondsToTime$ (Second&) - Second& = number of seconds !SHORTSetVerify% Sets the status of DOS-verify PURPOSE : Sets the status of DOS-verify DECLARATION : DECLARE FUNCTION SetVerify% (INTEGER) SYNTAX : print SetVerify% ( NewStatus% ) - Newstatus% 1 sets verify is on 2 sets verify is off !SHORTSoundEffect A library with various sounds PURPOSE : A library with various sounds DECLARATION : DECLARE FUNCTION Soundeffect (INTEGER) SYNTAX : print SoundEffect (Type%) - Type% a value between 1 and 19 !SHORTSPrint Prints a string at row,col PURPOSE : Prints a string at row,col DECLARATION : DECLARE FUNCTION CPrint (STRING,INTEGER,INTEGER,INTEGER,_ INTEGER) SYNTAX : Call SPrint(Text$,XPos%,YPos%,ForeGround%,BackGround%) - Text$ = the string that has to be printed - XPos% = the row the string has to be printed on - YPos% = the column the string has to be printed at - ForeGround% = attribute for foreground - Background% = attribute for background !SHORTStatusLine Prints a dBase-like status-bar on line 25 PURPOSE : Prints a dBase-like status-bar on line 25 DECLARATION : DECLARE FUNCTION StatusLine (INTEGER,INTEGER) SYNTAX : Call StatusLine(ForeGround%, BackGround%) - ForeGround% = attribute for foreground - Background% = attribute for background !SHORTStringInSeqFile Counts data-lines in sequential file PURPOSE : Counts data-lines in sequential file DECLARATION : DECLARE FUNCTION StringInSeqFile% (STRING) SYNTAX : Print StringInSeqFile%(FileName$) - Filename$ = the path/name of the file the date-lines have to be counted in !SHORTStripFile$ Deletes filename from path PURPOSE : Deletes filename from path DECLARATION : DECLARE FUNCTION StripFile$ (STRING) SYNTAX : print StripFile$(Path$) - Path$ = path the filename has te be deleted from !SHORTStripPath$ Extracts filename from path PURPOSE : Extracts filename from path DECLARATION : DECLARE FUNCTION StripPath$ (STRING) SYNTAX : print StripPath$(Path$) - Path$ = path the filename has te be extracted from !SHORTStripString$ Strips spaces from left and right side of string PURPOSE : Strips spaces from left and right side of string DECLARATION : DECLARE FUNCTION Stripstring$(STRING) SYNTAX : print StripString$(String$) - String$ is the string from which the spaces have to be stripped !SHORTTabLprint Lprint with x tabs before printstring PURPOSE : Lprint with x tabs before printstring DECLARATION : DECLARE FUNCTION TabLPrint (STRING,INTEGER) SYNTAX : Call TabLprint(PrintString$,Tab%) - PrintString$ = The string that has to be printed - Tab% = Number of tabs before PrintString$ !SHORTTimeMinTime$ Returns minutes/time between two times PURPOSE : Returns minutes/time between two times DECLARATION : DECLARE FUNCTION TimeMinTime$(STRING, STRING, INTEGER) SYNTAX : print TimeMinTime$(Time1$, Time2$, Type%) - Time1$ The 'latest' time - Time2$ The 'earliest' time - Type% 1 = returnvalue in minutes 2 = returnvalue in hh:mm RETURNVALUES : -1 - Time2 is later than Time1 !SHORTTimeToSeconds& Calculate number of seconds to time-notation PURPOSE : Calculate number of seconds to time-notation DECLARATION : DECLARE FUNCTION TimeToseconds& (STRING) SYNTAX : Print TimeToSeconds& (Time$) - Time$ = the time-notation that has to be calculated to seconds !SHORTUsadate$ Converts European-date notation to USA-date notation PURPOSE : Converts European-date notation to USA-date notation so, DD-MM-(YY)YY is converted to MM-DD-(YY)YY DECLARATION : DECLARE FUNCTION UsaDate$ (STRING) SYNTAX : print Usadate$(Date$) - Date$ is the European notation of the date to be converted !SHORTUserInput$ Reads input from user PURPOSE : Reads input from user DECLARATION : DECLARE FUNCTION UserInput$ (STRING,INTEGER,INTEGER,INTEGER,_ INTEGER,INTEGER,INTEGER) SYNTAX : Print UserInput$(Default$,GoodChar%,TextLen%,ULRow%,ULCol%,_ ForeGround%,BackGround%) - Defaul$ = is the value of UserInput$ before user enters data. User can change Default$, - GoodChar% = the characters user is allowed to enter. 1 = characters 32 to 126 are allowed 2 = characters 32 to 96 and 123 to 126 are allowed (i.c. only UPPERCASE) 3 = characters 32 to 64 and 91 to 126 are allowed (i.c. only LOWERCASE) 4 = characters 65 to 90 are allowed 5 = characters 48 to 57 and character 46 are allowed (i.c. 0123456789.) 6 = all characters that are allowed in the DOS-filename convertion are allowed - TextLen% = number of characters user is allowed to enter. - ULCol% = upper left row for UserInput$ - ULRow% = upper left column for UserInput$ - ForeGround% = attribute for foreground - Background% = attribute for background !SHORTValidFileName% Checks if a given filename is valid PURPOSE : Checks if a given filename is valid DECLARATION : DECLARE FUNCTION ValidFileName% (STRING) SYNTAX : print ValidFilename% (FileName$) - Filename$ = the filename that must be checked RETURNVALUES : 0 = Filename is valid -1 = Filename is not valid !SHORTValidKey% Checks if character entered by user is valid PURPOSE : Checks if character entered by user is valid DECLARATION : DECLARE FUNCTION ValidKey% (STRING,STRING,INTEGER,INTEGER,_ INTEGER) SYNTAX : print ValidKey% (CheckChar$,ValidChar$,ULCase%,QuitChar1%_ QuitChar2%) - CheckChar$ The character user entered - ValidChar$ A string containing all characters supposed to be valid - ULCase% 0 either uppercase and lowercase are valid 1 only lowercase is valid 2 only uppercase is valid 3 * valid are a-z A-Z 4 * valid are a-z 5 * valid are A-Z 6 * valid are 0-9 7 * valid are 0-9 and . * means that ValidChar$ does not have to have a value when ValidKey% is called - Quitchar1% the ASC value for the key that ends the user-input routine p.e. ESC (chr 27), ENTER (chr 13) - Quitchar2% the ASC value for the key that ends the user-input routine p.e. ESC (chr 27), ENTER (chr 13) RETURNVALUES : 0 Chechchar$ is not a valid user-input -1 Chechchar$ is a valid user-input -2 QuitChar1% was pressed -3 QuitChar2% was pressed REMARK : example to check for user-input $COMPILE EXE $LIB ALL - $ERROR ALL- $LINK "PSLIB002.PBL" cls 'þ let user give keyboard-input locate 25,1:print"Press a key in the range from_ A true Z or a true z" REPEATINPUT: sleep CheckChar$=inkey$ 'þ now we call Validkey% checkedChar%=ValidKey%(CheckChar$,"",3,27,13) 'þ lets see what happened SELECT CASE checkedChar% CASE 0 'þ not valid beep goto REPEATINPUT CASE -1 'þ a valid key was pressed ' continue routine at DONE: CASE -2 'þ user pressed ESC-key ' continue routine at DONE: CASE -3 'þ user pressed RETURN-key ' continue routine at DONE: END SELECT !SHORTYesNo% Choise-box for user-input Yes or No PURPOSE : Choise-box for user-input Yes or No DECLARATION : DECLARE FUNCTION YesNo% (INTEGER,INTEGER,INTEGER,INTEGER_ INTEGER) SYNTAX : print YesNo%(ULRow%,ULCol%,Country%,ForeGround%,Background%) - ULRow% = upper-left row of the choisebox - ULCol% = upper-left column of the choisebox - Country% = language in which 'YES/NO' will be displayed 1 = English 31 = Dutch 32 = Dutch part of Belgium 34 = Spanish 33 = French 49 = German - ForeGround% = attribute for foreground - Background% = attribute for background RETURNVALUES : 0 = user pressed YES -1 = user pressed NO