Compare value clipboard

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
perfect1151986
Posts: 13
Joined: 30 Mar 2022, 21:06

Compare value clipboard

Post by perfect1151986 » 20 May 2022, 20:11

Im newbie. everybody help me.
I want compare value & clipboard. The exam always False.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
SetkeyDelay, 20, 50
F3::
ControlGetText, Var, ThunderRT6TextBox11, ahk_class ThunderRT6MDIForm
MsgBox % Var
Clipboard=""
Send ^c
Copy1 = Clipboard
ClipWait  ; Wait for the clipboard to contain text.
msgBox % Copy1
If ( Var = %Clipboard% )
	MsgBox True
	Else
	Msgbox False
return
[Mod edit: [code][/code] tags added.]

I dont understand. help me. thank

User avatar
mikeyww
Posts: 26877
Joined: 09 Sep 2014, 18:38

Re: Compare value clipboard

Post by mikeyww » 20 May 2022, 20:27

Code: Select all

F3::
ControlGetText, Var, ThunderRT6TextBox11, ahk_class ThunderRT6MDIForm
MsgBox % Var
Clipboard := ""
Send ^c
ClipWait, 0
If ErrorLevel {
 MsgBox, 48, Error, An error occurred while waiting for the clipboard.
 Return
}
If (Var = Clipboard)
     MsgBox, True
Else Msgbox, False
Return
Explained: IfExpressions

perfect1151986
Posts: 13
Joined: 30 Mar 2022, 21:06

Re: Compare value clipboard

Post by perfect1151986 » 20 May 2022, 20:48

Hi mikeyww.
the exam is False. i use msgbox clipboard show is blank. therefore when compare value is False. Help me.

User avatar
mikeyww
Posts: 26877
Joined: 09 Sep 2014, 18:38

Re: Compare value clipboard

Post by mikeyww » 20 May 2022, 21:02

My script does not display the clipboard. If the clipboard is blank, an error message is displayed.

Debugging this is easy, because you can simply display the Var as well as the clipboard. You can then see for yourself whether they match. If one of them contains extra white space, then the strings differ.

Your original script contains bugs, so I would work with the script that I posted. You can add some new MsgBox lines. If it does not work, post your revision below.

perfect1151986
Posts: 13
Joined: 30 Mar 2022, 21:06

Re: Compare value clipboard

Post by perfect1151986 » 21 May 2022, 03:29

Thank mikeyww.

Post Reply

Return to “Ask for Help (v1)”