Clipboard1, Clipboard2?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chef423
Posts: 213
Joined: 28 Aug 2016, 12:10
Contact:

Clipboard1, Clipboard2?

22 May 2018, 13:32

Is this possible? If not what is the best way to assign a variable to 2 different Integers captured by the clipboard?

Thank you
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Clipboard1, Clipboard2?

22 May 2018, 13:49

example , F7 copy , F8 show all copied

Code: Select all

;- copy marked text
$f7::
clipboard:=""
sendinput, ^c{right}
clipwait,2
cl .= clipboard . "`r`n-----------------------`r`n"
msgbox, 262208,,%clipboard%,1
clipboard=
return


;- show clipboard all
$F8::
msgbox, 262208,,%cl%,
return
chef423
Posts: 213
Joined: 28 Aug 2016, 12:10
Contact:

Re: Clipboard1, Clipboard2?

22 May 2018, 15:19

garry wrote:example , F7 copy , F8 show all copied

Code: Select all

;- copy marked text
$f7::
clipboard:=""
sendinput, ^c{right}
clipwait,2
cl .= clipboard . "`r`n-----------------------`r`n"
msgbox, 262208,,%clipboard%,1
clipboard=
return


;- show clipboard all
$F8::
msgbox, 262208,,%cl%,
return
Thanks Gary, how to clear %cl% ?? clear it from the clipboard, period ?
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Clipboard1, Clipboard2?

22 May 2018, 16:07

to clear cl >> cl=
maybe add

Code: Select all

$F9::
cl=
return
chef423
Posts: 213
Joined: 28 Aug 2016, 12:10
Contact:

Re: Clipboard1, Clipboard2?

22 May 2018, 16:25

garry wrote:to clear cl >> cl=
maybe add

Code: Select all

$F9::
cl=
return
My issue is this...IF cl is 'empty' meaning nothing was copied, then exit the code and wait for +F7 to be pressed again. It keeps failing...not sure why.

Its the (part of code)
If cl=
Exit
Else

..part that isnt working...If nothing is copied, then EXIT and wait for SHIFT F7 again

Also, is Clip:="" the same as Clip= ??

Code: Select all

; Service Fee - Credit
+F7::
	SetTitleMatchMode, 2
	IfWinExist, Cash Register Express
	{
	Send, +{Left 6}
	sleep 50
	Send, ^{Ins} ; Copy into Clip1
	clipboard:=""
	; sendinput, ^c{right}
	clipwait,1
	cl .= clipboard
	Send, {Backspace}
	If cl=
	Exit
	else
	; Customer presses Credit Debit button

	Clipboard=
	send,!p

	send, %cl%	
	send, !c
	
	Send, ^{Ins}
	; Cancel back to Invoice Screen
	Send, !n
	; Send ItemNum into 'Scan Barcode Now...' - 1236
	Send, 1236{Enter} 
	; THANK YOU
	; Has tagalong 1234 SERVICE FEE .035
	; Paste 0.035 in the Pay Applet in the Quantity
	Send, 0.035
	Send, !o
	; Paste Amount from contents copied from the Pay Applet in the Price
	Send, ^v
	Send, !o
	; Press OK on Enter Price Service Fee applet
	; Initiate Credit Debit applet, directly
	Send, !p
	; WinActivate, Cash Register Express

	Sleep 100
	send, %cl%
	Send, !c	
	Send, !r!r
	Sleep, 2000
	#Persistent
	SetTimer, Alert1, 20
	return

	Alert1:
	IfWinNotExist, Payment Processor Error
    	return
	; Otherwise:
	SetTimer, Alert1, Off  ; i.e. the timer turns itself off here.
	Send, !o!n{Up}{Del} ; removed service fee
	cl=
	Clipboard=1111
	return
	}
	Else
	{
	; DO nothing
	}
	cl=
	Clipboard=1111
	Return
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Clipboard1, Clipboard2?

23 May 2018, 02:43

Also, is Clip:="" the same as Clip= ??
yes , but this is only a variable 'clip' ( not the clipboard )

just short , example :
variable cl1 in this case collects all clipboard contents
variable cl2 is only the last clipboard
cl1 .= clipboard . "`r`n" ; and add end of line
cl2 :=clipboard

clipboard ( this is really the clipboard )
you must check if clipboard is empty
-------------------------------------------------
if cl2 =
....
;or
if clipboard =
....
chef423
Posts: 213
Joined: 28 Aug 2016, 12:10
Contact:

Re: Clipboard1, Clipboard2?

23 May 2018, 14:59

garry wrote:
Also, is Clip:="" the same as Clip= ??
yes , but this is only a variable 'clip' ( not the clipboard )

just short , example :
variable cl1 in this case collects all clipboard contents
variable cl2 is only the last clipboard
cl1 .= clipboard . "`r`n" ; and add end of line
cl2 :=clipboard

clipboard ( this is really the clipboard )
you must check if clipboard is empty
-------------------------------------------------
if cl2 =
....
;or
if clipboard =
....
Thanks Gary. After thinking about this problem further. There is always data in the Clipboard for this program, there has to be for it to function correctly.

So i need to think of it as "if nothing NEW is entered into clip, then do nothing (return)"

Thanks
chef423
Posts: 213
Joined: 28 Aug 2016, 12:10
Contact:

Re: Clipboard1, Clipboard2?

23 May 2018, 15:10

If Clipboard change....(so I would save the original value first?) then if Clip changes, continue, if the same data/Clip, return (do nothing)
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Clipboard1, Clipboard2?

23 May 2018, 15:28

example with OnClipboardChange

Code: Select all

#Persistent
F1=%A_Desktop%\%A_YYYY%-%A_MM%-%A_DD%.txt
clipboard=
return

OnClipboardChange:
;if (A_EventInfo<>0)
if (A_EventInfo=1)
   {
   C1:=clipboard
   FileAppend,%C1%`r`n,%F1%
   Splashimage,,b w600 h150 x100 Y400 CWsilver m9 b fs10 zh0,%C1%
   sleep,900
   Splashimage, off
   clipboard=
   }
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ccqcl, Descolada, inseption86, mebelantikjaya and 338 guests