I want to get my OS version on the clipboard.

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
LAPIII
Posts: 667
Joined: 01 Aug 2021, 06:01

I want to get my OS version on the clipboard.

Post by LAPIII » 05 Feb 2023, 14:56

In my code I couldn't use my option and the clipboard is not getting what I wanted which was that text and output of the variable:

Code: Select all

MsgBox % "Windows 11 Pro " A_OSVersion, "The below is copied to the clipboard.", 262144
Clipboard := Windows 11 Pro  “ “ A_OSVersion


User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: I want to get my OS version on the clipboard.

Post by boiler » 05 Feb 2023, 16:37

LAPIII wrote:

Code: Select all

MsgBox % "Windows 11 Pro " A_OSVersion, "The below is copied to the clipboard.", 262144
Clipboard := Windows 11 Pro  “ “ A_OSVersion
Using a % symbol followed by a space to force an expression is a v1 thing. Everything in v2 is already an expression. Get rid of the % symbol.

In the second line, as noted above, it's A_Clipboard. Then you have a literal string that you didn't put quotes around (Windows 11 Pro), and then you seemed to think the space is to be quoted but what was before it shouldn't have been, as if what before it was a variable. And you use curly-quote characters instead of straight quote characters (") around that space, so they do nothing. Corrected:

Code: Select all

MsgBox "Windows 11 Pro " A_OSVersion, "The below is copied to the clipboard.", 262144
A_Clipboard := "Windows 11 Pro " A_OSVersion

Post Reply

Return to “Ask for Help (v2)”