jchd Posted January 14, 2016 Posted January 14, 2016 my script is a clipboard monitor, it checks clipboard content every secondThat's the root cause of the issues. Why not register a custom viewer which is invoked every time the clipboard is updated and only then?You should probably try using _WinAPI_AddClipboardFormatListener instead, or something along the same line. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
mikell Posted January 14, 2016 Posted January 14, 2016 jc, this might not work as the OP is running XP
jchd Posted January 14, 2016 Posted January 14, 2016 Sorry for that. I'm still persuaded that there is the possibility to intercept an XP-compatible Windows message denoting that the clipboard got loaded. Unfortunately I curently don't have enough time to dig further. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
k4rl3on Posted January 14, 2016 Author Posted January 14, 2016 That's the root cause of the issues. Why not register a custom viewer which is invoked every time the clipboard is updated and only then?You should probably try using _WinAPI_AddClipboardFormatListener instead, or something along the same line.i test it one time (without calling the function avery second) and it causes the problem.
jchd Posted January 14, 2016 Posted January 14, 2016 Can you post such a reproducer? I'm curious to see a well-behaved message handling function eating a whole core. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
k4rl3on Posted January 15, 2016 Author Posted January 15, 2016 the large amount of data: i try to copy 3650 .png files with a size of: 16px = 3650*1.12 = 4088 / 1024 = 3,9 MBtype: i want just the list of those files names as ClipGet() returns it = Textversion of Windows: XP 500MB RAM.AutoIt (Latest Stable Version) v3.3.14.2Yes i useLocal $ClipBoardData = StringMid(ClipGet (), 1, 1024) Thank youjchdJust call ClipGet() after copying 3650 files and you will constat it.
jchd Posted January 15, 2016 Posted January 15, 2016 Looks like memory shortage then. From where do you select those image files ? Is that in Explorer displaying thumbnails?I can't test in this conficuration: I run W7 x64 with los of RAM, so the issue doesn't happen. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
k4rl3on Posted January 15, 2016 Author Posted January 15, 2016 Hi,i finally found a solution to the problem, here is a script:expandcollapse popupLocal $ClipBoardSec = 0 Local $owner = "" While True $ClipBoardCurSec = _ClipBoard_GetSequenceNumber() ; Check if clipboard content changes If $ClipBoardSec <> $ClipBoardCurSec Then $ClipBoardSec = $ClipBoardCurSec $owner = _ClipBoard_GetOwner() ConsoleWrite("SequenceNumber: "&$ClipBoardSec&@CRLF) ;Clipboard contains Text If _ClipBoard_IsFormatAvailable(1) Then ConsoleWrite("Texte: "&ClipGet()&@CRLF) ;Clipboard contains Bitmap ElseIf _ClipBoard_IsFormatAvailable(2) Then ConsoleWrite("Image: "&@CRLF) ;Clipboard contains Files ElseIf _ClipBoard_IsFormatAvailable(15) Then ;List of selected files (copied) ConsoleWrite("Files: "&_ExplorerGetSelectedItems()&@CRLF) EndIf ConsoleWrite(" ******** "&@CRLF) EndIf Sleep(1000) WEnd Func _ExplorerGetSelectedItems($sCabinetWClass="[CLASS:CabinetWClass]") Local $Ret = "" Local $aIndexes, $sSelected, $sSelected_Path Local $hSearch, $sCurrentFile $sSelected_Path = ControlGetText($sCabinetWClass, "", "Edit1") ConsoleWrite($sSelected_Path&@CRLF) $aIndexes = StringSplit(ControlListView($sCabinetWClass, "", "SysListView321", "GetSelected", 1), "|") If $aIndexes[0] = 1 And ($aIndexes[1] == "" Or $aIndexes[1] = 0) Then Return SetError(1, 0, 0) For $i = 1 To $aIndexes[0] $sSelected = ControlListView($sCabinetWClass, "", "SysListView321", "GetText", $aIndexes[$i]) $sCurrentFile = StringRegExpReplace($sSelected_Path, "\\+$", "") & "\" & $sSelected If Not FileExists($sCurrentFile) Then ;Search the extension for file... $hSearch = FileFindFirstFile($sCurrentFile & ".*") If $hSearch <> -1 Then $sSelected = FileFindNextFile($hSearch) FileClose($hSearch) EndIf EndIf If StringInStr(FileGetAttrib($sCurrentFile), "D") > 0 Then $sSelected = "*"&$sSelected $Ret = $Ret&$sSelected&Chr(10) Sleep(1) Next Return $Ret EndFunc ; From Clipboard.au3 Func _ClipBoard_GetOwner() Local $aResult = DllCall("user32.dll", "hwnd", "GetClipboardOwner") If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Func _ClipBoard_GetOpenWindow() Local $aResult = DllCall("user32.dll", "hwnd", "GetOpenClipboardWindow") If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Func _ClipBoard_IsFormatAvailable($iFormat) Local $aResult = DllCall("user32.dll", "bool", "IsClipboardFormatAvailable", "uint", $iFormat) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc Func _ClipBoard_GetSequenceNumber() Local $aResult = DllCall("user32.dll", "dword", "GetClipboardSequenceNumber") If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFuncStill one issue: Function _ExplorerGetSelectedItems don't get selected items from Desktop it works only for folders in Explorer, how can i make it work for it?
JohnOne Posted January 16, 2016 Posted January 16, 2016 _ExplorerGetSelectedItemsFromDesktop AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
k4rl3on Posted January 16, 2016 Author Posted January 16, 2016 (edited) Thanks JohnOne i found nothing about the function _ExplorerGetSelectedItemsFromDesktop. but i found a way to retreive selected items both from Desktop and Explorer, i share it: Func _SelectedItem($Window=WinGetHandle("[ACTIVE]", "")) Local $Ret = "" Local $aIndexes, $sSelected, $sSelected_Path Local $hSearch, $sCurrentFile ;Check if a Edit1 control exists on the active window $َAddressBar = ControlGetHandle($Window, "", "Edit1") ;it yes If $َAddressBar <> 0 Then ;Items in Folder openned on Explorer $sSelected_Path = ControlGetText($Window, "", "Edit1") Else ;Items on Desktop $sSelected_Path = @DesktopDir EndIf $Ret = $sSelected_Path&Chr(10) $aIndexes = StringSplit(ControlListView($Window, "FolderView", "SysListView321", "GetSelected", 1), "|") If $aIndexes[0] = 1 And ($aIndexes[1] == "" Or $aIndexes[1] = 0) Then Return SetError(1, 0, 0) For $i = 1 To $aIndexes[0] $sSelected = ControlListView($Window, "FolderView", "SysListView321", "GetText", $aIndexes[$i]) $sCurrentFile = StringRegExpReplace($sSelected_Path, "\\+$", "") & "\" & $sSelected If Not FileExists($sCurrentFile) Then ;Search the extension for file... $hSearch = FileFindFirstFile($sCurrentFile & ".*") If $hSearch <> -1 Then $sSelected = FileFindNextFile($hSearch) FileClose($hSearch) EndIf EndIf If StringInStr(FileGetAttrib($sCurrentFile), "D") > 0 Then $sSelected = "*"&$sSelected $Ret = $Ret&$sSelected&Chr(10) Sleep(1) Next Return $Ret EndFunc And its solved Edited January 16, 2016 by k4rl3on
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