Snipping Tool (default to new snip)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
seriously5OH

Snipping Tool (default to new snip)

13 Jun 2018, 10:47

I found the following AHK code online at TenForums. It does not work. Any suggestions on making this code work to automatically open Snipping Tool and execute the New Snip function with one keyboard shortcut?

Code: Select all

#s::
IfWinExist Snipping Tool
	WinActivate
else
	Run "c:\windows\system32\SnippingTool.exe"
    WinWait,  Snipping Tool,,1
	ControlClick, x40 y40, Snipping Tool
return
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Snipping Tool (default to new snip)

13 Jun 2018, 15:46

this works for me

Code: Select all

#s::
if WinExist( "Snipping Tool" )
{
	ControlClick, x40 y40, Snipping Tool
}
else 
{
	Run SnippingTool.exe /clip
}
return
User avatar
JoeWinograd
Posts: 2182
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Snipping Tool (default to new snip)

13 Jun 2018, 16:03

This thread at another forum where I participate may help you:
Restore Windows 7 Snipping Tool function to Windows 10
Regards, Joe
iseahound
Posts: 1434
Joined: 13 Aug 2016, 21:04
Contact:

Re: Snipping Tool (default to new snip)

13 Jun 2018, 16:13

Windows 7/10 compatible

Code: Select all

#s::
   if WinExist("Snipping Tool"){
      WinActivate
      Send, ^n
   } else {
      try
         Run C:\Windows\SysNative\SnippingTool.exe
      catch {
         Run %A_WinDir%\System32\SnippingTool.exe
         WinWaitActive, Snipping Tool
         Send, ^n
      }
   }
   return
If you're on windows 10, the built in hotkey is #+s.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Snipping Tool (default to new snip)

13 Jun 2018, 16:19

seriously5OH wrote:I found the following AHK code online at TenForums. It does not work. Any suggestions on making this code work to automatically open Snipping Tool and execute the New Snip function with one keyboard shortcut?

Code: Select all

#s::
IfWinExist Snipping Tool
	WinActivate
else
	Run "c:\windows\system32\SnippingTool.exe"
    WinWait,  Snipping Tool,,1
	ControlClick, x40 y40, Snipping Tool
return
Here is my script for accessing the Snipping Tool and Calculator easier.

Code: Select all

; Quick Tools
; Fanatic Guru
; 2017 09 18
;
; 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
{
	SetTitleMatchMode, % (Setting_A_TitleMatchMode := A_TitleMatchMode) ? "RegEx" :
	if WinExist("ahk_class Microsoft-Windows-.*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-.*SnipperEditor")
	{
		WinGet, State, MinMax
		if (State = -1)
			WinRestore
		else if WinActive()
			WinMinimize
		else
			WinActivate
	}
	else
	{
		Run, snippingtool.exe
		if (SubStr(A_OSVersion,1,2)=10)
		{
			WinWait, ahk_class Microsoft-Windows-.*SnipperToolbar,,3
			Send, ^n
		}
	}
	SetTitleMatchMode, %Setting_A_TitleMatchMode%
	return
}

#numpad0::	; <-- Open/Activate/Minimize Windows Calculator
{
	if WinExist("Calculator ahk_class CalcFrame") or WinExist("Calculator ahk_class ApplicationFrameWindow")
		if WinActive()
			WinMinimize
		else
			WinActivate
	else
		Run calc.exe
	return
}
;}
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
seriously5OH

Re: Snipping Tool (default to new snip)

14 Jun 2018, 08:01

None of them work for me because WIN+S keeps bringing up Cortana search bar.
seriously5OH

Re: Snipping Tool (default to new snip)

14 Jun 2018, 12:12

iseahound wrote:Windows 7/10 compatible

Code: Select all

#s::
   if WinExist("Snipping Tool"){
      WinActivate
      Send, ^n
   } else {
      try
         Run C:\Windows\SysNative\SnippingTool.exe
      catch {
         Run %A_WinDir%\System32\SnippingTool.exe
         WinWaitActive, Snipping Tool
         Send, ^n
      }
   }
   return
If you're on windows 10, the built in hotkey is #+s.
yes i am on windows 10 and even this code is not working because the win + S brings up Cortana search box.
seriously5OH

Re: Snipping Tool (default to new snip)

14 Jun 2018, 15:25

JoeWinograd wrote:This thread at another forum where I participate may help you:
Restore Windows 7 Snipping Tool function to Windows 10
Regards, Joe
Same problem ... win+S brings up Cortana search box, not Snipping Tool.
User avatar
JoeWinograd
Posts: 2182
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Snipping Tool (default to new snip)

14 Jun 2018, 16:41

Either stop Win+S from being a Cortana keyboard shortcut (a web search will show you how) or use another hotkey for the Snipping Tool. Note this comment at the link I gave you:

"Use whatever hotkey you want (the code above makes Win-S the Snipping Tool hotkey)."

Regards, Joe
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Snipping Tool (default to new snip)

14 Jun 2018, 17:11

seriously5OH wrote:
JoeWinograd wrote:Same problem ... win+S brings up Cortana search box, not Snipping Tool.
You need to make sure you have the ability to create any hotkey with win+s.

You can test with this.

Code: Select all

#s::
	MsgBox Yes
return
For the record I have no problem making a win+s hotkey in Windows 10.

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
seriously5OH

Re: Snipping Tool (default to new snip)

15 Jun 2018, 13:01

It's my work computer at a large corporation. They won't let me do anything that requires admin login. Disabling the windows key requires admin. I will just choose another key combination. Thanks guys.

Control + Shift + S::
will this work?
User avatar
JoeWinograd
Posts: 2182
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Snipping Tool (default to new snip)

15 Jun 2018, 13:28

Control + Shift + S::
will this work?
Yes.
seriously5OH

Re: Snipping Tool (default to new snip)

15 Jun 2018, 14:11

Error at line 6.

Line Text: Control+Shift+s::
Error: Invalid hotkey

The program will exit.

Code: Select all

Control+Shift+s::
   if WinExist("Snipping Tool"){
      WinActivate
      Send, ^n
   } else {
      try
         Run C:\Windows\SysNative\SnippingTool.exe
      catch {
         Run %A_WinDir%\System32\SnippingTool.exe
         WinWaitActive, Snipping Tool
         Send, ^n
      }
   }
   return
User avatar
JoeWinograd
Posts: 2182
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Snipping Tool (default to new snip)

15 Jun 2018, 14:28

You need to learn the correct syntax for keys and modifiers, which are documented here:
https://autohotkey.com/docs/KeyList.htm
https://autohotkey.com/docs/Hotkeys.htm#Symbols

After studying that, you'll know that the first line in your script should be this:

Code: Select all

^+s::
Regards, Joe
seriously5OH

Re: Snipping Tool (default to new snip)

15 Jun 2018, 15:06

Ok i actually had looked at the first document. But now that i've done some reading on the second document i am on board. :) thanks for the help as i learn this program.

Thanks to all.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: garry, Google [Bot], mikeyww, steve88 and 174 guests