Download here

Transcript
Smartphone 3.1
floatbusypart, busypercent=0;
for( int line=1; line <= totallines; line++ )
if( IsOffHook( line ) == true) busylines++;
busypart = busylines / totallines;
busypercent = busypart * 100;
This example shows how to use if…else, MessageBox, Write
This SL routine uses a Message Box to ask whether to write a string to the end of a text file in the current Windows NT/
2000/XP directory (using the Write function) and announces the results in a Message box.
// Generate a message box with the question mark icon, the OK & Cancel buttons.
if( MessageBox( "Press ‘OK’ to attempt to write a string to the text file, ‘Cancel’
to quit.", "Script example", 0x00000021 ) == 1 )
{
// Attempt to append a string to the text file:
if( Write( "Example.txt", "This sample illustrates how the Write function in
Smartphone Server Script language works." + Char(13) + "This test was performed on
"+$fdatetime+"."+ Char(13) ) != 0 )
// If the attempt was successful: Generate message box with the OK button.
MessageBox( "The string was successfully appended to the file ‘Example.txt’.",
"Script example", 0x00000000);
else
// If the attempt was unsuccessful: Generate message box with the hand icon and the
OK button.
MessageBox( "An error occurred while writing to the text file ‘Example.txt’. The
string was not appended.", "Script example", 0x00000010 );
}
This example shows how to use return, ClrDtmfs, BoxOut, GetDigit,
Record
This SL routine allows the user to press a telephone key to record a voice file. The Script box exit taken depends on the
user input.
Note: The Script Box must have a minimum of 2 exits.
intExitYes = 1, ExitNo = 2;
intUserInput = 0;
// Play prompt: ‘Press 1 to leave a message, 2 to quit.’
while( UserInput != ExitYes && UserInput != ExitNo )
{
ClrDtmfs();
Playback( "Question.vox" );
UserInput = #GetDigit( 10, 1 );
66
•
•
•
•
•