Page 1 of 1

Compare value clipboard

Posted: 20 May 2022, 20:11
by perfect1151986
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

Re: Compare value clipboard

Posted: 20 May 2022, 20:27
by mikeyww

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

Re: Compare value clipboard

Posted: 20 May 2022, 20:48
by perfect1151986
Hi mikeyww.
the exam is False. i use msgbox clipboard show is blank. therefore when compare value is False. Help me.

Re: Compare value clipboard

Posted: 20 May 2022, 21:02
by mikeyww
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.

Re: Compare value clipboard

Posted: 21 May 2022, 03:29
by perfect1151986
Thank mikeyww.