[Solved] Running Snipping Tool

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

[Solved] Running Snipping Tool

29 Feb 2016, 14:03

Edit: wizardzedd solved this with the suggestion to use Run, "C:\Windows\Sysnative\SnippingTool.exe"

Preliminary post. I'll have to strip my code down for testing and removing personal information prior to sharing, but figured I'd ask in case anyone already had a problem like this and had suggestions.

I can't use the code Run, snippingtool.exe apparently.

Code: Select all

---------------------------
Slide Pane.ahk
---------------------------
Error:  Failed attempt to launch program or document:
Action: <snippingtool.exe>
Params: <>

Specifically: The system cannot find the file specified.



	Line#
	422: Return
	425: Run,Notepad.exe
	426: Gosub,Restore
	427: Return
	430: Run,mspaint.exe
	431: Gosub,Restore
	432: Return
--->	435: Run,snippingtool.exe
	436: Gosub,Restore
	437: Return
	440: Run,control
	441: Gosub,Restore
	442: Return
	445: Loop,25
	446: {

The current thread will exit.
---------------------------
OK   
---------------------------

But if I manually launch the run program (windows key, type "run" and enter), then the snipping tool totally launches with only snippingtool.exe written into it.
Last edited by Exaskryz on 29 Feb 2016, 18:53, edited 1 time in total.
wizardzedd
Posts: 319
Joined: 23 Jan 2016, 23:03

Re: Running Snipping Tool

29 Feb 2016, 14:27

I think it has to do with the strange path of SnippingTool, The shortcut for snipping tool shows the target as %windir%\system32\SnippingTool.exe , but if I run that in ahk (%a_windir%\system32\SnippingTool.exe) it also fails. Baffling indeed. But this works Run, "C:\Windows\Sysnative\SnippingTool.exe" for me anyway. See https://autohotkey.com/board/topic/2052 ... utohotkey/
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Running Snipping Tool

29 Feb 2016, 16:47

Because I infrequently find a use for the snipping tool, often Alt+PrintScreen is enough for me. Whatever the purpose of the Screen Clipping link is, it needs to be better explained for me to see the benefit ;)

The original context for this script was a gLabel in my GUI, and I thought I had it working at some point, but as of late it's been broken. I can't be sure that it ever did work though (which is weird cause I'd think I'd have tried it out when I first made the GUI...)

Anywhere, this code fails:

Code: Select all

^6::Run, C:\Windows\system32\SnippingTool.exe
^7::MsgBox % FileExist("C:\Windows\system32\SnippingTool.exe")
But this works:

Code: Select all

^8::MsgBox % FileExist("C:\Windows\system32\SndVol.exe")
So it seems to be a problem only for SnippingTool.exe and not any other executable within the system32 folder. Operating system is Windows 8.1 and AHK version is 1.1.22.09 (Unicode 32-bit). Will upgrade shortly here to 1.1.23.01 to see if it's resolved.

Edit: Problem persists on 1.1.23.01 for Unicode 32-bit.
wizardzedd
Posts: 319
Joined: 23 Jan 2016, 23:03

Re: Running Snipping Tool

29 Feb 2016, 17:25

Screen Clipping is basically like the snipping tool, except better in every way (more snips, can hold them on top, can e-mail, etc...) . Joe Glines made a video on its uses at https://www.youtube.com/watch?v=eVfxrLZkDR0
Anyway did you try Run, "C:\Windows\Sysnative\SnippingTool.exe" ?
if this case is similar to the other thread, than Run, C:\Windows\system32\StikyNot.exe (sticky notes) will also not work. So Snipping tool isn't the only one.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Running Snipping Tool

29 Feb 2016, 18:52

Oh man, I got distracted with the Screen Clipping follow up that I forgot to try the Sysnative. Thanks for the reminder. the Sysnative directory did work for me.

Working code: ^8::Run, "C:\Windows\Sysnative\SnippingTool.exe"

