It won't win any beauty prizes, but Microsoft are uglier IMO so, I wrote a batchfile that creates an executable file Paint3D.exe within the same folder. When I open a picture with this Paint3D.exe, it runs the Paint 3D app, and uses the clipboard and simulated keystrokes to force the app to open that picture.
Batch:
// 2>NUL&@ECHO OFF&CLS&GOTO batch
/*
:batch
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v InstallPath`) DO SET "InstallPath=%%F"
SET InstallPath=%InstallPath:*REG_SZ =%
FOR /F "tokens=* Eol= " %%F IN ("%InstallPath%") DO SET "InstallPath=%%F"
IF EXIST "%InstallPath%csc.exe" ("%InstallPath%csc.exe" /out:"%~dp0\Paint3D.exe" /target:winexe "%~dpnx0" /lib:%InstallPath%WPF /r:UIAutomationTypes.dll,UIAutomationClient.dll) ELSE (ECHO ERROR - Missing csc.exe)
PAUSE&EXIT
*/
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Automation;
using System.Windows.Forms;
class Program
{
[DllImport("user32.dll")]
private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
private const int KEYEVENTF_EXTENDEDKEY = 1;
private const int KEYEVENTF_KEYUP = 2;
public static void KeyDown(Keys vKey)
{
keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY, 0);
}
public static void KeyUp(Keys vKey)
{
keybd_event((byte)vKey, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
}
private static void OnWindowOpened(object sender, AutomationEventArgs automationEventArgs)
{
try
{
var element = sender as AutomationElement;
if (element != null && Process.GetProcessById(element.Current.ProcessId).MainModule.FileName ==
Environment.GetFolderPath(Environment.SpecialFolder.System)+"\\ApplicationFrameHost.exe")
{
WindowPattern windowPattern = null;
windowPattern = element.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
if (windowPattern.WaitForInputIdle(5000))
{
System.Threading.Thread.Sleep(3000);
KeyDown(Keys.LControlKey);
KeyDown(Keys.O);
KeyUp(Keys.O);
KeyUp(Keys.LControlKey);
System.Threading.Thread.Sleep(500);
KeyDown(Keys.Space);
KeyUp(Keys.Space);
System.Threading.Thread.Sleep(1500);
KeyDown(Keys.LControlKey);
KeyDown(Keys.V);
KeyUp(Keys.V);
KeyUp(Keys.LControlKey);
KeyDown(Keys.Enter);
KeyUp(Keys.Enter);
}
}
}
catch (ElementNotAvailableException)
{
}
}
[STAThread]
static void Main(string[] args)
{
if (args.Length == 1)
{
Clipboard.SetText(args[0]);
System.Windows.Automation.Automation.AddAutomationEventHandler(
eventId: WindowPattern.WindowOpenedEvent,
element: AutomationElement.RootElement,
scope: TreeScope.Children,
eventHandler: OnWindowOpened);
var p1 = "Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\AppModel\\Repository\\Packages\\";
var p2 = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(p1).GetSubKeyNames().Where(s => s.StartsWith("Microsoft.MSPaint_")).FirstOrDefault();
var p3 = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(p1 + p2).GetValue("PackageRootFolder");
Process.Start(p3 + "\\PaintStudio.View.exe");
System.Threading.Thread.Sleep(15000);
Automation.RemoveAllEventHandlers();
}
}
}
My Computers
System One System Two
-
- OS
- 11 Home
- Computer type
- Laptop
- Manufacturer/Model
- Asus TUF Gaming F16 (2024)
- CPU
- i7 13650HX
- Memory
- 16GB DDR5
- Graphics Card(s)
- GeForce RTX 4060 Mobile
- Sound Card
- Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
- Monitor(s) Displays
- Sony Bravia XR-55X90J
- Screen Resolution
- 3840×2160
- Hard Drives
- 512GB SSD internal
37TB external
- PSU
- Li-ion
- Cooling
- 2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
- Keyboard
- Logitech K800
- Mouse
- Logitech G402
- Internet Speed
- 20Mbit/s up, 250Mbit/s down
- Browser
- FF
-
- Operating System
- 11 Home
- Computer type
- Laptop
- Manufacturer/Model
- Medion S15450
- CPU
- i5 1135G7
- Memory
- 16GB DDR4
- Graphics card(s)
- Intel Iris Xe
- Sound Card
- Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
- Monitor(s) Displays
- Sony Bravia XR-55X90J
- Screen Resolution
- 3840×2160
- Hard Drives
- 2TB SSD internal
37TB external
- PSU
- Li-ion
- Mouse
- Logitech G402
- Keyboard
- Logitech K800
- Internet Speed
- 20Mbit/s up, 250Mbit/s down
- Browser
- FF