• V20: 3CX Re-engineered. Get V20 for increased security, better call management, a new admin console and Windows softphone. Learn More.

How to check if file exists.

Status
Not open for further replies.

martinpluss

Joined
Jun 28, 2011
Messages
30
Reaction score
0
Hi,
I'm trying to write some javascript that will check to see if a settings file exists so that I can use its contents later in the application. I have an external code execution block in the main flow and I pass the working directory to it as a parameter.

I have the following code:
Code:
function CheckFileExists()
{
var g_fso = new ActiveXObject("Scripting.FileSystemObject");

var path = arguments[0] + "\settings.ini";

if (g_fso.FileExists(path))
        {
            return "true";
        }
else
		{
			return "false";
		}
}

But this fails and the 3CXIvrServer.log shows:
Code:
Error! Module '3CX.com.OSBjsi'. Error ID 501. errmsgReferenceError: ActiveXObject is not definedline3linetxttokentxt

Any ideas how I fix my code to achieve this?
 
OK. So I ended up completely rethinking my application flow and put all file operations into a dotnet library which I now reference from the the Voice Application.

I use my custom dotnet library for all file functions (like ifexists, copy, rename etc) and it works great (although I had to blow the dust off of my vb.net skillset :D )
 
Hi Martin,

Thanks for sharing with us your experience!

Hope you have a great year!

Best regards,
 
Status
Not open for further replies.

Getting Started - Admin

Latest Posts

Forum statistics

Threads
141,980
Messages
751,551
Members
145,448
Latest member
angel4781
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.