Make a phone call from Cisco Jabber using .Net console app - c#

I am trying to make a phone call from .Net console Application using Jabber client installed on my laptop.
I want to achieve something similar that you would achieve by the following anchor command in HTML:
Weekly conference call
I want to run the same command through my console application so that it launches Jabber and make a call.

I am not familiar with Jabber, but most likely the client has registered the CISCOTELCONF protocol (similar to how HTTP is registered to your default browser and MAILTO might open Outlook). Therefore you should be able to use Process.Start to pass the same URL to the shell, where it can decide what to do - hopefully invoking the Jabber client as it would if you clicked on the link. You can test this by copy-and-pasting the URL into Start-Run. If it works, then this should also.
var startInfo = new ProcessStartInfo("CISCOTELCONF:msmith#domain;amckenzi#domain")
{
UseShellExecute = true
};
Process.Start(startInfo);
Note the default for UseShellExecute is true, so you do not actually need this line. I've included it anyway because this is what causes Process.Start to, well, invoke the OS shell.

Related

Process.Start for ftp:// prompts for app

I'm writing code that will start a download from our company's ftp (ftp://...) but when using Process.Start("ftp://..."); Windows will prompt me for an app to open it with (I'm using Windows 10). If I use Process.Start("http://www.google.com"); it doesn't prompt. How do I avoid this prompt and just navigate the user to the ftp URL?
Windows knows what to do with a URL that starts with http: open the default web browser and browse to that URL. However, it doesn't natively know what to do with a URL that starts with ftp.
When you're using Process.Start, think of it like running a command from the "run" line in Windows. You usually need to specify an executable to run, and any additional information -- i.e. arguments to the executable -- occur after the path or executable name.
In this case, I'd say you just want to start Internet Explorer and provide it your URL as an argument:
var psi = new ProcessStartInfo(Environment.ExpandEnvironmentVariables(#"%ProgramFiles%\Internet Explorer\iexplore.exe"), url);
var proc = Process.Start(psi);
EDIT: to answer your question about using the default browser, see this SO answer about how to get the default browser's path:

Start Node.js server from a C# Application

A requirement has arisen that I need to start a Node.js server from a C# application, this is as simple as running a server.js script within the Node.js console. However, I'm not entirely certain how exactly to achieve that.
Here's what I've looked into so far:
In the Node.js installation, there's a file called C:\Program Files (x86)\nodejs\nodevars.bat, this is the command prompt window for Node.js. To start the server, I could possibly be using the following steps:
Execute the nodevars.bat file.
SendKeys to the new process console window to start the server.
This approach feels a bit fragile. There's no guarantee that the target user will have their Node.js installation in the same place, also sending keys to a process may not be an ideal solution.
Another method could be:
Write a batch file that executes nodevars.bat.
Execute the batch file from the C# application.
This seems like a better approach. However, the only problem here is that the nodevars.bat opens in a new console window.
So to the question(s), is there a way I can start a node.js server script using functionality built into the node.js installation? Perhaps sending arguments to the node.exe?
If it is to serve multiple users, i.e. as a server, then you can use the os-service package, and install a Windows service. You can then start and stop the service using the standard API.
If you are to start the server as a "single purpose" server, i.e. to serve only the current user, then os-service is the wrong approach. (Typically when using this approach you will specify a unique port for the service to use, which will only be used by your application).
To start a batch file or other Console application, from C#, without showing a console window, use the standard method, but be sure to specify:
ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = false; // This is important
psi.CreateNoWindow = true; // This is what hides the command window.
psi.FileName = #"c:\Path\to\your\batchfile.cmd";
psi.Arguments = #"-any -arguments -go Here"; // Probably you will pass the port number here
using(var process = Process.Start(psi)){
// Do something with process if you want.
}
There are a few different ones but I recommend the os-service package.

Passing parameters from WPF application to another WPF application?

I have two applications developed in WPF(c#) which are independent on each other. Suppose Project A and B. they are developed separately. i have connected those projects with the Button in project A, on click of that button i am starting project B with Process.start();
now i need to pass String (login) parameter to the another application (B) so user dont need to login again.
I have already seen the Command line argument passing but i dont want to use them.
also Application.Current.Properties["parameterStringID"] is not useful because i have different app.config for A and B
Is there any way to do this?
You can send commandline arguments to your application like this.
var applicationPath = "Path to application B exe";
var process = new Process();
process.StartInfo = new ProcessStartInfo(applicationExePath);
process.Arguments = "/login=abc /password=def";
process.Start();
And in your ApplicationB start, handle commandline arguments.
I've solved this in the past by using either anonymous or named pipes, .NET has quite good support for them. There are a few good articles about them on the MSDN site.
do all your applications have similar login method?
make a AviCompany Login windows service .
the service will be also a WCF service that provides method "Login"
see my chart
https://www.lucidchart.com/documents/view/410f-6e48-52c16052-a63b-4a5e0a009f85

Send a string to IE and IE execute the string but not have IE appears or the Console screen appear

I don't know if it is possible to do this in Windows Console Application (C#) but I really need something like this for my project.
I would like to send a string (or URL link) to the IE and have IE execute that string. However, since this string is static; what it does is just turn a machine ON and OFF via internet. So, in this case I have no interest in seeing the IE to popup/display nor the black screen console to appears when the application got executed.
I know in Console Application C# we can do something like this
Process.Start("iexplore.exe", #"http://myserver.com");
However, when I run the above line, the IE popup and so does the black screen console.
Is there a way to not have IE popup and the screen console to not popup, too?
Thanks.
I think you are going about this the wrong way. IE is merely a portal to web requests. Just make the web request call directly. using something like the new Web API or HttpWebRequest
As to making the console not pop up, maybe you should be creating a Windows Service instead of a console application? We would need more details on the end user. If this is more of an automated action, then a service would work. If it is something the user clicks on, then why is displaying the console a bad thing? Typically, when you click on something you expect some sort of visual representation. But, here is a SO that answers this question already
Try ProcessStartInfo. This will hide the console app, but I'm not positive about it hiding IE.
ProcessStartInfo psi = new ProcessStartInfo("iexplore.exe", #"http://myserver.com");
psi.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(psi);

how to program to integrate with filezilla in C#.[sftp]

I would like to integrate FileZilla with my application written in C#.
please someone show me sample code or web site that shows sample code.
although i found article on web, and that article was saying
"application is integrated with FileZilla is so slow".
but i don't know if i can stand that late or not.
so i would like to challenge.
To support FTP/SFTP or any other protocol in C# you can do it in 3 ways:
1. NEW APP PROCESS - Start an app that does the FTP communication in separate process, and be able to control what file to download, where to save it and to tell the app to terminate when download is finished. This way, you can use FileZilla only if it lets you pass certain parameters in command line, like the URI of the resource you want to transfer through FTP/SFTP, and the path where the file should be saved to. And as I can see HERE this could work.
To start the process and pass it command line arguments in C# you would do something like this:
static void StartNewProcess(string app, string args)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = app; //full app path
startInfo.Arguments = args; //command line arguments
startInfo.CreateNoWindow = true; //dont create app window
startInfo.WindowStyle = ProcessWindowStyle.Hidden; //hide app from taskbar
Process.Start(startInfo);
}
Now you can execute FileZila app, pass it args containing file URL and let it do its job... But you cant know how long will it take to download the file, when the download is ended, do you need to log in to get it...
2. EXISTING CLASS LIBRARY - Include a Class Library that is written by someone else, that does the job. This way you are in TOTAL control of the process. And as many other suggested, this would be a perfect way for you. Many answers here contain good class libraries that you can use and be happy with the results.
3. HOME-MADE CLASS LIBRARY - Open RFC 959, read it all and write your code... (Now 2. sounds better, doesn't it? :D)
Filezilla is a GUI FTP client, you can't use it to "script" SFTP operations (it only accepts a very limited set of command line arguments).
You must seek a third party C# component or write one yourself (not recommended) to do the job.
To support FTP or SFTP from your C# application, you could use an external library like the one from Chilkat http://www.chilkatsoft.com/ftp-2-dotnet.asp. I use it and it works great!
In theory, you could also implement the FTP protocoll using socket connections by yourself, but you should save yourself that trouble -> don't reinvent the wheel...
I recommend using SharpSSH, if you need to send files via SSH/SFTP in your application.

Categories

Resources