appendLog ( message ) |
Returns: null | Location: Built-in | ||||
This function will append the string message to WebSiphon's main text log file in addition to displaying it on-screen if the log window is open on the server. This function is useful in creating a central log file for your server. The current date and time are automatically inserted at the beginning of every log entry. Writing to a log file other than WebSiphon's may be done using the text file functions. Example: appendLog("Something terrible went wrong!"); |
beep ( [ num ] ) |
Returns: null | Location: MiscLib | ||||
This function will play the standard beep alert sound on the server once, or num times if it is defined. Example: if error_code = "RED" then beep(3); end if; |
exec ( siphonscript [, variable-list ]) |
Returns: anything | Location: Built-in | ||||||
This function allows execution of arbitrary SiphonScript statements. The optional variable-list parameter is a list of variable names and values, in the format: [[varA, valueA], [varB, valueB], ...]. These runtime instance variables have the same scope as those created by GET or POST arguments. Arbitrary SiphonScript execution is also accessible via an AppleEvent interface using the 'run script' verb. Example: result = exec(script_code, [["sid" session_user] ["page" 2]]); See Also: |
isQuitting ( ) |
Returns: boolean | Location: Built-In |
Indicates if WebSiphon is currently in the middle of a quit sequence. |
run ( template-path [, variable-list ] ) |
Returns: anything | Location: Built-in | ||||||
This function allows you to execute any WebSiphon template from within any other template. The template to run is specified with its URI in template-path. A list of variable names and values are passed as a list in variable-list. The returned value will be the text results of the template (much as would be output to a web browser if the template were run directly). If you wish to include the output of template, use the print statement or enclose the function call within braces (outside of a SiphonScript block). Examples:
|
saveGlobals ( ) |
Returns: null | Location: Built-in |
Immediately saves all global variable data to the disk storage. |
throw ( [ err-num, err-string ] ) |
Returns: - | Location: Built-in | ||||||
Used in conjunction with try/catch exception handling. See Also:
|
reschedule ( delay ) |
Returns: null | Location: Built-in | ||||
Schedules the current template to be run again in delay seconds. |
rescheduleFor ( time-secs ) |
Returns: null | Location: Built-in | ||||
Schedules the current template to be run again at time-secs. The time-secs paramater is the time in seconds since January 1st, 1904. |
schedule ( template-name, delay ) |
Returns: null | Location: Built-in | ||||||
Schedules the template specified in template-name to be run in delay seconds. |
scheduleFor ( template-name, time-secs) |
Returns: null | Location: Built-in | ||||||
Schedules the template specified in template-name to be run again at time-secs. The time-secs paramater is the time in seconds since January 1st, 1904. |
sleep ( delay ) |
Returns: null | Location: Built-in | ||||
Pauses execution of the template for the number of seconds specified in delay, without using valuable CPU cycles. See Also: |
yield ( ) |
Returns: null | Location: Built-in |
Yields CPU cycles to other currently executing templates. See Also: |
acquireSem ( sem-name [, initial-count ] ) |
Returns: null | Location: Built-in | ||||||
Attempts to acquire a semaphore whose name is sem-name, and will block the current template from executing until the semaphore is available. The optional initial-count parameter may be used to enable more than one executing template to acquire the named semaphore for use. If not specified, the parameter uses its default value of 1 so no other template can acquire the semaphore until it has been released. |
attemptSem ( sem-name [, initial-count ] ) |
Returns: boolean | Location: Built-in | ||||||
Attempts to acquire a semaphore whose name is sem-name, and will return a boolean indicating whether or not it was successful rather than blocking. The optional initial-count parameter may be used to enable more than one executing template to acquire the named semaphore for use. If not specified, the parameter uses its default value of 1 so no other template can acquire the semaphore until it has been released. |
releaseSem ( sem-name [, initial-count ] ) |
Returns: null | Location: Built-in | ||||||
Releases a semaphore whose name is sem-name, which will allow other templates to acquire it. The optional initial-count parameter may be used to enable more than one executing template to acquire the named semaphore for use. If not specified, the parameter uses its default value of 1 so no other template can acquire the semaphore until it has been released. |
semCount ( sem-name ) |
Returns: integer | Location: Built-in | ||||
Returns the current count of the semaphore whose name is sem-name. If the returned value is positive, then that number of threads can acquire the semaphore before blocking. A negative value indicates the number of threads waiting on the semaphore to continue execution. |
coerceTo ( value, new-type ) |
Returns: anything | Location: Built-in | ||||||
Given any value in value, this function will coerce it to the data type specified in new-type and return the coerced value. Valid values for new-type: "null" "string" "integer" "list" "float" "binary" Example: the_num = "12"; print typeOf(the_num); >> string the_num = coerceTo ( the_num, "integer" ); print typeOf(the_num); >> integer See Also: |
defined ( varname ) |
Returns: boolean | Location: Built-in | ||||
This function will return true if the variable name varname has been assigned a value and is therefored defined. This is very useful when working with GET or POST arguments, as you can check to see if a variable has been defined, and give it a default value if it has not. Example: if not defined(graphics) then graphics = true; // Default is to display graphics. end if; ... if graphics then << <img src="HomeGraphic.jpg"> >> else << <h1>Welcome to My Home Page!</h1> >> end if; See Also: |
sizeOfBinary ( binary-data ) |
Returns: integer | Location: Built-in | ||||
Given binary-data, this function will return the size of the item in bytes as an integer. See Also: |
typeOf ( value ) |
Returns: string | Location: Built-in | ||||
Given value, this function will return its data type as a string. The returned string may be one of: "null" "string" "integer" "list" "float" "binary" See Also: |
undefined ( varname ) |
Returns: boolean | Location: Built-in | ||||
This function will return true if the variable name varname has not been assigned a value and is therefored undefined. This is very useful when working with GET or POST arguments, as you can check to see if a variable has been defined, and give it a default value if it has not. Example: if undefined(graphics) then graphics = true; // Default is to display graphics. end if; ... if graphics then << <img src="HomeGraphic.jpg"> >> else << <h1>Welcome to My Home Page!</h1> >> end if; See Also: |
getCurrentProcess ( ) |
Returns: string | Location: ProcessLib |
Returns the name of the application process that is currently executing on the server, which should nearly always be "WebSiphon.acgi". Example: print getCurrentProcess(); >> WebSiphon.acgi |
getFrontProcess ( ) |
Returns: string | Location: ProcessLib |
Returns the name of the application process which is currently active on the server. This is the application whose windows and menu bar are the front-most. Example: print getFrontProcess(); >> WebSiphon.acgi |
getProcessInfo ( process-name ) |
Returns: list | Location: ProcessLib | |||||||||||||||||
Given the name of a currently running application process in process-name, this function will return a list containing details about the process. The returned list has the following structure:
|
getProcessList ( ) |
Returns: list | Location: ProcessLib |
Returns a list containing the names of all application processes running on the server. |
launchProcess ( process-path ) |
Returns: null | Location: ProcessLib | ||||
Given the full path to an application in process-path, this function will launch it into the background. |
quitProcess ( process-name ) |
Returns: null | Location: ProcessLib | ||||
Given the name of a running application process in process-name, this function will send the standard Quit AppleEvent to the process. |
setFrontProcess ( process-name ) |
Returns: null | Location: ProcessLib | ||||
Given the name of a running application process in process-name, this function will set it as the front-most process on the server. |
authorizeCreditCard ( sale-amount, card-number, card-expiration ) |
Returns: list | Location: CommerceLib | ||||||||
Given a credit card number in card-number and its expiration date in card-expiration, this function will communicate with MacAuthorize to authorize a sale in the amount of sale-amount. The card-number parameter should be the numbers only and not contain any formatting spaces or other delimiters. The card-expiration paramter should be in the format MMYY with no slashes or other delimiters. A list is returned detailing the results of the transaction. The first item in the returned list indicates the status, and may be one of: "Unknown" "Pending" "Authorized" "Declined" "Referral" "Error" "Voided" "Other" "Pickup" The second item in the returned list is a description of the result. If the sale was declined, this description may be displayed to the user. Example: result = authorizeCreditCard("99.00", "1234123412341234", "1099"); if (result'1 = "Authorized") print "Thanks!"; else print "Sorry, your credit card was declined: " & result'2; end if; |
creditCardType ( card-number ) |
Returns: string | Location: CommerceLib | ||||
Given any credit card number in card-number, with no spaces or other delimiter, this function will return a string indicating what type of credit card it is. The returned string may be one of: "American Express" "JCB" "Diner's Club" "MasterCard" "Visa" "Discover" "enRoute" "Unknown" |
verifyCreditCard ( card-number ) |
Returns: boolean | Location: CommerceLib | ||||
Given a credit card number in card-number, with no spaces or other delimiter, this function will return a boolean indicating if it is a valid credit card account. |
calcCRC ( value ) |
Returns: string | Location: Built-in | ||||
Given value, this function calculates and returns a CRC on the value. This can be used in conjunction with checkCRC() to check data integrity after passing values through URL or POST arguments, and is quite helpful for tracking user sessions securely. See Also: |
checkCRC ( value, crc ) |
Returns: boolean | Location: Built-in | ||||||
Given value, this function returns a boolean indicating whether or not crc is a valid CRC of the value. This can be used in conjunction with calcCRC() to check data integrity after passing values through URL or POST arguments, and is quite helpful for tracking user sessions securely. See Also: |
getImageSize ( image-path ) |
Returns: list | Location: ImageLib | |||||||||||||||||
Given the full pathname to a graphic file in image-file, a list is returned containing the image's width, height, and depth (in bits per pixel). If the file does not exist, or if an error occurred, the list will contain all zeros. File formats supported are GIF 87a, GIF 89a, JPEG, and progressive JPEG. The returned list has the following structure:
Examples:
|
getServerFonts ( ) |
Returns: list | Location: Built-in |
Returns a list containing the name of each font installed on the server OS. |
random ( [ min , max ] ) |
random ( [ list ] ) |
Returns: integer or list item | Location: Built-in | ||||||||
This function is used to create random numbers or other types. It reacts in different ways depending on what parameters are defined:
Examples:
|
sendAppleEvent ( process-name, event-class, event-id [, param-list ] ) |
Returns: anything | Location: MiscLib | ||||||||||
This function allows you to send an AppleEvent direction from within a SiphonScript. The event will be sent to the application whose name is process-name, and will use event-class and event-id as specified. The param-list should be a list of AppleEvent parameter IDs and values. Alternatively, param-list may be a complex AEGizmo formatted string. This method is required to send object model AppleEvents. Though cryptic in nature, the functionality is very powerful. We recommend that users who wish to use this feature utilize a utility to help build the complex string, such as West Code Software's Capture AE control panel available at the URL: ftp://ftp.WestCodeSoft.com/OneClick_Scripting_Tools/CaptureAE.sit.hqx Examples:
|