|
|
#171 |
|
Moderator
|
RNDMONEY, DOLLARS, CENTS
E r g e b n i s / R e s u l t
This language call contains 3 numeric functions which can be used within Database, Spreadsheet, or OAIII Programmer/Compiler. These functions can be used to round a money amount to the nearest five cents, or split the money amount into dollars and cents. (This function will be of use when one and two cent coins are no longer available in Australia). B e s c h r e i b u n g / D e s c r i p t i o n rndmoney - round to the nearest five cents dollars - remove the cents cents - remove the dollars S y n t a x Code:
correctamt = call("rndmoney",invoiceamt)
dollaramt = call("dollars",invoiceamt)
centamt = call("cents",invoiceamt)invoiceamt - The amount to round R e t u r n s The desired value. B e i s p i e l / E x a m p l e Code:
attach "money.oac"
invoiceamt = 0.00
put at 10,7 'Enter an Invoice Amount: '
get invoiceamt width 8 precision 2
put do clear screen
correctamt = 0.00
correctamt = call("rndmoney",invoiceamt)
dollaramt = 0.00
dollaramt = call("dollars",invoiceamt)
centamt = 0
centamt = call("cents",invoiceamt)
put at 10,3 ' Original Invoice: ', invoiceamt width 10 precision 2 left
put at 10,5 'Corrected Invoice: ', correctamt width 10 precision 2 left
put at 10,7 ' Dollars Only: ', dollaramt width 10 precision 2 left
put at 10,9 ' Cents Only: ', centamt width 2
put at 10,11
ok = true
get ok
detach "money.oac" |
|
|
|
|
|
#172 |
|
Moderator
|
SCRNON, SCRNOFF
E r g e b n i s / R e s u l t
turn screen on/off from anywhere within OA3 (including programmer) B e s c h r e i b u n g / D e s c r i p t i o n This application allows you switch the OA screen OFF or ON. The main use for this application would be for securing password entry from within programmer. It can also be used to automatically start a programmer or Compiled application without displaying the OA main menu or application menu. This is done by starting OA with the A= and M= parameters. A macro must be called that either turns the screen on again using an option on the Applications Menu, or that starts a program that first turns the screen back on. A sample text file is provided to be used with the A= parameter (i.e, OA3 A=cstart). S y n t a x Code:
rval = call('scrnon')
rval = call('scrnoff')R e t u r n s B e i s p i e l / E x a m p l e Code:
attach "scrnctrl.oac"
psw = ''
put at 5,5 'Enter Password:'
rval = call('scrnoff')
get at 21,10 psw width 10
put at 21,10, do clear end line
rval = call('scrnon')
put at 5,10 'The Password is : ', psw
b = false; get b
detach "scrnctrl.oac" |
|
|
|
|
|
#173 |
|
Moderator
|
SCRNPROG
E r g e b n i s / R e s u l t
This application performs the same task as SCRNCTRL but can only be used within programmer. The source code written in C is an example of how to pass an integer to a C program from within OA. B e s c h r e i b u n g / D e s c r i p t i o n This application allows you switch the OA screen OFF or ON. The main use for this application would be for securing password entry from within programmer. According to scrnflag, the screen is turned on (1) or off (0). S y n t a x Code:
rval = call('scrnprog',scrnflag)scrnflag - Whether to turn the screen on or off: 1 - Turn the screen on 0 - Turn the screen off R e t u r n s B e i s p i e l / E x a m p l e Code:
attach "scrnprog.oac"
psw = ''
put at 5,5 'Enter Password:'
scrnflag = 0
rval = call('scrnprog',scrnflag)
get at 21,10 psw width 10
put at 21,10, do clear end line
scrnflag = 1
rval = call('scrnprog',scrnflag)
put at 5,10 'The Password is : ', psw
b = false; get b
detach "scrnprog.oac" |
|
|
|
|
|
#174 |
|
Moderator
|
SHOWFILE
E r g e b n i s / R e s u l t
Place a file into notepad and display it B e s c h r e i b u n g / D e s c r i p t i o n Thie function opens the given file with filename fname and displays it in notepad. S y n t a x Code:
ok = call("showfile",fname)fname - File name of file to display R e t u r n s A boolean value. B e i s p i e l / E x a m p l e Code:
attach "filecomp.oac"
fname = 'oa3code:test1.txt'
ok = call("showfile",fname)
detach "filecomp.oac" |
|
|
|
|
|
#175 |
|
Moderator
|
SHOWDIR
E r g e b n i s / R e s u l t
Display the OAIII (search order) directory B e s c h r e i b u n g / D e s c r i p t i o n This function displays the OAIII (search order) directory S y n t a x Code:
thefile = call("showdir",fileext,allow)fileext - list of allowable file extensions This parameter has the format: .ext,.ext,.ext ... The fullstop must be included and each file extension must be separated by a comma. allow - ALLOW Copy, Delete, or Rename when the directory is displayed? 'Yes' = allow Copy, Delete, and Rename. 'No' = Don't allow Copy, Delete, and Rename. R e t u r n s The selected file or a string of zero length if the user aborted. B e i s p i e l / E x a m p l e Code:
attach "filecomp.oac"
put do clear screen
fileext = '.txt,.df'
thefile = ''
thefile = call("showdir",fileext,'No')
if length(thefile) > 0
put at 10,10 'The File chosen is: ', thefile
else
put at 10,10 'NO FILE CHOSEN'
end if
ok = false
get ok
detach "filecomp.oac" |
|
|
|
|
|
#176 |
|
Moderator
|
FILEDEL
E r g e b n i s / R e s u l t
Delete an existing file. B e s c h r e i b u n g / D e s c r i p t i o n This function deletes an existing file with the name fname S y n t a x Code:
bool = call("filedel",fname)fname - The file to delete R e t u r n s A boolean value. B e i s p i e l / E x a m p l e Code:
attach "filecomp.oac"
ok = call("filedel", "test2.txt")
detach "filecomp.oac" |
|
|
|
|
|
#177 |
|
Moderator
|
APENDALL
E r g e b n i s / R e s u l t
Append the entire contents of one file to another B e s c h r e i b u n g / D e s c r i p t i o n This function appends the contents of fname2 to file fname1 S y n t a x Code:
ok = call("apendall",fname1,fname2)fname1 - The file where to append contents of file fname2 fname2 - The contents of this file are appended to file fname1 R e t u r n s A boolean value. B e i s p i e l / E x a m p l e Code:
attach "filecomp.oac"
fname1 = 'oa3code:test1.txt'
fname2 = 'test2.txt'
ok = call("apendall",fname1,fname2)
detach "filecomp.oac" |
|
|
|
|
|
#178 |
|
Moderator
|
APENDONE
E r g e b n i s / R e s u l t
Append one line of text to a file B e s c h r e i b u n g / D e s c r i p t i o n This function appends line to file fname S y n t a x Code:
ok = call("apendone",fname,line)fname - The file where to append the line line line - The line to append to file with name fname R e t u r n s A boolean value. B e i s p i e l / E x a m p l e Code:
attach "filecomp.oac"
OK = CALL ('APENDONE','AFILE.TXT','Another line')
detach "filecomp.oac" |
|
|
|
|
|
#179 |
|
Moderator
|
WHEREIS
E r g e b n i s / R e s u l t
Pass back the search path nickname for a given file B e s c h r e i b u n g / D e s c r i p t i o n This function searches for the given file in search path and returns the path nickname. S y n t a x Code:
fnamep = call("whereis",fname)fname - The file name of the file where to search the path nickname for R e t u r n s The file including the nickname or an empty string, if not found. B e i s p i e l / E x a m p l e Code:
attach "filecomp.oac"
fname2 = 'test2.txt'
fname2 = call("whereis",fname2)
if length(fname2) > 0
ok = call("filedel",fname2)
end if
detach "filecomp.oac" |
|
|
|
|
|
#180 |
|
Moderator
|
CLRWRITE
E r g e b n i s / R e s u l t
Clear a text file and write first line B e s c h r e i b u n g / D e s c r i p t i o n This function truncates the file fname and writes the line txtin to it. The file must exist. S y n t a x Code:
ok = call("clrwrite",txtin,fname)txtin - Text to write to the file fname - The file to truncate and write the text to. The file must exist. R e t u r n s A boolean value. B e i s p i e l / E x a m p l e Code:
attach "filecomp.oac"
OK = call("clrwrite","hi there","file.txt")
detach "filecomp.oac" |
|
|
|