I was a bit bored so I created a simple script for replacing insert key with virtual desktop switch

Post your working scripts, libraries and tools for AHK v1.1 and older
kjkardum
Posts: 1
Joined: 15 Jan 2019, 16:13

I was a bit bored so I created a simple script for replacing insert key with virtual desktop switch

15 Jan 2019, 16:21

Because most people don't have multi monitor setup, and even less people use insert key, I made a simple script that changes between two virtual desktops(that need to be created before using script) by doing a single click instead of three button combination.

Code: Select all

CurrentDesktop:=1
*Ins::
	if (CurrentDesktop=1){
		Send, ^#{Right}
		CurrentDesktop:=2
		return
	} else {
		Send,^#{Left}
		CurrentDesktop:=1
		return
	}
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: I was a bit bored so I created a simple script for replacing insert key with virtual desktop switch

15 Jan 2019, 17:00

You can minimize the code a bit:

Code: Select all

#SingleInstance, Force

CurrentDesktop := 1

*Ins::
	Send, % (CurrentDesktop = 1 ? "^#{Right}" : "^#{Left}")
	CurrentDesktop := (CurrentDesktop = 1 ? 2 : 1)
return
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: I was a bit bored so I created a simple script for replacing insert key with virtual desktop switch

15 Jan 2019, 17:20

You can minimize the code a bit more...
Spoiler

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Epoch and 51 guests