LOGIN  |  REGISTER
Smart Living Made Brilliant!
CASTLEOS FORUM

HomeScripting

A forum for information about scripting with CastleOS. Get samples, suggestions, and other help here

Remote Application Launcher Messages in this topic - RSS

Nick Bento
Nick Bento
Posts: 221


1/30/2015
Nick Bento
Nick Bento
Posts: 221
Hey All,
I wrote a pair of programs that will get around the issue, and are actually pretty neat/useful in general!
It consists of a Server (RemoteAppLaunchServer.exe inside the RemoteAppLaunchServer folder) and a client (RemoteAppLaunchClient.exe). You place the RemoteAppLaunchServer folder (which includes the executable as well as assistance files it needs to run) on whatever machine you want to have applications launch on and execute the exe. This will launch an application that shows up in your system tray. If you click the little icon (it looks like a computer), it has a Console you can look at to make sure things are working. Then, on whatever machine you want to be able to launch voice commands to launch apps with (machine with Kinect), you place the client program on it (I would put it in the scripts folder for simplicity). Then in your custom script, you just use Process.Start to call the client app and pass it the ip address of the machine running the server, along with the name of the program you want to launch and any arguments you want to pass it. For example, I can put the following in my script to launch internet explorer and have it navigate to google.com:
Process.Start(@".\RemoteAppLaunchClient.exe", "192.168.0.130 iexplore.exe www.google.com");

The neat thing about this is that I could launch apps on devices that aren't even running the CastleOS Kinect Service (for instance, I could have it launch internet explorer on my windows 8.1 tablet and have it navigate to the CastleOS Portal for my system by saying "Jarvis, Bring up the control interface")

Also of note, if you wanted the server program to automatically run when the system starts, it would have to be added to the startup programs for the user that logs into the system, it can't be used as a service (otherwise we'd just be right back to our original problem haha!)

Try them out and let me know if it helps, thanks!


UPDATE: I added new features! Now if you send the command [MONOFF] it will turn off the monitors of the system running the server, and if you send [LOCKSYS] it will lock the computer the server is running on!
Example: RemoteAppLaunchClient.exe 192.168.0.130 [LOCKSYS]
RemoteAppLaunchClient.exe 192.168.0.130 [MONOFF]


I also added some more robust error handling/recovery and resource management, so the program should be even more stable now than it already was.
Be sure to grab this new version, attached below!
edited by nikku on 1/31/2015
edited by nikku on 1/31/2015
edited by nikku on 1/31/2015

--
-Nick B.


+1 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


1/30/2015
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Thanks Nick! This is an awesome app and will be very helpful to the community. You've gone above and beyond! I've pinned this thread...
+1 link
mario rodriguez
mario rodriguez
Posts: 21


1/31/2015
mario rodriguez
mario rodriguez
Posts: 21
thank you Nick!!! all this time I have been trying to open a program using castleOS.. with no success until now! thank you so much!. smile
+2 link
mario rodriguez
mario rodriguez
Posts: 21


1/31/2015
mario rodriguez
mario rodriguez
Posts: 21
now I can say computer play music and it opens the program "elpis" to play Pandora.
+2 link
Nick Bento
Nick Bento
Posts: 221


1/31/2015
Nick Bento
Nick Bento
Posts: 221
Glad to hear it's working! smile

--
-Nick B.
0 link
Nick Bento
Nick Bento
Posts: 221


1/31/2015
Nick Bento
Nick Bento
Posts: 221
I might add in features to also lock a workstation or put the monitors to sleep, playing around with the idea in my dev environment.

--
-Nick B.
0 link
Nick Bento
Nick Bento
Posts: 221


1/31/2015
Nick Bento
Nick Bento
Posts: 221
Added in features to lock a system, and to turn off the monitors. Updated in my original post!

--
-Nick B.
0 link
Dominique Garcia
Dominique Garcia
Posts: 55


2/21/2015
Dominique Garcia
Dominique Garcia
Posts: 55
I am picking back up where I left off on learning scripting. I have a question though, will scripting with autohotkey also work with the kind of scripting you are working with?
0 link
Nick Bento
Nick Bento
Posts: 221


2/21/2015
Nick Bento
Nick Bento
Posts: 221
I think that depends on how it's being called. If you are trying to call it from a script running from the kinect service to control a foreground application, that wouldn't work. If you are trying to call it through the remote application launcher, it is likely to work provided it can be launched with arguments that will allow you to control it as desired.

--
-Nick B.
0 link
Elias Hall
Elias Hall
Posts: 34


5/5/2015
Elias Hall
Elias Hall
Posts: 34
Does your app require a specific version of .net?
On the server console I get socket exception 0x80004005 (see attached)

I also tried running it on my kinect service machine and referencing it with 127.0.0.1 but I didn't get a response.


Attachments:
ServerException.JPG
0 link
Nick Bento
Nick Bento
Posts: 221


5/5/2015
Nick Bento
Nick Bento
Posts: 221
it uses the same version of .net that castle os uses. What IP are you trying to use?

--
-Nick B.
0 link
Elias Hall
Elias Hall
Posts: 34


