0
私は、アプリケーションが来るフォルダを監視するスクリプトを作成しており、コンソールSDK、コンソールSDK私はそれらを入力する必要があるので、それは独自のコマンドです。別のコンソールを開くコンソールアプリケーションでWindows入力シミュレータまたはキーを送信できない
モニターは、SDKを開くフォルダー内に何かを見た後でも機能しますが、入力シミュレーターまたは送信キーコマンドは何もしません。
while (path == null)
{
Run();
}
if (path != null)
{
toOpen();
}
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public static void Run()
{
Console.WriteLine("Usage: Watcher.exe (Test Scanner)");
string args = @"E:\Test Scanner";
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = args;
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// Only watch text files.
watcher.Filter = "*";
// Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.Deleted += new FileSystemEventHandler(OnChanged);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
// Begin watching.
watcher.EnableRaisingEvents = true;
Console.WriteLine(path);
// Wait for the software to quit the program.
//Console.WriteLine("Wait for System String Deploy to procede");
}
// Define the event handlers.
private static void OnChanged(object source, FileSystemEventArgs e)
{
// Specify what is done when a file is changed, created, or deleted.
//Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
path = e.FullPath.ToString();
}
private static void OnRenamed(object source, RenamedEventArgs e)
{
// Specify what is done when a file is renamed.
Console.WriteLine("File: {0} renamed to {1}", e.OldFullPath, e.FullPath);
}
private static void toOpen() {
string toOpen = @"C:\Program Files (x86)\Microsoft Durango XDK\xdk\Command Prompts\Xbox One XDK Visual Studio 2015 Command Prompt";
System.Diagnostics.Process.Start(toOpen);
System.Threading.Thread.Sleep(5000);
InputSimulator.SimulateTextEntry("xbconnect" + "127.0.0.1");
System.Threading.Thread.Sleep(500);
InputSimulator.SimulateTextEntry("xbapp deploy" + path);
Console.ReadLine();
}
送るキー例:
System.Diagnostics.Process.Start(toOpen);
System.Threading.Thread.Sleep(5000);
SendKeys.SendWait("xbconnect 127.0.0.1");
System.Threading.Thread.Sleep(500);
SendKeys.SendWait("xbapp deploy" + path);
Console.ReadLine();
それが動作しない理由を任意のアイデア。
注:これは完全なスクリプトではないので、角カッコが閉じられている可能性があります。