Jump to content

is there a simple way to pause a script until clipboard changes?


Recommended Posts

i want a script to pause repeatedly until clipboard changes.

i have something i have to do 1800 times and i have to do part of it manually but the part after i copy to clipboard will always remain the same.

so i would like to automate that part and then have it pause again.

Link to comment
Share on other sites

i want a script to pause repeatedly until clipboard changes.

i have something i have to do 1800 times and i have to do part of it manually but the part after i copy to clipboard will always remain the same.

so i would like to automate that part and then have it pause again.

sounds like you should be using a loop rather than a pause.

If you pause the script, it won't "look" for anything, any longer.

Link to comment
Share on other sites

$oldclip = ClipGet()
While 1;this will loop it endlessly
 If $oldclip <> ClipGet() Then
    _DoSomething();run a custom function, set it whatever you want for it.
  Else
  ;;;
 EndIf
 Sleep(100)
Wend

Func _DoSomething()
 ;fill any action you need when clipboard changes
EndFunc

Edited by soulhealer
Link to comment
Share on other sites

but wont wont $clip change everytime the clipboard changes causing $clip to always = $clipget ?

No, because AutoIt behaves according to the previous instruction or context.

$clip = ClipGet();Assignment, sets $clip to be the clipboard contents

But

While $clip = ClipGet();boolean comparison, checks if $clip is the same as the clipboard contents without changing $clip

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

but wont wont $clip change everytime the clipboard changes causing $clip to always = $clipget ?

nah i tried.

i didnt give autoit enough credit.

this will simplify a ton of scripts i write assuming that it wont notice the changes to my $variables without a while $variable = "BLAH"

Link to comment
Share on other sites

$fc = ClipGet()

While ClipGet() = $fc
Sleep(250)
WEnd
MsgBox(64, 'ClipGet', 'ClipBoard has changed !' & @CRLF & ClipGet())

Not tested.

Cheers, FireFox.

Tested... works like a charm!

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

;)

@November

Im happy to have done something working without testing it :think:

Cheers, FireFox.

:)

What a partnership... :shhh:

I'll try to be more beta tester than developer :lmao:

Cheers m8 :>

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Okay I see some code for a one pass but how will you see any other? All you need to accomplish this task is:

GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD")

Do
    _DoAnything()
Until GUIGetMsg() = $GUI_EVENT_CLOSEoÝ÷ Úz0²)Ü{*.q©eyÖ«z¬µêÞvg¬±¨Ê§yçm¡×w¢µ«­¢+ÙÕ¹5µ½]É¥Ñ ÀÌØíÍ5ÍÍôÅÕ½ÐìÅÕ½Ðì¤(U%
ÑɱMÑÑ ÀÌØí¥5µ¼°ÀÌØíÍ5Í͵Àì
I1°Ä¤)¹Õ¹ìôôÐí5µ½]É¥Ñ()Õ¹]5}I]
1%A =I ÀÌØí¡]¹°ÀÌØí¥5Í°ÀÌØí¥ÝAÉ´°ÀÌØí¥±AÉ´¤(5µ½]ɥѡ}
±¥Á  ½É}ÑÑ ¤¤)¹Õ¹ìôôÐí]5}I]
1%A =I

Yes, I know I declared two functions there but always have a side Memo for when I'm doing task, they are easily removed for the final product

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

@November

Im happy to have done something working without testing it :)

Cheers, FireFox.

I can't really see any difference from your script and the one I posted other than that you changed the variable name and increased the sleep...

Link to comment
Share on other sites

I didn't mean to be rude or something, I'm sorry if that's how you got it. It's a verry basic script and only a few ways to do it (all pretty much the same anyway) so it's possible that you just didn't saw my post but it sounded like you ignored me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...