Edit: You know, this may have become a problem when I downgraded from 64 bit AHK to 32 bit AHK for some other reason. (Now I can't remember why I did that. File association problems of some sort maybe?) So the conversations in the linked thread at https://autohotkey.com/board/topic/2052 ... utohotkey/ may explain how I swore it worked at one point.

Oh, yeah, now I remember. I changed to 32 bit because ActiveX GUI elements wouldn't work on 64 bit. I added the ActiveX element after I added in my Snipping Tool glabel.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: [Solved] Running Snipping Tool

29 Feb 2016, 21:19

This does not really pertain to your problem but since you mention using the Snipping Tool, below is a standard script that I have running all the time to make using the Snipping Tool and the Calculator easier.

Code: Select all

; Quick Tools
; Fanatic Guru
; 2015 04 09
;
; Shortcuts to bring up Windows Tools
;
;{-----------------------------------------------
; Window+X          Open/Activate/Minimize Windows Snipping Tool
; Window+Numpad 0   Open/Activate/Minimize Windows Calculator
;}

; INITIALIZATION - ENVIROMENT
;{-----------------------------------------------
;
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force  ; Ensures that only the last executed instance of script is running
;}

; HOTKEYS
;{-----------------------------------------------
;
#x::	; <-- Open/Activate/Minimize Windows Snipping Tool
{
	if WinExist("ahk_class Microsoft-Windows-Tablet-SnipperToolbar")
	{
		WinGet, State, MinMax
		if (State = -1)
		{	
			WinRestore
			Send, ^n
		}
		else if WinActive()
			WinMinimize
		else
		{
			WinActivate
			Send, ^n
		}
	}
	else if WinExist("ahk_class Microsoft-Windows-Tablet-SnipperEditor")
	{
		WinGet, State, MinMax
		if (State = -1)
			WinRestore
		else if WinActive()
			WinMinimize
		else
			WinActivate
	}
	else
		Run SnippingTool.exe
	return
}

#numpad0::	; <-- Open/Activate/Minimize Windows Calculator
{
	if WinExist("ahk_class CalcFrame")
		if WinActive()
			WinMinimize
		else
			WinActivate
	else
		Run calc.exe
	return
}
;}
It basically runs them if they are not running. Minimizes them if active and activates them if minimized. Nothing earthshaking but it made it where I got rid of the physical calculator I had on my desk for years. I hit window+numberpad zero many times a day now. I just wish I had a good simple free architectural calculator for Windows, which I have not been able to find.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
sehradinesh

That worked. Thanks.

13 Oct 2018, 01:22

That "C:\Windows\Sysnative\SnippingTool.exe" worked. Strange indeed. Thanks anyways.

I think it has to do with the strange path of SnippingTool, The shortcut for snipping tool shows the target as %windir%\system32\SnippingTool.exe , but if I run that in ahk (%a_windir%\system32\SnippingTool.exe) it also fails. Baffling indeed. But this works Run, "C:\Windows\Sysnative\SnippingTool.exe" for me anyway. See https://autohotkey.com/board/topic/20525-how-to-launch-snipping-tool-in-vista-using-autohotkey/[/quote]
Johncoool
Posts: 20
Joined: 18 Jul 2018, 17:15

Re: [Solved] Running Snipping Tool

21 May 2020, 07:57

I know that is 4 years too late.

I was looking for a solution to this issue today and found this thread which did not contain a proper solution.

Then I tried to place the snipping tool in another directory and it worked (SnippingTool.exe). It worked in "D:\SnippingTool.exe"

It should work in any other directory.

FYI: Files that are in system32 folder do not require the entire path to run exe files.

You can just type the exact full file name in run or other programs to run them.

However, it did not work for SnippingTool.exe in Autohotkey but notepad.exe and some others do that are in the system32 folder.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ReyAHK, Spawnova and 283 guests