8218 Posted February 4, 2014 Share Posted February 4, 2014 I have worked with Autoit before a long time ago, and I am now returning and in the need of a script. It would be running in the background, and every time something is copied (CTRL+C) it would use GetClip() to see if the copied string were formatted like a MAC-Address (XX-XX-XX-XX-XX-XX) and if it was, it would remove the hyphens (-) so it would be XXXXXXXXXXXX instead. Is this possible? Link to comment Share on other sites More sharing options...
JohnOne Posted February 4, 2014 Share Posted February 4, 2014 Is this possible? Yes. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
8218 Posted February 4, 2014 Author Share Posted February 4, 2014 (edited) How do I identify the event of something being copied to the Clipboard then? Edited February 4, 2014 by 8218 Link to comment Share on other sites More sharing options...
JohnOne Posted February 4, 2014 Share Posted February 4, 2014 I don't know, but that was not your question. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
8218 Posted February 4, 2014 Author Share Posted February 4, 2014 How would you know whether it is possile or not, if you don't know how? Link to comment Share on other sites More sharing options...
Andreik Posted February 4, 2014 Share Posted February 4, 2014 Look in help file WM_CLIPBOARDUPDATE message. JohnOne 1 Link to comment Share on other sites More sharing options...
8218 Posted February 4, 2014 Author Share Posted February 4, 2014 Look in help file WM_CLIPBOARDUPDATE message. Thanks, I will check it out Link to comment Share on other sites More sharing options...
Danyfirex Posted February 4, 2014 Share Posted February 4, 2014 another option #include <Misc.au3> local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("11",$hDLL) and _IsPressed("43",$hDLL) then Consolewrite("CTRL+C is PRESSED" & @crlf) ;here some Regular Expression to check MAC format EndIf Sleep(100) WEnd saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
JohnOne Posted February 4, 2014 Share Posted February 4, 2014 How would you know whether it is possile or not, if you don't know how? Because it's possible with hotkeys. Although Andreik has given perfect answer. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted February 4, 2014 Share Posted February 4, 2014 Since I never new Andreik's solution, I made quick basic example. #include <GUIConstantsEx.au3> Example() Func Example() Local $WM_CLIPBOARDUPDATE = 0x031D $mygui = GUICreate("GUI", 100, 100) DllCall("User32.dll", "bool", "AddClipboardFormatListener", "hwnd", $mygui) If @error Then Exit MsgBox(0, "Error", "DllCall") EndIf GUIRegisterMsg($WM_CLIPBOARDUPDATE, "MY_WM_CLIPBOARDUPDATE") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example Func MY_WM_CLIPBOARDUPDATE($hWnd, $Msg, $wParam, $lParam) MsgBox(0, "Success", "Clipboard data changed") EndFunc ;==>MY_WM_CLIPBOARDUPDATE Danyfirex 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted February 4, 2014 Share Posted February 4, 2014 Update. Probably wise to remove listener. #include <GUIConstantsEx.au3> OnAutoItExitRegister("_Exit") Global $mygui Example() Func Example() Local $WM_CLIPBOARDUPDATE = 0x031D $mygui = GUICreate("GUI", 100, 100) DllCall("User32.dll", "bool", "AddClipboardFormatListener", "hwnd", $mygui) If @error Then Exit MsgBox(0, "Error", "DllCall") EndIf GUIRegisterMsg($WM_CLIPBOARDUPDATE, "MY_WM_CLIPBOARDUPDATE") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example Func MY_WM_CLIPBOARDUPDATE($hWnd, $Msg, $wParam, $lParam) MsgBox(0, "Success", "Clipboard data changed") EndFunc ;==>MY_WM_CLIPBOARDUPDATE Func _Exit() DllCall("User32.dll", "bool", "RemoveClipboardFormatListener", "hwnd", $mygui) EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
8218 Posted February 4, 2014 Author Share Posted February 4, 2014 Thanks Andreik and JohnOne, I've created the script now, thanks a lot for the help. Link to comment Share on other sites More sharing options...
Andreik Posted February 4, 2014 Share Posted February 4, 2014 And the clipboard should be modified something like this: Func MY_WM_CLIPBOARDUPDATE($hWnd, $Msg, $wParam, $lParam) Local $vData = ClipGet() If StringRegExp($vData,'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$',0) Then ClipPut(StringUpper(StringReplace($vData,'-',''))) EndIf EndFunc ;==>MY_WM_CLIPBOARDUPDATE Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now