Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: victor on September 26, 2006, 05:54:23 AM

Title: launching an application from URS
Post by: victor on September 26, 2006, 05:54:23 AM
Dear all,

a quick and painless question:

I need to launch a batch file from within a strategy. Can this be done without using custom server?

We are talking about solaris, and I am not too keen on programming.

Thanks,
Vic
Title: Re: launching an application from URS
Post by: Haldane on September 26, 2006, 10:17:47 AM
I tried to do something like this in 6.5 but could only do it through a custom server. I then found an easier way via a stored porc. It was on Oracle so I used the DBMS.PIPE command, in which you can pipe out an OS command. Not sure how to do this in SQLserver. Maybe ask your DBA.

Title: Re: launching an application from URS
Post by: victor on September 28, 2006, 03:43:51 AM
Launching something through a stored procedure in Oracle.  :o

This is something I can imagine doing. I wonder the stored procedure would be in SQL server...
Title: Re: launching an application from URS
Post by: LeszekM on September 28, 2006, 04:25:01 PM
In MS SQL you have got the "xp_cmdshell" system extended stored procedure.

Regards
Leszek
Title: Re: launching an application from URS
Post by: cavagnaro on September 29, 2006, 05:13:45 AM
Awesome! This can solve a $4000 develpment Genesys was trying to sell me! Will try ASAP!
Title: Re: launching an application from URS
Post by: victor on October 10, 2006, 03:03:29 AM
Ok, thanks to everyone, I figured out a solution :)

xp_cmdshell does the trick.

Here is how it works:

exec master.dbo.xp_cmdshell 'copy c:\temp\a.txt c:\temp\workfile.txt'

this will copy a.txt into workfile.txt

if you need to analyze return value, then try this:

DECLARE @rc int
EXEC @rc = master.dbo.xp_cmdshell 'copy c:\temp\a.txt c:\temp\workfile.txt'
print @rc
IF @rc <> 0
BEGIN
  PRINT 'Copy Failed'
END
ELSE
BEGIN
  Print 'Copy worked'
  ....
END


And then, all you need to do is call it from URS. I think you know how to do this, so I will let you be.
In case you don't here we go: