Michael Wallace Posts: 52
12/26/2015
|
So I am using the http request Node.js server for Sonos, and am attempting to setup Kinect scripts to make the http requests. The below script is an example of one. It works just fine when compiled via csc in the command line, but does not work at all throu CastleOS. Any ideas? using System.IO; using System.Net; using System.Text; using System.Diagnostics; public class MyScript { public static void Main() { Process.Start(@".\RemoteAppLaunchClient.exe","10.75.130.10 iexplore.exe http://localhost:5005/office/playlist/mix"); System.Threading.Thread.Sleep((int)System.TimeSpan.FromSeconds(3).TotalMilliseconds); Process[] AllProcesses = Process.GetProcesses(); foreach (var process in AllProcesses) { if (process.MainWindowTitle != "") { string s = process.ProcessName.ToLower(); if (s.Contains("iexplore")) process.Kill(); } } } } Thanks, Mike
|
|
0
link
|
Chris Cicchitelli Administrator Posts: 3390
12/29/2015
|
Hey Michael, can you clarify what you mean by "csc in the command line"? Just want to be sure we understand how you are testing the build.
I think your issue is you are trying to kill a GUI process (iexplore) from the CastleOS service. Instead, you'll want to compile your process kill code into an executable and call that executable from the RemoteAppLaunchClient.
Let me know how you make out!
-Chris
|
|
0
link
|
Michael Wallace Posts: 52
1/2/2016
|
Hey Chris, Here is the msdn csc info: https://msdn.microsoft.com/en-us/library/78f4aasd.aspxMy end all goal for these scripts currently is to have CastleOS navigate to http://localhost:5005/office/volume/50 (an example) to set the volume of the office Sonos Play1 to 50%. I tried using the example script that Nick put out earlier, but nothing happens with that one either. The above coe, when compiled in an exe and run on its own runs perfectly. Remote App Launcher starts IE, goes to the page, the volume changes, and after a few second wait, IE closes. If tried putting various versions of the script in as Kinect scripts as well as Action scripts as a standalone scene. Nothing happens, though the Kinect command is recognized. Any ideas?
|
|
0
link
|
Chris Cicchitelli Administrator Posts: 3390
1/3/2016
|
Ah, ok. You don't want to compile from within a CastleOS script. Anything advanced like that should be it's own EXE that the CastleOS script will call/run.
You can however call that URL without anything other than basic scripting. You don't need to use the remote app launcher, just use C# WebRequest:
WebRequest webRequest = WebRequest.Create("http://localhost:5005/office/volume/50"); WebResponse webResp = webRequest.GetResponse(); edited by ccicchitelli on 1/3/2016
|
|
0
link
|
Michael Wallace Posts: 52
1/7/2016
|
So,
I made a scene and attached a .cs file with the above LOC and the appropriate headers. Nothing happened. Any ideas? Also, in the Kinect configurator, the credentials are accepted, but the device/group/scene lists are empty. However, in the Core service, all is normal. Ideas on this?
Thanks,
Mike
|
|
0
link
|
Scott Goffman Posts: 111
1/11/2016
|
Mike, in your new script did you remember to include "using CastleOSCoreService;"?
Just curious, does this work:
using System; using CastleOSCoreService; using System.Diagnostics; using System.Net;
public class MyScript { public void Main(string[] args) { WebReq("http://localhost:5005/office/playlist/mix"); }
public static void WebReq(string url) { using (var wb = new WebClient()) { var response = wb.DownloadString(url); } } }
|
|
0
link
|
Chris Cicchitelli Administrator Posts: 3390
1/11/2016
|
Good catch Scott!
Also, Mike, regarding the Kinect issues, that bug is fixed in an update now available for download. Those lists were not showing up due to an inadvertent change in the Core Service, so now the Kinect Service has been updated to account for it.
Thanks!!
|
|
0
link
|
Michael Wallace Posts: 52
1/11/2016
|
Hahaha yes! Victory! And I feel dumb now. I debug/write software for a living and missed that. Smh. Thank you both for the help. Chris, on the Kinect versioning, maybe you could put the version on the website so that we know what version we are getting? Thanks again.
|
|
0
link
|
Chris Cicchitelli Administrator Posts: 3390
1/12/2016
|
Yup, I'll update that...thanks for the suggestion!
|
|
0
link
|
Tommy Long Posts: 218
1/12/2016
|
Hi, May I ask what is it in the script that requires CastleOSCoreService? Thanks for helping.
|
|
0
link
|
Michael Wallace Posts: 52
1/15/2016
|
Tommy,
Nothing in particular. The using CastleOSCoreService, which I forgot, basically tells the computer to use that service to execute the script. You would use using CastleOSKinectService; for Kinect executed scripts.
Mike
|
|
0
link
|
Chris Cicchitelli Administrator Posts: 3390
1/16/2016
|
It also provides access to the CastleOS APIs within the script...
|
|
0
link
|