5/6/2015
Elias Hall
Elias Hall
Posts: 34
Nick Bento wrote:
it uses the same version of .net that castle os uses. What IP are you trying to use?

I attempted to run the LaunchServer on the CastleOS server and got the errors as shown in the screenshot. -This might be due to Windows 10 Pro-insider preview.

I do not get the errors if I run the LaunchServer on my media box (windows 8.1) which also hosts the Kinect (not the CastleOS Core Service) but when I reference it with the ip 127.0.0.1 it does not pass the command to the server.
0 link
Nick Bento
Nick Bento
Posts: 221


5/6/2015
Nick Bento
Nick Bento
Posts: 221
Haven't tested the app on windows 10, but it's fairly likely there could be some changes to the network stack causing those errors. The only other time I've ever seen that error pop up is if the program grabs an external IP (which shouldn't happen), or the machine has multiple NICs and the program picks one that may not be on your network for whatever reason. Also, I'd check the windows firewall (or other firewall if you use 3rd party) and make sure it is off in case it is blocking the communication ports needed by the app. You might also try using the actual IP address of the machine instead of the loopback (I think the server actually binds to the network IP address as opposed to the localhost address oddly).

--
-Nick B.
0 link
MrMxyzptlk
MrMxyzptlk
Posts: 18


5/7/2015
MrMxyzptlk
MrMxyzptlk
Posts: 18
Nick, I have it installed on the latest Windows 10 enterprise preview with no issues.
Try running the installer as administrator...
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


1/26/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
CastleHUB Compatibility
Out of the box, this program will not work on the CastleHUB. Like most things in CastleOS, you have to tinker to get it working.

For this program to work, you have to disable your ethernet or Wifi adapter (whichever one you don't use). Once disabled, be sure you allow the program access through Windows Firewall.

This program will NOT accept requests sent to 127.0.0.1.

Nick thank you for this awesome code to fill try fill some gaps in CastleOS

edited by philhawthorne on 1/27/2016
0 link
Michael Wallace
Michael Wallace
Posts: 52


1/27/2016
Michael Wallace
Michael Wallace
Posts: 52
Looking to send multiple parameters to control my Harmony Hub via the Harmony Console project (google Harmony C#). I need to send something along the lines of "192.168.1.2 HarmonyConsole.exe -u myemail@domain.com -p mypassword -i Harmony.hub.ip.address -s activity_id_#"

All it seems to do is open the app launcher and chill there. Opening Internet explorer works find, so it seems that there may need to be a code modification.

Mike
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


1/27/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Michael Wallace wrote:
Looking to send multiple parameters to control my Harmony Hub via the Harmony Console project (google Harmony C#). I need to send something along the lines of "192.168.1.2 HarmonyConsole.exe -u myemail@domain.com -p mypassword -i Harmony.hub.ip.address -s activity_id_#"

All it seems to do is open the app launcher and chill there. Opening Internet explorer works find, so it seems that there may need to be a code modification.

Mike


Hey Mike

That's frustrating. Just out of curiosity, how are you getting client to execute in your c# script? I'm using the latest version of CastleOS Kinect, and as soon as my c# script tries to call the client.exe, the service crashes.

For the parameter problem, my only suggestion would be perhaps another middleman exe you create. Example

c# script calls client.exe like so
"192.168.1.2 my_exe.exe myemail@domain.com mypassword Harmony.hub.ip.address activity_id_#"

Your my_exe.exe file then takes those arguments, and forwards them onto HarmonyConsole.exe with the flags added.

I'm not sure if Nick is still a CastleOS user or regular to these forums. His last login was in September
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


1/27/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Phil Hawthorne wrote:


I'm not sure if Nick is still a CastleOS user or regular to these forums. His last login was in September



He is, I saw him post in Reddit a few days ago. But I'm not sure when the last time he checked this thread was... I'll try to help with the scripting debugging after I get this next release done. Generally, we like to ensure your client app is fully functional before you try to integrate with CastleOS...
0 link
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390


1/27/2016
Chris Cicchitelli
Chris Cicchitelli
Administrator
Posts: 3390
Phil Hawthorne wrote:
CastleHUB Compatibility
Out of the box, this program will not work on the CastleHUB. Like most things in CastleOS, you have to tinker to get it working.

For this program to work, you have to disable your ethernet or Wifi adapter (whichever one you don't use). Once disabled, be sure you allow the program access through Windows Firewall.

This program will NOT accept requests sent to 127.0.0.1.

Nick thank you for this awesome code to fill try fill some gaps in CastleOS

edited by philhawthorne on 1/27/2016



I'm guessing this is a configuration issue... are you getting any output/errors?
0 link
Phil Hawthorne
Phil Hawthorne
Posts: 400


1/27/2016
Phil Hawthorne
Phil Hawthorne
Posts: 400
Chris Cicchitelli wrote:
I'm guessing this is a configuration issue... are you getting any output/errors?

Yeah same errors that Elias posted above, socket errors etc.

Not specific to the CastleHUB, it would be on any PC with multiple adapters enabled. Once I disabled the ethernet adapter no errors were reported.

Once I got no error output, I tested by calling 127.0.0.1 which didn't show anything in the console. Only calls to the LAN IP would result in a response. Once again, not CastleHUB specific.
0 link
12