Suppir
Active Members-
Posts
82 -
Joined
-
Last visited
Suppir's Achievements
Wayfarer (2/7)
0
Reputation
-
How to get all data from clipboard?
Suppir replied to Suppir's topic in AutoIt General Help and Support
And the second question: what the differrence beetwen _ClipBoard_GetData and _ClipBoard_GetDataEx? -
Hello! I know that data in clipboard exists in several formats ($CF_TEXT, $CF_OEMTEXT, etc). Sometimes we have 4 formats, sometimes 8 or more. We can retrieve data in specified format to variable using _ClipBoard_GetData(). But can you tell me, is it possible to get "snapshot" of ALL clipboard data (in any existing format) to 2-dimentional array? Later I wish to "fill" empty clipboard with the data from this 2-d array.
-
How to catch files that drag & dropped on trey menu?
Suppir replied to Suppir's topic in AutoIt General Help and Support
Yes, I understand. But I think there is a way exists. Something like: If IsPressed("01") And MouseOverTray() Then GetObjectsPathFromDropFiles() # maybe there is a special dllcall exists to get this data?? Endif -
<GuiRichEdit.au3> - can I do regex replace in edit form?
Suppir replied to Suppir's topic in AutoIt General Help and Support
So, we have some data (with tables, styles, etc) in richedit, then we do regex' replaces there. For example: Find:[\t ]+ Replace to: Find:([\( ])(№|N)[ °]*(\d) Replace to:$1N $3 How to do it? -
<GuiRichEdit.au3> - can I do regex replace in edit form?
Suppir replied to Suppir's topic in AutoIt General Help and Support
I found that regexes do not work. There is the only way to write data to RTF, and do replaces there, than render RTF in RichEdit again. -
<GuiRichEdit.au3> - can I do regex replace in edit form?
Suppir replied to Suppir's topic in AutoIt General Help and Support
If there is no regex support, is there any way to get collection of elements in Edit field. If I could to do regex' search and replaces through this collection... -
Hello! I have some RTF-data in buffer. I can ripoff this data with function written below. But how to do search-replace in this data and put it back into buffer? func _ClipBoard_GetDataAlternative($Formato = 1) If Not (_ClipBoard_IsFormatAvailable($Formato) Or $Formato=18 Or $Formato=19) Then Return SetError(-1, 0, 0) If Not _ClipBoard_Open(0) Then Return SetError(-2, 0, 0) Switch $Formato Case 18 $iFormat=_ClipBoard_RegisterFormat ("Rich Text Format") If $iFormat=0 Then Return SetError(-1, 0, 0) Case 19 $iFormat=_ClipBoard_RegisterFormat ("HTML Format") If $iFormat=0 Then Return SetError(-1, 0, 0) Case Else $iFormat=$Formato EndSwitch Local $hMemory = _ClipBoard_GetDataEx($iFormat) ;_ClipBoard_Close() ; moved to end: traditionally done *after* copying over the memory If $hMemory=0 Then _ClipBoard_Close() Return SetError(-3, 0, 0) EndIf Local $pMemoryBlock=_MemGlobalLock($hMemory) If $pMemoryBlock=0 Then _ClipBoard_Close() Return SetError(-4,0,0) EndIf ; Get the actual memory size of the ClipBoard memory object (in bytes) Local $iDataSize=_MemGlobalSize($hMemory) If $iDataSize = 0 Then _MemGlobalUnlock($hMemory) _ClipBoard_Close() Return SetError(-5,0,"") EndIf Local $tData Switch $Formato Case $CF_TEXT, $CF_OEMTEXT, 18, 19, 20 $tData = DllStructCreate("char[" & $iDataSize & "]", $pMemoryBlock) Case $CF_UNICODETEXT ; Round() shouldn't be necessary, as CF_UNICODETEXT should be 2-bytes wide & thus evenly-divisible $iDataSize=Round($iDataSize/2) $tData = DllStructCreate("wchar[" & $iDataSize & "]", $pMemoryBlock) Case Else ; Binary data return for all other formats $tData = DllStructCreate("byte[" & $iDataSize & "]", $pMemoryBlock) EndSwitch ; Grab the data from the Structure so the Memory can be unlocked Local $vReturn = DllStructGetData($tData, 1) ; Unlock the memory & Close the clipboard now that we have grabbed what we needed _MemGlobalUnlock($hMemory) _ClipBoard_Close() ; Return the size of the string or binary object in @extended Return SetExtended($iDataSize, $vReturn) EndFunc ;==>_ClipBoard_GetData
-
ControlSend modifies the string :(
Suppir replied to Suppir's topic in AutoIt General Help and Support
Does not work in this way. I found a recept! $var = "1000.10" WinActivate("Our form") Global $hWnd = WinGetHandle('') ; get handle to our application $def_lang = GetCurrentLayout($hWnd) ; remember current layout if GetDefaultLayout() = 1 Then SetCurrentLayout('0419', $hWnd) ; if layout by default is russian then set current layout russian Else SetCurrentLayout('0409', $hWnd) ; else set current layout english EndIf ControlSend("", "", "", $var) ; using ControlSend in "right" layout SetCurrentLayout($def_lang, $hWnd) ; return our previous layout Func GetCurrentLayout($hWnd) Local $Ret = DllCall('user32.dll', 'long', 'GetWindowThreadProcessId', 'hwnd', $hWnd, 'ptr', 0) $Ret = DllCall('user32.dll', 'long', 'GetKeyboardLayout', 'long', $Ret[0]) Return Hex($Ret[0], 4) EndFunc Func GetDefaultLayout() If @KBLayout = 00000419 Or @KBLayout = 0419 Then Return 1 If @KBLayout = 00000409 Or @KBLayout = 0409 Or @KBLayout = 0809 Or @KBLayout = 00000809 Then Return 0 EndFunc Func SetCurrentLayout($sLayout, $hWnd) Local $Ret = DllCall('user32.dll', 'long', 'LoadKeyboardLayout', 'str', StringFormat('%08s', StringStripWS($sLayout, 8)), 'int', 0) DllCall('user32.dll', 'ptr', 'SendMessage', 'hwnd', $hWnd, 'int', 0x0050, 'int', 1, 'int', $Ret[0]) EndFunc The MAIN IDEA: you need to sinchronize our current layout and layout by default. Then ControlSend will work fine, else - it will modify our strings. -
Hello! I'm trying to send variable "10000.10" to the form in some applycation. If I have english keybord layout by default, and english layout by current, all works fine. But if a have russian keybord layout by default (or by current), AutoIt prints "10000/10" to the form. I can not use ControlSetText to this form because it's protected. Can only use Send or ControlSend. I can not change layout by default, because users will be indignant. What should I do?
-
Hello! Can you tell me. If I have RTF-data in clipboard, how should I use your function to create HTML-file ?
-
no-no-no. Clipboard consists of data, that we copyed from MS Word. It is not raw(plain) text, but formatted text with tables, styles, etc. And I have to do replaces with regular expressions in this text (because MS Word does not support RCRE). If we just do what you've written, all tables and styles will dissapper.
-
Is it possible to do some replaces in clipboard before generating HTML? Replaces with regular expressions.
-
That is nice too!