vanowm Posted May 17, 2008 Posted May 17, 2008 Hello! By default when a message box is popped up and you press CTRL+C it will copy everything that is displayed in that message box to the clipboard, including title, and the buttons. (btw, this feature is not mentioned in the manual under MsgBox) How do one disable this feature or better yet how to change what its copy in clipboard? If I assign a hotkey for CTRL+C it will only work AFTER message box is closed - its not acceptable.. Thank you.
evilertoaster Posted May 17, 2008 Posted May 17, 2008 (edited) MsgBox() blocks the current thread, which means it will be hard to do anything from the same script while it's up. You could consider using multiple scripts to simulate multi-threading, and have one of them simply trap clipboard data with ClipGet() and ClipPut(). Edited May 17, 2008 by evilertoaster
herewasplato Posted May 17, 2008 Posted May 17, 2008 vanowm said: ...(btw, this feature is not mentioned in the manual under MsgBox)...That is not an AutoIt feature. You can do that to any standard Windows MsgBox. vanowm said: ...How do one disable this feature or better yet how to change what its copy in clipboard?...You could disable the clipboard within the Windows OS or monitor the contents - when it matches what came from the MsgBox, you could replace it with the info that you want. use your main script to launch a child script to perform this monitoring. vanowm said: ...If I assign a hotkey for CTRL+C it will only work AFTER message box is closed - its not acceptable..Perhaps you meant this "is not desired". You pretty much have to accept the way that it works or design a work-around to achieve your desired outcome. [size="1"][font="Arial"].[u].[/u][/font][/size]
sandin Posted May 17, 2008 Posted May 17, 2008 maybie this(?): $clipboard = ClipGet () MsgBox(0, "Title", "Text goes here") ClipPut ($clipboard) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll
vanowm Posted May 17, 2008 Author Posted May 17, 2008 (edited) Thanks guys for the information. sandin said: maybie this(?): $clipboard = ClipGet () MsgBox(0, "Title", "Text goes here") ClipPut ($clipboard) This would kinda work, but only after the message box is closed. herewasplato said: That is not an AutoIt feature. You can do that to any standard Windows MsgBox.DOH! didn't know that! I guess the easiest way work around would be create GUI window that looks like a message box... Edited May 17, 2008 by vanowm
ChrisL Posted May 17, 2008 Posted May 17, 2008 (edited) This will work as long as you don't need a return value from the message box _Msgbox(0,"Title","Text") For $i = 1 to 5 ToolTip("The script is still running " & $i) Sleep(1000) Next ToolTip("") Func _MsgBox($iType,$vTitle,$vText,$iDelay=0) If @compiled then Run(FileGetShortName(@ScriptFullPath) & ' /AutoIt3ExecuteLine "MsgBox(' & $iType & ', ''' & $vTitle & ''', '''& $vText &''',''' & $iDelay & ''')"') Else Run (FileGetShortName(@AutoItExe) & ' /AutoIt3ExecuteLine "MsgBox(' & $iType & ', ''' & $vTitle & ''', '''& $vText &''',''' & $iDelay & ''')"') EndIf EndFunc Edit: This isn't doing anything with the clipboard but your main script is still running so you can do whatever else you like while the message is on screen Edited May 17, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ProgAndy Posted May 17, 2008 Posted May 17, 2008 This one wotks with keyboard hooking, you can set a Custom Text, but you don't need to: CODE;"MsgBoxCustCopy.au3" ; by Prog@ndy #include-once #include <Misc.au3> $_MBCustomStrgC_KeyProc_struct = "DWORD vkCode;" _ &"DWORD scanCode;" _ &"DWORD flags;" _ &"DWORD time;" _ &"ULONG_PTR dwExtraInfo" Global $_MBCustomCtrlC_hWinHook, $_MBCustomCtrlC_ClipText, $_MBCustomCtrlC_Title, $_MBCustomCtrlC_Text ; Author: Prog@ndy ; Parameters: like MsgBox, plus 6th parameter for Optional Copy-Text. ; YOU HAVE TO CALL ONLY THIS FUNCTION Func _MBCustomStrgC($flag, $title, $text , $timeout=0 , $hwnd=0,$TextToPut="") $_MBCustomCtrlC_ClipText = $TextToPut $_MBCustomCtrlC_Title = $title $_MBCustomCtrlC_Text = $text $CallBackProc = _MBCustomStrgC_TogglePlugKeyBoard() Local $return = MsgBox($flag, $title, $text , $timeout , $hwnd) _MBCustomStrgC_TogglePlugKeyBoard($CallBackProc) Return $return EndFunc ; from autoitscript.com , don't know which thread anymore Func _MBCustomStrgC_TogglePlugKeyBoard($hCallProc=0) If IsArray($_MBCustomCtrlC_hWinHook) Then DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $_MBCustomCtrlC_hWinHook[0]) DllCallbackFree($hCallProc) $_MBCustomCtrlC_hWinHook = "" Return 0 EndIf Local Const $WH_KEYBOARD_LL = 13 Local $hKeyProc = DllCallbackRegister("_MBCustomStrgC_KeyProc", "int", "int;ptr;ptr") Local $hMod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $_MBCustomCtrlC_hWinHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($hKeyProc), _ "hwnd", $hMod[0], _ "dword", 0) Return $hKeyProc EndFunc ; from autoitscript.com , don't know which thread anymore, but Blocking for CTRL-C added. Func _MBCustomStrgC_KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $iRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $_MBCustomCtrlC_hWinHook[0], _ "int", $nCode, _ "ptr", $wParam, _ "ptr", $lParam) Return $iRet[0] EndIf ;Get Hotkey $dllstruct = DllStructCreate($_MBCustomStrgC_KeyProc_struct,$lParam) If DllStructGetData($dllstruct,1) = 67 And _IsPressed("11") And WinActive($_MBCustomCtrlC_Title,$_MBCustomCtrlC_Text) Then ConsoleWrite("Custom CTRl-C on MsgBox" & @CRLF) If $_MBCustomCtrlC_ClipText <> "" Then ClipPut($_MBCustomCtrlC_ClipText) Return 1 EndIf ;~ ConsoleWrite(DllStructGetData($dllstruct,1) & @LF) ;End Return 0 EndFunc #include "MsgBoxCustCopy.au3" ;######################### ; ## EXAMPLE ## _MBCustomStrgC(0,"Test mbox","Copy only this text",0,0,"Copy only this text") _MBCustomStrgC(0,"Test mbox","Copy NO text") ;######################### *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
vanowm Posted May 19, 2008 Author Posted May 19, 2008 Thanks guys. Didn't expect this be so complicated...at fist I thought (hoped) I missed a feature that can do that...
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