cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
282
Views
10
Helpful
12
Replies
Highlighted
Frequent Contributor

Scripting Question

Hello Experts,

We have some emergency Ad Hoc prompts (EAP) that we record and play when it is needed.  I am writting a script that requires the below manipulations.

The emergency prompt comes right before the main menu to informe callers about the situations. The prompt is erased by our admins as soon as the situation becoms normal. We are using a script called prompt management to automatically record and erase the EAPs. 

In the script, I am using a Play Prompt which contains the EAP file name before the main menu. Here's where I need some help

If there's a EAP recorded go to menu1 if not go to menu2.

How can I verify if there's a EAP recorded?

I am not sure if I can say:

If the weight of the file == 0 goto menu1 else goto menu2

 

Thank you for your support,

 

MK

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
VIP Advisor

Re: Scripting Question

Yeah, it's a little hidden.  If you just type it, it will work.  If you go looking for it, you'll need to know a little trick.  The Java tab allows you to type in any object type and then expose it's invocations, methods, and properties.  Notice the result from this method call is a Long, so you'll need a new variable of type long to store the value in.

 

Like this:

uccx-document-getContentLength.png


Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Beginner

Re: Scripting Question

MK,

I have IP-IVR but the same script should work on UCCX.

I created a simple script with the following:

Variables:

docPrompt as type Document, value: DOC[]

fileLength as type int, value 0

promptToCheck as type Prompt, value P[Directory/Filename.wav]

 

My test script only has 2 steps:

Start

Set docPrompt = ((Document(promptToCheck)) (typecast the prompt as a document)

Set fileLength = docPrompt.getContentLength()

End

I single-stepped the program and fileLength was 30801 which matches the file size of the prompt file I checked. I don't have a zero-byte size file on my server to compare to see what fileLength was.

 

Bill

12 REPLIES 12
Collaborator

Re: Scripting Question

While I'm sure there might be some Java way to check the size of the prompt, why don't you slightly change your process and have the EAP be silence when it's not needed?

 

david

Frequent Contributor

Re: Scripting Question

That's exactely what we do. When our admins erase the recorded prompts, the file name remains in the Play Prompt statement but it is emply.

The problem I have is how to verify if the prompt is empty or not. If it is empy goto menu1 if not goto menu2.

 

Thanks,

 

MK

Collaborator

Re: Scripting Question

I guess I misunderstood the use case. I thought you could change your process to always play the msg, then go to the menu, but it sounds like you have 2 different menus. Another option which is not great is to have an XML or DB lookup with a flag for when to go to menu1 or menu2. I've never seen a way to retrieve the prompt file size and the more I think about it the more I think it's not possible as CCX will more than likely have to play the prompt to even know the size which defeats what you're trying to do. Hopefully someone can come up with a better idea.

 

david

VIP Advisor

Re: Scripting Question

You should be able to cast the prompt to a document, and then get the size of the document with the method call getContentLength().

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Frequent Contributor

Re: Scripting Question

Hi Anthony,

I like the idea of casting the prompt to a document.  Would you happen to have an example to share?

 

Thanks,

 

MK

VIP Advisor

Re: Scripting Question

Use the Set step, as it will try to cast for you.

Set my_prompt_as_doc = my_prompt

Where the two variables are of type Document and Prompt respectively.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Frequent Contributor

Re: Scripting Question

Thanks Anthony,

I don't seem to be able to find getContentLength() in UCCX script editor!

 

Regards,

 

MK

VIP Advisor

Re: Scripting Question

Yeah, it's a little hidden.  If you just type it, it will work.  If you go looking for it, you'll need to know a little trick.  The Java tab allows you to type in any object type and then expose it's invocations, methods, and properties.  Notice the result from this method call is a Long, so you'll need a new variable of type long to store the value in.

 

Like this:

uccx-document-getContentLength.png


Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Beginner

Re: Scripting Question

MK,

I have IP-IVR but the same script should work on UCCX.

I created a simple script with the following:

Variables:

docPrompt as type Document, value: DOC[]

fileLength as type int, value 0

promptToCheck as type Prompt, value P[Directory/Filename.wav]

 

My test script only has 2 steps:

Start

Set docPrompt = ((Document(promptToCheck)) (typecast the prompt as a document)

Set fileLength = docPrompt.getContentLength()

End

I single-stepped the program and fileLength was 30801 which matches the file size of the prompt file I checked. I don't have a zero-byte size file on my server to compare to see what fileLength was.

 

Bill

Frequent Contributor

Re: Scripting Question

Thank you guys,

That worked like a charm.

 

MK

VIP Advisor

Re: Scripting Question

Two things:

1) You should store the value of the content length as long, else a larger prompt file will cause you problems as you overflow the int max value.

2) Why not drop the document variable, and get the steps down to a single, eh? Set fileLength = ((Document) promptToCheck).getContentLength()

;)

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Beginner

Re: Scripting Question

Have you tried to use an Escalating Container prompt.  I am not sure how it will handle the empty file but if it works, it may be an easy way to handle your situation.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards