Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions FreePIE.Core.Plugins/WindowPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,37 @@ public bool Activate(string processName)
SetForegroundWindow(p.First().MainWindowHandle);
return true;
}

public bool Start(string processName)
{
var p = Process.Start(processName);
if (p == null) return false;
return true;
}

public bool Start(string processName, string arguments)
{
var p = Process.Start(processName, arguments);
if (p == null) return false;
return true;
}

public bool Close(string processName)
{
var p = Process.GetProcessesByName(processName);
if (!p.Any()) return false;

p.First().Close();
return true;
}

public bool CloseMainWindow(string processName)
{
var p = Process.GetProcessesByName(processName);
if (!p.Any()) return false;

return p.First().CloseMainWindow();
}
}

[Global(Name = "window")]
Expand All @@ -110,6 +141,26 @@ public string getActive
get { return plugin.GetActiveWindowProcessName(); }
}

public bool open(string processName)
{
return plugin.Start(processName);
}

public bool open(string processName, string arguments)
{
return plugin.Start(processName, arguments);
}

public bool close(string processName)
{
return plugin.Close(processName);
}

public bool closeMainWindow(string processName)
{
return plugin.CloseMainWindow(processName);
}

public int pollingInterval
{
set { plugin.PollingInterval = value; }
Expand Down