option --command to send input commands
This commit is contained in:
@@ -47,17 +47,22 @@ namespace mpvnet
|
||||
|
||||
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
files.Add(App.ProcessInstance);
|
||||
List<string> args2 = new List<string>();
|
||||
args2.Add(App.ProcessInstance);
|
||||
|
||||
foreach (string arg in args)
|
||||
{
|
||||
if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") ||
|
||||
arg.Contains(":\\") || arg.StartsWith("\\\\")))
|
||||
|
||||
files.Add(arg);
|
||||
args2.Add(arg);
|
||||
else if (arg == "--queue")
|
||||
files[0] = "queue";
|
||||
args2[0] = "queue";
|
||||
else if (arg.StartsWith("--command="))
|
||||
{
|
||||
args2[0] = "command";
|
||||
args2.Add(arg.Substring(10));
|
||||
}
|
||||
}
|
||||
|
||||
Process[] procs = Process.GetProcessesByName("mpvnet");
|
||||
@@ -70,7 +75,7 @@ namespace mpvnet
|
||||
{
|
||||
WinAPI.AllowSetForegroundWindow(proc.Id);
|
||||
var data = new WinAPI.COPYDATASTRUCT();
|
||||
data.lpData = string.Join("\n", files.ToArray());
|
||||
data.lpData = string.Join("\n", args2.ToArray());
|
||||
data.cbData = data.lpData.Length * 2 + 1;
|
||||
WinAPI.SendMessage(proc.MainWindowHandle, 0x004A /*WM_COPYDATA*/, IntPtr.Zero, ref data);
|
||||
mutex.Dispose();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
$tmpDir = 'D:\Work'
|
||||
$exePath = $PSScriptRoot + '\mpv.net\bin\mpvnet.exe'
|
||||
$exePath = $PSScriptRoot + '\bin\mpvnet.exe'
|
||||
$versionInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath)
|
||||
$inno = 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe'
|
||||
$7z = 'C:\Program Files\7-Zip\7z.exe'
|
||||
@@ -8,7 +8,7 @@ $7z = 'C:\Program Files\7-Zip\7z.exe'
|
||||
$cloudDirectories = 'C:\Users\frank\OneDrive\Public\mpv.net\',
|
||||
'C:\Users\frank\Dropbox\Public\mpv.net\'
|
||||
|
||||
cd $PSScriptRoot
|
||||
# cd $PSScriptRoot
|
||||
|
||||
function UploadBeta($sourceFile)
|
||||
{
|
||||
@@ -32,11 +32,11 @@ function UploadBeta($sourceFile)
|
||||
|
||||
if ($versionInfo.FilePrivatePart -eq 0)
|
||||
{
|
||||
& $inno setup.iss
|
||||
& $inno $PSScriptRoot\setup.iss
|
||||
if ($LastExitCode) { throw $LastExitCode }
|
||||
|
||||
$targetDir = $tmpDir + "\mpv.net-$($versionInfo.FileVersion)-portable"
|
||||
Copy-Item .\mpv.net\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||
Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||
& $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"
|
||||
if ($LastExitCode) { throw $LastExitCode }
|
||||
|
||||
@@ -47,7 +47,7 @@ if ($versionInfo.FilePrivatePart -eq 0)
|
||||
else
|
||||
{
|
||||
$targetDir = "$tmpDir\mpv.net-$($versionInfo.FileVersion)-portable-beta"
|
||||
Copy-Item .\mpv.net\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||
Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
|
||||
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
|
||||
if ($LastExitCode) { throw $LastExitCode }
|
||||
UploadBeta "$targetDir.7z"
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
_ ignore #menu: Video > -
|
||||
Ctrl+s async screenshot #menu: Video > Take Screenshot
|
||||
d cycle deinterlace #menu: Video > Toggle Deinterlace
|
||||
a cycle-values video-aspect "16:9" "4:3" "2.35:1" "-1" #menu: Video > Cycle Aspect Ratio
|
||||
a cycle-values video-aspect 16:9 4:3 2.35:1 -1 #menu: Video > Cycle Aspect Ratio
|
||||
|
||||
KP7 script-message mpv.net cycle-audio #menu: Audio > Cycle/Next
|
||||
_ ignore #menu: Audio > -
|
||||
@@ -163,9 +163,9 @@
|
||||
F1 script-message mpv.net show-command-palette #menu: Tools > Show All Commands
|
||||
h script-message mpv.net show-history #menu: Tools > Show History
|
||||
l ab-loop #menu: Tools > Set/clear A-B loop points
|
||||
L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping
|
||||
L cycle-values loop-file inf no #menu: Tools > Toggle infinite file looping
|
||||
_ playlist-shuffle #menu: Tools > Shuffle Playlist
|
||||
Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding
|
||||
Ctrl+h cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding
|
||||
_ script-message mpv.net show-setup-dialog #menu: Tools > Setup...
|
||||
|
||||
_ script-message mpv.net shell-execute https://mpv.io #menu: Help > Website mpv
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
#define MyAppName "mpv.net"
|
||||
#define MyAppExeName "mpvnet.exe"
|
||||
#define MyAppSourceDir "mpv.net\bin"
|
||||
#define MyAppVersion GetFileVersion("mpv.net\bin\mpvnet.exe")
|
||||
#define MyAppSourceDir "bin"
|
||||
#define MyAppVersion GetFileVersion("bin\mpvnet.exe")
|
||||
|
||||
[Setup]
|
||||
AppId={{9AA2B100-BEF3-44D0-B819-D8FC3C4D557D}}
|
||||
@@ -13,9 +13,9 @@ ArchitecturesInstallIn64BitMode=x64
|
||||
Compression=lzma2
|
||||
DefaultDirName={commonpf}\{#MyAppName}
|
||||
OutputBaseFilename=mpv.net-{#MyAppVersion}-setup
|
||||
OutputDir={#GetEnv('USERPROFILE')}\Desktop
|
||||
OutputDir=D:\Work
|
||||
DefaultGroupName={#MyAppName}
|
||||
SetupIconFile=mpv.net\mpvnet.ico
|
||||
SetupIconFile=mpvnet.ico
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||
|
||||
[Icons]
|
||||
|
||||
@@ -687,19 +687,22 @@ namespace mpvnet
|
||||
case 0x004A: // WM_COPYDATA
|
||||
{
|
||||
var copyData = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));
|
||||
string[] files = copyData.lpData.Split('\n');
|
||||
string mode = files[0];
|
||||
files = files.Skip(1).ToArray();
|
||||
string[] args = copyData.lpData.Split('\n');
|
||||
string mode = args[0];
|
||||
args = args.Skip(1).ToArray();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case "single":
|
||||
core.LoadFiles(files, true, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
core.LoadFiles(args, true, ModifierKeys.HasFlag(Keys.Control));
|
||||
break;
|
||||
case "queue":
|
||||
foreach (string file in files)
|
||||
foreach (string file in args)
|
||||
core.commandv("loadfile", file, "append");
|
||||
break;
|
||||
case "command":
|
||||
core.command(args[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
Activate();
|
||||
|
||||
@@ -998,6 +998,11 @@ namespace mpvnet
|
||||
Console.WriteLine(core.get_property_string("input-key-list").Replace(",", BR));
|
||||
continue;
|
||||
}
|
||||
else if (arg.StartsWith("--command="))
|
||||
{
|
||||
core.command(arg.Substring(10));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!arg.StartsWith("--"))
|
||||
|
||||
Reference in New Issue
Block a user