Question How do I determine when Skype for Desktop is "ready" to process an argument-supplied action?

Joined
Sep 16, 2023
Messages
20
Programming Experience
10+
WHAT I HAVE:
Visual Basic 2019, .NET Framework 4.6+, WinForms

MY ISSUES:

I want to be able to use the Process class to invoke Skype from my desktop application, with arguments specifying a certain kind of Skype action. However, Skype may fire up without carrying out any action (basically, ignores the argument) if the app isn't "ready". This can be because the app is firing for the first time or has been previously quit (i.e., "Quit Skype" is triggered on the taskbar or settings has "Keep Skype running when window closes" unchecked), or because (perhaps) it hasn't "auto-logged" me in yet. The following code, which has it fire Skype without arguments, then wait until a certain number of seconds have passed or the app has exited, then fires it again with arguments, often works:
VB.NET:
Private Sub DoSkype(ByVal SkypeName As String) 'make video call
Dim Process As Process = New Process()
With Process.StartInfo
   .FileName = SkypeDesktopFolder & "\Skyoe.exe" : .Arguments = ""
   Process.Start() : Process.WaitForExit(7000)
   .Arguments = "Skype:" & SkypeName & "?call&video=true"
   Process.Start()
End With
End Sub

However, even a 15-second delay may not be enough if Skype is firing for the very first time in a Windows session (perhaps it needs time to "auto-log" me in, or to load something that allows it to fire faster subsequently, like many other Windows programs). Is there a more reliable way to determine when Skype is ready to handle argument-supplied commands?
 
Last edited by a moderator:
Solution
It's possible that there is no more reliable way. Different apps work in different ways and your app won't always necessarily be able to tell what's going on with them. The first thing to try would be to call WaitForInputIdle. That can often work with GUI apps if whether they are considered "ready" coincides with when the GUI starts accepting user input.
It's possible that there is no more reliable way. Different apps work in different ways and your app won't always necessarily be able to tell what's going on with them. The first thing to try would be to call WaitForInputIdle. That can often work with GUI apps if whether they are considered "ready" coincides with when the GUI starts accepting user input.

I have...
It's possible that there is no more reliable way. Different apps work in different ways and your app won't always necessarily be able to tell what's going on with them. The first thing to try would be to call WaitForInputIdle. That can often work with GUI apps if whether they are considered "ready" coincides with when the GUI starts accepting user input.
 
Might there be something you can do with the Skype API?


Can you give a code example, please? Once again, in VB.NET, and for desktop (not web) . The samples in the link above seem to be in a C#-like language that InstantVB can't convert to VB.NET (maybe it's in Javascript or something else web-specific), and seem to be designed for a web app, whereas I'm crafting a desktop app.
 
Last edited:
It's possible that there is no more reliable way. Different apps work in different ways and your app won't always necessarily be able to tell what's going on with them. The first thing to try would be to call WaitForInputIdle. That can often work with GUI apps if whether they are considered "ready" coincides with when the GUI starts accepting user input.
It's possible that there is no more reliable way. Different apps work in different ways and your app won't always necessarily be able to tell what's going on with them. The first thing to try would be to call WaitForInputIdle. That can often work with GUI apps if whether they are considered "ready" coincides with when the GUI starts accepting user input.

I have used WaitForInputIdle, and it doesn't resolve that. Apparently Skype for Desktop is able to receive user input before it's necessarily sufficiently initialized to process parameters. Of course, I can have my help file instruct users that if a desired action--i.e., a video call--doesn't start up, to try again after a short wait--which is basically what my code sorta does.
 
Solution
What's the difference (in how to do it)? I thought I was using CODE tags.

Your post does use CODE tags now because I edited it, but it wasn't in the first place. This site works like any other text editor: it has a toolbar with buttons for formatting and they display their purpose if you hover over them. Hopefully there's no more explanation than that required.
 
Back
Top