[JScript-Dev] Developing Script

  • From: "Sugiyo" <sugiyo@xxxxxxxxxxxxxxxx>
  • To: <jscript-dev@xxxxxxxxxxxxx>
  • Date: Thu, 7 Dec 2006 13:19:24 +0700

Dear Vuk, Victor and all

I am trying to develop the function with parameter. With the function and 
script belo I hope computer wil says:

1. "You did not enter your first name", if I did not enter the first name.
2. "You did not enter your last name", if I did not enter the last name.
3. "You did not enter your whole name, are you a person from other planet?", if 
I did not enter  both first name and last name.
4. "Hello world, my name is %1 %2.", If I enter both first name and last name. 



The script can be compiled unfortunately the result doesn't work properly. Can 
any one edit the script below?



Script for message file



;Messages file for notepad

;Created by Sugiyo

;This script created for excercise in creating script

Messages

@MsgName

Hello world, my name is %1 %2.

@@

; message for missing or no name

@MsgNoFirstName

You did not enter your first name.

@@

@MSGNoLastName

You Did not enter your last name

@@

@MSGWholeName

You did not enter your whole name, are you a person from other planet? %3 %3.

@@

EndMessages



Function:



Void Function SpeakTheName (string sFirstName, 



string sLastName, string sWholeName)

Var

String sMessage

If sFirstName == "" Then; check to make sure text was actually passed in the 
sName parameter

SayFormattedMessage (OT_ERROR, MSGNoFirstName)

Return; exit the function

EndIf

If sLastName == "" Then

SayFormattedMessage (OT_ERROR, MsgNoLastName); speak an error message

Return

EndIf

If sFirstName == "" && sLastName == "" Then

SayFormattedMessage (OT_ERROR, MsgWholeName); speak an error message

Return

EndIf

Let sMessage = FormatString (MsgName, sFirstName, sLastName, MSGWholeName) ; 
format the message using the passed parameters

SayFormattedMessage (OT_MESSAGE, sMessage)



EndFunction



Script



Script SayName ()



Var

String sLastName,

String sName,

String sWholeName,

String sPrompt,

String sTitle

Let sTitle = "Name Entry"

Let sPrompt = "Enter your first name:"

InputBox (sPrompt, sTitle, sName)

Let sPrompt = "Enter your last name:"

InputBox (sPrompt, sTitle, sLastName)

SpeakTheName (sName, sLastName, sWholeName)



EndScript



Best Regard

Sugiyo

Other related posts:

  • » [JScript-Dev] Developing Script