Cannot launch Snipping tool programatically

Hello,

I am trying to programatically launch Snipping Tool but it is not happening, I can launch Task Manager with similar code though.

I have this code…
If SpecialFolder.Windows.Child(“System32”).Child(“Snipping Tool.exe”) <> Nil and SpecialFolder.Windows.Child(“System32”).Child(“Snipping Tool.exe”).Exists then
msgbox “1”
elseIf SpecialFolder.Windows.Child(“System32”).Child(“SnippingTool.exe”) <> Nil and SpecialFolder.Windows.Child(“System32”).Child(“Snipping Tool.exe”).Exists then
msgbox “2”
elseIf SpecialFolder.Windows.Child(“System32”).Child(“SnippingTool”) <> Nil and SpecialFolder.Windows.Child(“System32”).Child(“Snipping Tool.exe”).Exists then
msgbox “3”
elseIf SpecialFolder.Windows.Child(“System32”).Child(“Snipping Tool”) <> Nil and SpecialFolder.Windows.Child(“System32”).Child(“Snipping Tool.exe”).Exists then
msgbox “4”
else
msgbox “5”
SpecialFolder.Windows.Child(“System32”).Launch
end if

The response I get is 5

Kindly assist.

Thanks.

Lennox

Var f As FolderItem

f = SpecialFolder.Windows.Child(“System32”).Child(“SnippingTool.exe”)

f.Launch

Works fine for old snipping tool but I believe newer versions of Windows (22H2 +) snipping tool is in Program Files/WindowsApps

Thanks Brian, it does not work for me… Windows Build 9200, This is a 64-Bit Windows OS operating on a 32-bit processor.

Thanks again.

Lennox

How is that possible ?

1 Like

try
#If TargetWindows Then
Declare Function ShellExecuteW Lib “Shell32” _
(hwnd As Integer, lpOperation As WString, lpFile As WString, _
lpParameters As Ptr, lpDirectory As Ptr, nShowCmd As Integer) As Integer

Var rc As Integer
rc = ShellExecuteW(0, “open”, “ms-screensketch:”, Nil, Nil, 1)
#EndIf

or go directly into it with

#If TargetWindows Then
Soft Declare Function ShellExecuteW Lib “Shell32” _
(hwnd As Integer, lpOperation As WString, lpFile As WString, _
lpParameters As Ptr, lpDirectory As Ptr, nShowCmd As Integer) As Integer

Var result As Integer
result = ShellExecuteW(0, “open”, “ms-screenclip:”, Nil, Nil, 1)
#EndIf

Windows 10/11:

Var sh As New Shell
sh.Execute("start", "ms-screenclip:")

More URI details:

1 Like

Thanks Dave,
Works great, “Snip & Sketch”

Thanks again.

Lennox

No problem!