Jump to content

Search the Community

Showing results for tags 'Drag&Drop'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 4 results

  1. I am glad to share with you a quick script I assembled from my older efforts and with drag&drop interface credits to @Trong, to join two or more PDF files together, for a particular environment where other free/open/commercial solutions are prohibited, btw I use Ghostscript under AGPL (link) for the joining job. You can drag and drop files, or browse them, and have a final PDF sum of all the PDF (pages...) you added. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icone\Full ico\documentsorcopy_V2.ico #AutoIt3Wrapper_UseUpx=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;(C)NSC ; PDFjoint ; nscPDFjoin ; an utility to join multiple pdf using ghostscript, sanitizing the names. ; (c) 2016-23 NSC ; V1.11 march 2020 added fileinstall of the ghostscript ; V1.2 updated chooseFileFolder and updated ghostscript. ; V2.0 complete rewrite with new system to select files ; based on drag and drop script by user Trong in AutoIt Forum: ; https://www.autoitscript.com/forum/topic/209558-gui-example-dragging-and-dropping-folderfiles-into-the-gui/ ; V.2.1 added PDF pages extraction, output name "sanification" removing spacese and dots ; V.2.15 draggable order of files #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPIEx.au3> #include <WinAPIMisc.au3> #include <WinAPIInternals.au3> #include <WinAPISysWin.au3> #include <WinAPIShPath.au3> #include <TrayConstants.au3> #include <Array.au3> #include <File.au3> #include <GuiListView.au3> #include <GUIListViewEx.au3> If Not FileExists("C:\autoit\PDFjoint\gswin64c.exe") Then MsgBox(64, "PDFjoint - Components install", "inserting gswin64c.exe in c:\autoit\PDFjoint", 3) DirCreate("c:\autoit\PDFjoint") FileInstall("c:\NSC_test\resources\PDFJoint\gswin64c.exe", "c:\autoit\PDFjoint\gswin64c.exe", 1) FileInstall("c:\NSC_test\resources\PDFJoint\gsdll64.dll", "c:\autoit\PDFjoint\gsdll64.dll", 1) FileInstall("c:\NSC_test\resources\PDFJoint\gsdll64.lib", "c:\autoit\PDFjoint\gsdll64.lib", 1) EndIf Global $destfolder = "C:\autoit\PDFjoint\PDF_United" If Not FileExists($destfolder) Then DirCreate($destfolder) Global $ver = "V.2.15", $LWid_PDF, $LW_PDF, $aLW_PDF, $aPDF Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Global $trayShow = TrayCreateItem("Show UI") TrayCreateItem("") ; Create a separator line. Global $trayExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. Global Const $sGUI_Show_Title = 1 Global Const $sAppName = "-> PDF Joint ===#'" & " " & $ver & " NSC" Global Const $sLabel_Title = "Drag and drop files and folders HERE !" Global Const $sLabel_Task = "Or click the button to browse." Global Const $sLabel_Status = "READY !" #Region ### START GUI section ### Global $hGUI If $sGUI_Show_Title Then $hGUI = GUICreate($sAppName, 600, 500, 20, 20, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) Else $hGUI = GUICreate($sAppName, 600, 500, 20, 20, BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) EndIf GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idLabel_BG = GUICtrlCreateLabel("", 66, 0, 400, 81, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idIcon = GUICtrlCreateIcon(@WindowsDir & "\explorer.exe", -19, 1, 8, 64, 64, BitOR($GUI_SS_DEFAULT_ICON, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetTip(-1, "Set/UnSet Windows on TOP") Global $idLabel_Titles = GUICtrlCreateLabel($sLabel_Title, 69, 10, 396, 17, $SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idLabel_Task = GUICtrlCreateLabel($sLabel_Task, 69, 34, 396, 17, $SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idLabel_Status = GUICtrlCreateLabel($sLabel_Status, 69, 58, 396, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idButton_BrowseFiles = GUICtrlCreateButton("Browse &files", 472, 8, 99, 33, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idButton_About = GUICtrlCreateButton("(c)", 579, 34, 17, 17, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetTip(-1, "Show About") Global $idProgress_Total = GUICtrlCreateProgress(1, 1, 596, 4) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idProgress_Current = GUICtrlCreateProgress(1, 75, 596, 4) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) LW_PDF_create() GUICtrlCreateGroup("Mode:", 10, 385, 300, 40) Global $radioJoin = GUICtrlCreateRadio("Join PDFs", 15, 400, 100, 20) GUICtrlSetState($radioJoin, $GUI_CHECKED) GUICtrlSetTip(-1, "mode: two or more PDF joined together") Global $radioextr = GUICtrlCreateRadio("Extract PDF", 160, 400, 100, 20) GUICtrlSetTip(-1, "mode: extract a new pdf from page x to page y, same extraction also for multiple PDFs") Global $idButton_Join = GUICtrlCreateButton("Work !", 10, 430, 50, 50, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 10, 800, 80, "consolas") GUICtrlSetTip(-1, "Join PDFs !") Global $idButton_Join_on_Desktop = GUICtrlCreateButton("Work to Desktop", 65, 435, 100, 40, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 7, 200, 50, "consolas") GUICtrlSetTip(-1, "Join PDFs ON DESKTOP") Global $idButton_openfolder = GUICtrlCreateButton("Output Folder", 250, 430, 100, 50, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 10, 800, 80, "consolas") GUICtrlSetTip(-1, "Open folder with all United PDFs") Global $idButton_Clear = GUICtrlCreateButton("Clear List", 490, 430, 100, 50, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 10, 800, 80, "consolas") GUICtrlSetTip(-1, "Clean the current list of PDF files") #EndRegion ### START GUI section ### HotKeySet('^5', '_GUI_SetOnTop') Global $GuiOnTop = 0, $onWorking = 0 WinSetTrans($hGUI, "", 91) _GUI_OnProgress() _GUI_SHOW() _GUI_OnStandby() WinSetTrans($hGUI, "", 230) ; Allow drag and drop when run as! _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_DROPFILES, $MSGFLT_ALLOW) ; $WM_DROPFILES = 0x0233 _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_COPYDATA, $MSGFLT_ALLOW) ; $WM_COPYDATA = 0x004A - $MSGFLT_ALLOW = 1 _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_COPYGLOBALDATA, $MSGFLT_ALLOW) ; $WM_COPYGLOBALDATA = 0x0049 AdlibRegister("_GUI_ResetStatus", 5000) AdlibRegister("_GUI_SwitchMsg", 50) AdlibRegister("_TRAY_SwitchMsg", 50) Global $__aDropFiles, $sPercent, $guiMsg, $trayMsg GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") Global $aCmdLineRaw = StringReplace($CmdLineRaw, '/ErrorStdOut "' & @ScriptFullPath & '"', "") ;ConsoleWrite($aCmdLineRaw & @CRLF) Global $aCmdLine = _WinAPI_CommandLineToArgv($aCmdLineRaw) If IsArray($aCmdLine) And $aCmdLine[0] > 0 Then _GUI_OnProgress() For $i = 1 To $aCmdLine[0] _Main_Processing($aCmdLine[$i], $i, $aCmdLine[0]) Next _GUI_OnStandby() GUICtrlSetData($idLabel_Status, "Everything is done!") Sleep(3000) ; Pause 4s Exit Else While 1 ;_GUI_SwitchMsg() Switch $guiMsg Case $idButton_BrowseFiles _GUI_OnProgress() ; Display an open dialog to select files. Local $zListFileIN, $zFileIN = FileOpenDialog("Select Files", @WorkingDir, "All File (*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT, "", $hGUI) ;1+4 If Not @error Then If StringInStr($zFileIN, "|") Then $zListFileIN = StringSplit($zFileIN, "|") If IsArray($zListFileIN) Then For $i = 2 To $zListFileIN[0] _Main_Processing($zListFileIN[$i], $i - 1, $zListFileIN[0] - 1) Next EndIf Else _Main_Processing($zFileIN, 1, 1) EndIf EndIf _GUI_OnStandby() Case $idButton_Join _GUI_OnProgress() Selector() LW_PDF_reset() $aPDF = "" If Not WinExists("PDF_United") Then Run("explorer.exe " & $destfolder) _GUI_OnStandby() Case $idButton_Join_on_Desktop _GUI_OnProgress() $destfolder = @DesktopDir Selector() LW_PDF_reset() $aPDF = "" $destfolder = "C:\autoit\PDFjoint\PDF_United" _GUI_OnStandby() Case $idButton_Clear _GUI_OnProgress() LW_PDF_reset() $aPDF = "" _GUI_OnStandby() Case $idButton_openfolder _GUI_OnProgress() Run("explorer.exe " & $destfolder) _GUI_OnStandby() Case $GUI_EVENT_DROPPED _GUI_OnProgress() If $__aDropFiles[0] > 0 Then For $i = 1 To $__aDropFiles[0] _Main_Processing($__aDropFiles[$i], $i, $__aDropFiles[0]) Next EndIf _GUI_OnStandby() EndSwitch ;_TRAY_SwitchMsg() WEnd EndIf ; * -----:| Func _Main_Processing($sFilePath, $nCurrent = 0, $nTotal = 0) ;_GUI_SwitchMsg() ;_TRAY_SwitchMsg() $sPercent = Round(($nCurrent / $nTotal) * 100, 2) GUICtrlSetData($idProgress_Total, $sPercent) ;ConsoleWrite("- Percent: " & $sPercent & " %" & @CRLF) GUICtrlSetData($idProgress_Current, 0) GUICtrlSetData($idLabel_Titles, "Processing " & $nCurrent & "/" & $nTotal & " folder/files ! ") Local $sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension, $sFileName, $sPathParentDir, $sPathCurrentDir, $sPathFileNameNoExt Local $aPathSplit = _SplitPath($sFilePath, $sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension, $sFileName, $sPathParentDir, $sPathCurrentDir, $sPathFileNameNoExt) ;Local $sCurrentDirPath= $sDrive&$sCurrentDir;StringRegExpReplace($aPathSplit, '\\[^\\]*$', '') ;Local $sCurrentDirName =StringRegExpReplace(_PathRemoveBackslash($sCurrentDirPath), '.*\\', '') #cs ConsoleWrite(";~ - [1] Drive: " & $sDrive & @CRLF) ConsoleWrite(";~ - [2] ParentDir: " & $sParentDir & @CRLF) ConsoleWrite(";~ - [3] CurrentDir: " & $sCurrentDir & @CRLF) ConsoleWrite(";~ - [4] FileName NoExt: " & $sFileNameNoExt & @CRLF) ConsoleWrite(";~ - [5] Extension: " & $sExtension & @CRLF) ConsoleWrite(";~ - [6] FileName: " & $sFileName & @CRLF) ConsoleWrite(";~ - [7] PathParentDir: " & $sPathParentDir & @CRLF) ConsoleWrite(";~ - [8] PathCurrentDir: " & $sPathCurrentDir & @CRLF) ConsoleWrite(";~ - [9] PathFileName NoExt: " & $sPathFileNameNoExt & @CRLF) ConsoleWrite("- Processing (" & $nCurrent & "/" & $nTotal & "): " & $sFilePath & @CRLF) #ce If _IsFile($sFilePath) Then ; ConsoleWrite("- Processing file: " & $sFileName & @CRLF) GUICtrlSetData($idLabel_Task, "Currently File: " & $sFileName) ; Your file handler is here! If Not IsArray($aPDF) Then Global $aPDF[1][3] $aPDF[0][0] = $aPDF[0][0] + 1 _ArrayAdd($aPDF, $sDrive & $sParentDir & $sCurrentDir & "|" & $sFileNameNoExt & "|" & $sExtension) LW_PDF_reset() LW_PDF_populate() Else If ($sParentDir == "\" And $sCurrentDir == "") Then ; Is Root Drive ; Your drive handler is here! ; ConsoleWrite("- Processing drive: " & $sDrive & @CRLF) GUICtrlSetData($idLabel_Task, "Currently Drive: " & $sDrive) Else ; Your directory handler is here! ; ConsoleWrite("- Processing directory: " & _PathRemove_Backslash($sPathCurrentDir) & @CRLF) GUICtrlSetData($idLabel_Task, "Currently Folder: " & _PathRemove_Backslash($sCurrentDir)) EndIf EndIf ; Code section for GUI testing only GUICtrlSetData($idProgress_Current, 40) Sleep(100) ; test gui GUICtrlSetData($idProgress_Current, 60) Sleep(100) ; test gui GUICtrlSetData($idProgress_Current, 80) Sleep(100) ; test gui GUICtrlSetData($idProgress_Current, 100) GUICtrlSetData($idLabel_Status, "Everything is done!") Sleep(600) ; test gui ; End code test GUI EndFunc ;==>_Main_Processing Func _Exit() If $onWorking Then Local $IdOfButtonPressed = MsgBox($MB_ICONQUESTION + $MB_OKCANCEL + $MB_TOPMOST, "Program is working!", "Are you sure you want to exit the program?" & @CRLF & "Select [OK] to Exit - Select [Cancel] continue script", 10, $hGUI) If ($IdOfButtonPressed = $IDOK) Then Exit Else Exit EndIf EndFunc ;==>_Exit Func _GUI_SwitchMsg() $guiMsg = GUIGetMsg() Switch $guiMsg Case $idButton_About MsgBox(64, $sAppName & " : © NSC 2023 ", $ver & " based on Ghostscript (AGPL version) and on drag and drop script by Ðào Van Trong - Trong.LIVE", Default, $hGUI) ; Case $idButton_Minimizes ; GUISetState(@SW_MINIMIZE, $hGUI) Case $idIcon _GUI_SetOnTop() Case $GUI_EVENT_CLOSE ;, $idButton_Close _Exit() EndSwitch EndFunc ;==>_GUI_SwitchMsg Func _GUI_SetOnTop() _GUI_SHOW() If $GuiOnTop Then $GuiOnTop = 0 GUICtrlSetData($idLabel_Status, "The window is now normal, no longer always showing on top.") Else $GuiOnTop = 1 GUICtrlSetData($idLabel_Status, "Set window to always show on top.") EndIf WinSetOnTop($hGUI, "", $GuiOnTop) EndFunc ;==>_GUI_SetOnTop Func _TRAY_SwitchMsg() $trayMsg = TrayGetMsg() Switch $trayMsg Case $trayShow _GUI_SHOW() Case $trayExit _Exit() EndSwitch EndFunc ;==>_TRAY_SwitchMsg Func _GUI_ResetStatus() ;_GUI_SHOW() If $onWorking Then GUICtrlSetData($idLabel_Status, "Working...") Else GUICtrlSetData($idLabel_Status, $sLabel_Status) EndIf EndFunc ;==>_GUI_ResetStatus Func _GUI_SHOW() _WinAPI_ShowWindow(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_UNLOCK, $hGUI) GUISetState(@SW_ENABLE, $hGUI) GUISetState(@SW_RESTORE, $hGUI) GUISetState(@SW_SHOWNORMAL, $hGUI) WinActivate($hGUI) EndFunc ;==>_GUI_SHOW Func _GUI_OnProgress() $onWorking = 1 GUICtrlSetData($idLabel_Status, "Working...") GUICtrlSetData($idProgress_Total, 0) GUICtrlSetData($idProgress_Current, 0) GUICtrlSetState($idButton_BrowseFiles, $GUI_DISABLE) ; DISABLE GUICtrlSetState($idButton_Join, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_Clear, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_openfolder, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_BG, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idIcon, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_Titles, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_Task, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_Status, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_BrowseFiles, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_About, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idProgress_Total, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idProgress_Current, $GUI_NODROPACCEPTED) ; NODROPACCEPTED EndFunc ;==>_GUI_OnProgress Func _GUI_OnStandby() $onWorking = 0 GUICtrlSetData($idLabel_Titles, $sLabel_Title) GUICtrlSetData($idLabel_Task, $sLabel_Task) GUICtrlSetData($idLabel_Status, $sLabel_Status) GUICtrlSetData($idProgress_Total, 100) GUICtrlSetData($idProgress_Current, 100) GUICtrlSetState($idButton_BrowseFiles, $GUI_ENABLE) ; ENABLE GUICtrlSetState($idButton_Join, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_Clear, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_openfolder, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_BG, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idIcon, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_Titles, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_Task, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_Status, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_BrowseFiles, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_About, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idProgress_Total, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idProgress_Current, $GUI_DROPACCEPTED) ; DROPACCEPTED EndFunc ;==>_GUI_OnStandby Func WM_DROPFILES($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $ilParam Switch $iMsg Case $WM_DROPFILES Local $aReturn = _WinAPI_DragQueryFileEx($iwParam) If IsArray($aReturn) Then $__aDropFiles = $aReturn Else Local $aError[1] = [0] $__aDropFiles = $aError EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DROPFILES ; * -----:| Func _IsFile($sPath) If (Not FileExists($sPath)) Then Return SetError(-1, 0, 0) If StringInStr(FileGetAttrib($sPath), 'D') <> 0 Then Return SetError(0, 0, 0) Else Return SetError(0, 0, 1) EndIf EndFunc ;==>_IsFile #Region listview Func LW_PDF_create() ;crea listview Eventi $LW_PDF = GUICtrlCreateListView("PDF files path|PDF files|ext ", 2, 82, 596, 300, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($LW_PDF, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($LW_PDF, 0, 300) _GUICtrlListView_SetColumnWidth($LW_PDF, 1, 250) _GUICtrlListView_SetColumnWidth($LW_PDF, 2, 40) GUICtrlSetFont($LW_PDF, 9, 800, 0, "verdana") GUICtrlSetResizing($LW_PDF, 102) $LWid_PDF = _GUIListViewEx_Init($LW_PDF, "", 0, Default, False, 33) _GUIListViewEx_MsgRegister() ; If you do not do this they UDF will not work at all <<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState() EndFunc ;==>LW_PDF_create Func LW_PDF_reset() ; cancella e ricrea If IsArray($aLW_PDF) Then If $aLW_PDF[0][0] <> 0 Then _GUIListViewEx_DeleteSpec($LWid_PDF, LW_RangeGenerator($aLW_PDF[0][0])) EndIf EndIf EndFunc ;==>LW_PDF_reset Func LW_PDF_populate() _GUIListViewEx_BlockReDraw($LWid_PDF, True) ; perla pearl anti flickering ( use with same instruction with FALSE to close, look down...) Local $visibileRows = 0 Local $imeno1 For $i = 1 To UBound($aPDF) - 1 $imeno1 = $i - 1 Local $list_fields = _ArrayToString($aPDF, "|", $i, $i) ; possible pearl _GUIListViewEx_InsertSpec($LWid_PDF, $imeno1, $list_fields, False, False) If @error Then MsgBox($MB_OK, @error, "_GUIListViewEx_InsertSpec(" & $i & ") Failed -- Aborting") Exit EndIf $visibileRows += 1 Next _GUICtrlListView_EnsureVisible($LW_PDF, 0) ; _GUIListViewEx_BlockReDraw($LWid_PDF, False) $aLW_PDF = _GUIListViewEx_ReadToArray($LW_PDF, 1) EndFunc ;==>LW_PDF_populate Func LW_RangeGenerator($range) Local $text For $i = 0 To $range - 1 If $i = 0 Then $text = $i Else $text = $text & ";" & $i EndIf Next Return $text EndFunc ;==>LW_RangeGenerator #EndRegion listview Func _SplitPath($sFilePath, ByRef $sDrive, ByRef $sParentDir, ByRef $sCurrentDir, ByRef $sFileNameNoExt, ByRef $sExtension, ByRef $sFileName, ByRef $sPathParentDir, ByRef $sPathCurrentDir, ByRef $sPathFileNameNoExt) $sFilePath = _PathFix($sFilePath) _PathSplit_Ex($sFilePath, $sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension) $sFileName = $sFileNameNoExt & $sExtension $sPathParentDir = $sDrive & $sParentDir $sPathCurrentDir = $sDrive & $sParentDir & $sCurrentDir $sPathFileNameNoExt = $sDrive & $sParentDir & $sCurrentDir & $sFileNameNoExt Local $aSplitPath[10] = [$sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension, $sFileName, $sPathParentDir, $sPathCurrentDir, $sPathFileNameNoExt] Return $aSplitPath EndFunc ;==>_SplitPath ; * -----:| Func _PathSplit_Ex($sFilePath, ByRef $sDrive, ByRef $sParentDir, ByRef $sCurrentDir, ByRef $sFileNameNoExt, ByRef $sExtension) $sFilePath = _PathFix($sFilePath) $sFilePath = StringRegExp($sFilePath & " ", "^((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*?[\/\\]+)?([^\/\\]*[\/\\])?[\/\\]*((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1) $sDrive = (StringStripWS($sFilePath[1], 8) == "") ? "" : $sFilePath[1] $sFilePath[2] = StringRegExpReplace($sFilePath[2], "[\/\\]+\h*", "\" & StringLeft($sFilePath[2], 1)) $sParentDir = (StringStripWS($sFilePath[2], 8) == "") ? "" : $sFilePath[2] $sCurrentDir = (StringStripWS($sFilePath[3], 8) == "") ? "" : $sFilePath[3] $sFileNameNoExt = (StringStripWS($sFilePath[4], 8) == "") ? "" : $sFilePath[4] $sExtension = (StringStripWS($sFilePath[5], 8) == "") ? "" : StringStripWS($sFilePath[5], 3) Return $sFilePath EndFunc ;==>_PathSplit_Ex ; * -----:| Func _PathFix($sFilePath) $sFilePath = StringStripWS($sFilePath, 3) $sFilePath = StringReplace($sFilePath, "/", "\") While StringInStr($sFilePath, " \") $sFilePath = StringReplace($sFilePath, " /", "\") WEnd While StringInStr($sFilePath, "\ ") $sFilePath = StringReplace($sFilePath, "/ ", "\") WEnd If (FileExists($sFilePath) And StringInStr(FileGetAttrib($sFilePath), 'D')) Then $sFilePath = _PathRemove_Backslash($sFilePath) & "\" EndIf Return $sFilePath EndFunc ;==>_PathFix ; * -----:| Func _PathRemove_Backslash($sPath) If StringRight($sPath, 1) == '\' Then $sPath = StringTrimRight($sPath, 1) EndIf Return $sPath EndFunc ;==>_PathRemove_Backslash ; * -----:| Func __WinAPI_GetLastError(Const $_iCallerError = @error, Const $_iCallerExtended = @extended) Local $aCall = DllCall("kernel32.dll", "dword", "GetLastError") Return SetError($_iCallerError, $_iCallerExtended, $aCall[0]) EndFunc ;==>__WinAPI_GetLastError Func __WinAPI_CreateFileEx($sFilePath, $iCreation, $iAccess = 0, $iShare = 0, $iFlagsAndAttributes = 0, $tSecurity = 0, $hTemplate = 0) Local $aCall = DllCall('kernel32.dll', 'handle', 'CreateFileW', 'wstr', $sFilePath, 'dword', $iAccess, 'dword', $iShare, 'struct*', $tSecurity, 'dword', $iCreation, 'dword', $iFlagsAndAttributes, 'handle', $hTemplate) If @error Then Return SetError(@error, @extended, 0) If $aCall[0] = Ptr(-1) Then Return SetError(10, __WinAPI_GetLastError(), 0) Return $aCall[0] EndFunc ;==>__WinAPI_CreateFileEx Func __WinAPI_CloseHandle($hObject) Local $aCall = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hObject) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_CloseHandle ; * -----:| #Region PDF JOIner Func Selector() $aLW_PDF = _GUIListViewEx_ReadToArray($LW_PDF, 1) $aPDF = $aLW_PDF ;V2.15 If GUICtrlRead($radioJoin) = $GUI_CHECKED Then PREJoiner() Else PREExtractor() EndIf EndFunc ;==>Selector Func PREJoiner() Local $uno, $due, $tre, $nomefinale If IsArray($aPDF) Then For $i = 1 To $aPDF[0][0] If $i = 1 Then ; primo giro chiedo il nome del pdf finale $uno = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $nomefinale = InputBox("PDFjoint - Joined PDF name ", "Write down filename without '.pdf' ", "UnitedPDF" & @MSEC) $nomefinale = StringStripCR($nomefinale) $nomefinale = StringStripWS($nomefinale, 8) $nomefinale = StringReplace($nomefinale, ".", "") $nomefinale = $nomefinale & ".pdf" EndIf If $i = 2 Then $due = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $tre = $destfolder & "\PDFjoint_work" & $i & ".pdf" joiner($uno, $due, $tre) EndIf If $i > 2 Then $uno = $tre $due = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $tre = $destfolder & "\PDFjoint_work" & $i & ".pdf" joiner($uno, $due, $tre) EndIf Next FileMove($tre, $destfolder & "\" & $nomefinale) If FileExists($destfolder & "\PDFjoint_work*.pdf") Then FileDelete($destfolder & "\PDFjoint_work*.pdf") EndIf MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDFjoint", "Created new PDF " & @CRLF & @CRLF & $destfolder & "\" & $nomefinale, 2) Else MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDF Joint", "No files selected to Join !") EndIf EndFunc ;==>PREJoiner Func joiner($uno, $due, $tre) Local $cmd1 = "C:\autoit\PDFjoint\gswin64c.exe" Local $cmd2 = '-dBATCH -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -sOutputFile=' & '"' & $tre & '"' & ' ' & '"' & $uno & '"' & ' ' & $due ShellExecuteWait($cmd1, $cmd2, "", "open", @SW_HIDE) EndFunc ;==>joiner Func PREExtractor() Local $prange = InputBox("PDFjoint - PDF Pages to extract ", "Write from page to page (example 2,3)", ",") Local $arange = _ArrayFromString($prange, ",") If IsArray($aPDF) Then Local $nomeoutfile, $nomeinfile For $i = 1 To $aPDF[0][0] $nomeinfile = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $nomeoutfile = $destfolder & "\" & onlynamesanitizer($aPDF[$i][1]) & "_pages_" & $arange[0] & "-" & $arange[1] & $aPDF[$i][2] Extractor($nomeinfile, $nomeoutfile, $arange[0], $arange[1]) Next MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDFjoint", "extracted new PDF(s) in " & @CRLF & @CRLF & $destfolder & "\", 2) Else MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDFJoint", "No files selected to perform extraction !") EndIf EndFunc ;==>PREExtractor Func Extractor($in, $out, $dapag, $apag) Local $cmd1 = "C:\autoit\PDFjoint\gswin64c.exe" Local $cmd2 = '-sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=' & '"' & $dapag & '"' & ' -dLastPage=' & '"' & $apag & '"' & ' -sOutputFile=' & $out & ' ' & $in ShellExecuteWait($cmd1, $cmd2, "", "open", @SW_HIDE) EndFunc ;==>Extractor Func filenamesanitizer($filepathname) ; accept a complete path + filename and sanitize the name plus move in a temp folder Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($filepathname, $sDrive, $sDir, $sFileName, $sExtension) Local $nomefile = StringStripCR($aPathSplit[3]) $nomefile = StringStripWS($nomefile, 8) $nomefile = StringReplace($nomefile, ".", "") $nomefile = "c:\temp\" & $nomefile & $aPathSplit[4] If Not FileExists("c:\temp") Then DirCreate("c:\temp") FileCopy($filepathname, $nomefile, 1) Return $nomefile EndFunc ;==>filenamesanitizer Func onlynamesanitizer($onlyname) $onlyname = StringStripWS($onlyname, 8) $onlyname = StringReplace($onlyname, ".", "") Return $onlyname EndFunc ;==>onlynamesanitizer #EndRegion PDF JOIner V.2.1 implemented PDF pages extraction, in this case if you add multiple files the page extraction will be performed on all the pdf files. V.2.15 you can now drag&drop reorder the file list and have PDF joined in the final order. to do : some checks about the original documents (ex. if you have a pdf with 3 pages and you want to extract page 4...) documentsorcopy_V2.ico
  2. Hi all, I've been looking around the forum and testing different ways of getting a 'drop zone' to work in my script, but I can't seem to get any response from the event listener. Code compiles perfectly. Chaning the control from a label to an input- or edit-field doesn't change its behaviour, still no response when a file is dropped on there... It might just be that I am overlooking a simple detail, so I'm hoping for an extra pair of eyes here or there who can spot why this isn't working as it should. I have another 3500+ lines script where I have basically the same bit of code, and it seems to work in there without problems. So, here it goes: Global $DD_GUI = GUICreate("DicomDrop",200,200,-1,-1,BitOR($WS_SYSMENU,$WS_POPUP),$WS_EX_ACCEPTFILES) GUISetBkColor(0x030303,$DD_GUI) $DD_GUI_DRAGLABEL = GUICtrlCreateLabel("",0,0,32,32,-1, $GUI_WS_EX_PARENTDRAG) $DD_GUI_DRAGIMAGE = GUICtrlCreateIcon(@ScriptFullPath,201,0,0,32,32) $DD_GUI_TITLELABEL = GUICtrlCreateLabel("DicomDrop",50,10,100,20,$SS_CENTER) GUICtrlSetFont($DD_GUI_TITLELABEL,8,$FW_SEMIBOLD,$GUI_FONTNORMAL,"Verdana") GUICtrlSetColor($DD_GUI_TITLELABEL,0xFFFFFF) $DD_GUI_CLOSE = GUICtrlCreateButton("X",174,4,24,24,$BS_FLAT) GUICtrlSetBkColor($DD_GUI_CLOSE,0x030303) GUICtrlSetColor($DD_GUI_CLOSE,0xFFFFFF) Global $DD_GUI_DROPZONE = GUICtrlCreateLabel("",10,42,180,148) GUICtrlSetState(-1,8) GUICtrlSetBkColor($DD_GUI_DROPZONE,0x181818) GUISetState(@SW_SHOW,$DD_GUI) Local $DD_MSG = 0 While 1 $DD_MSG = GUIGetMsg() Select Case $DD_MSG = $GUI_EVENT_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by GUI_EVENT_CLOSE") DD_EXIT() Case $DD_MSG = $GUI_EVENT_DROPPED If @GUI_DropId = $DD_GUI_DROPZONE Then Local $DroppedFile = @GUI_DragFile GUIDelete() ConsoleWrite(@CRLF & "Debug -- Dropped file : " & $DroppedFile) EndIf Case $DD_MSG = $DD_GUI_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by DD_GUI_CLOSEIMAGE") DD_EXIT() EndSelect WEnd Func DD_EXIT() GUIDelete($DD_GUI) Exit EndFunc If anyone has any idea whatsoever, please let me know 🙂 Thanks in advance and kind regards, Jan
  3. Hello, try to build a widget with some tools inside. I want that this GUI is anchored on the right and have as first tool a drag&drop area. I imagine something like this, without trasparencies and other things : replacing clock with a drag&drop area. (exist AI function to enable drag&drop for multiple files ? ) thank you fro any examples, m.
  4. Ciao, I'm trying to filter a draggable Listview using checkbox, but when I filter a listview (idListiview) and I drag and drop a record to another listview, the listview that i filtered returns not filtered and the record that i would drag and drop is not the correct one There are 4 listview, LISTVIEWL1, LISTVIEWL2, LISTVIEWL3 and LISTVIEW. The filter must be work for LISTVIEW (and they work) Where I wrong? This is my script (Is not complete, but I rewrite it for the forum) I know that is not an optimized script... Thanks and sorry for my bad english Marco #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #include <EditConstants.au3> #include "GUIListViewEx.au3" #include <ButtonConstants.au3> #include <StaticConstants.au3> #include "_FileListToArrayEx_Marco.au3" #include <Array.au3> ; ******************************************************************************************************* ; **************************** LETTURA FILE CODICI DALLE CARTELLE *************************************** ; ******************************************************************************************************* ;~ $listaTotaleCodici = _FileListToArrayEx ("images", "*.png", 4);1+4); 1+4+128) ;<== original dim $listaTotaleCodici[11] $listaTotaleCodici[0] = 10 $listaTotaleCodici[1] = "01A_COD1_Tipo1_CHECK2_01_123456789_02_.png" $listaTotaleCodici[2] = "01A_COD2_Tipo1_CHECK3_02_321456789_01_.png" $listaTotaleCodici[3] = "02A_COD1_Tipo1_CHECK2_01_231456798_02_.png" $listaTotaleCodici[4] = "03A_COD1_Tipo2_CHECK1_01_888456789_01_.png" $listaTotaleCodici[5] = "04A_COD2_Tipo2_CHECK1_01_111456789_02_.png" $listaTotaleCodici[6] = "05A_COD1_Tipo1_CHECK2_01_777456789_02_.png" $listaTotaleCodici[7] = "05A_COD1_Tipo3_CHECK1_01_666456789_01_.png" $listaTotaleCodici[8] = "06A_COD1_Tipo1_CHECK2_01_555456789_02_.png" $listaTotaleCodici[9] = "07A_COD1_Tipo3_CHECK2_01_444456789_01_.png" $listaTotaleCodici[10] = "08A_COD1_Tipo1_CHECK2_01_666777789_02_.png" ;~ $listaTotaleCodici[11] = "08A_COD2_Tipo1_CHECK3_01_222456789_02_.png" ; read some png files ; Ex: ; 01A_COD_Tipo1_CHECK2_N_NUMBER_XY.png ; 02A_COD_Tipo1_CHECK2_N_NUMBER_XY.png ; 03A_COD_Tipo3_CHECK1_N_NUMBER_XY.png ; where NUMBER is differentfor any png files ; COD has max 2 values (COD1 or COD2) ; Tipo has max 3 values ; ******************************************************************************************************* ; ********************************* DICHIARAZIONI VARIABILI ********************************************* ; ******************************************************************************************************* dim $aArray[8] dim $filtrare[13] ;array dove vengono memorizzate le parole da filtrare (899, 01, webcom, ecc ecc) Global $fatto = 0 Global $iLV_L1,$iLV_L2,$iLV_L3,$iLV_Codici Dim $idItem[800] Dim $idItemL1[3] Dim $idItemL2[3] Dim $idItemL3[3] Global $idListviewL1, $idListviewL2, $idListviewL3, $idListview $x = 120 $y = 96 $offsetxpreview = 24+100 $offsetypreview = 129+96 $offsetx = $offsetxpreview + $x + 24 $offsety = 12 Global $offsetxradio = 345 Global $aList1, $tmp_String Dim $TotaleCodici[800] Dim $aTempArray[800] Dim $idButton[6] Global $offsetxbutton = 20 Global $offsetybutton = 45 Global $idx=0 Global $b = 0 Global $filtrato = 0 ; ******************************************************************************************************* ; **************************************** PARTENZA GDI ************************************************* ; ******************************************************************************************************* _GDIPlus_Startup() ;~ GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; ******************************************************************************************************* ; *********************************** CREAZIONE GUI PRINCIPALE ****************************************** ; ******************************************************************************************************* $g_hGUI = GUICreate("GUI", 1038, 700, 192, 124) GUISetState() Global $Graphic = _GDIPlus_GraphicsCreateFromHWND($g_hGUI) ; ******************************************************************************************************* ; **************************************** CREAZIONE CHECKBOX ****************************************** ; ******************************************************************************************************* GUIStartGroup() $RadioCodice1 = GUICtrlCreateCheckbox("CHECK1", $offsetxradio+112, 10, 100, 17) GUICtrlSetState($RadioCodice1, $GUI_CHECKED) $RadioCodice2 = GUICtrlCreateCheckbox("CHECK2", $offsetxradio+227, 10, 100, 17) GUICtrlSetState($RadioCodice2, $GUI_CHECKED) $RadioCodice3 = GUICtrlCreateCheckbox("CHECK3", $offsetxradio+341, 10, 100, 17) GUICtrlSetState($RadioCodice3, $GUI_CHECKED) $Label1 = GUICtrlCreateLabel("LABEL:", $offsetxradio + 24 + 35, 10+2, 50, 17) $RadioTipo1 = GUICtrlCreateCheckbox("Tipo1", $offsetxradio+112, 45, 100, 17) GUICtrlSetState($RadioTipo1, $GUI_CHECKED) $RadioTipo2 = GUICtrlCreateCheckbox("Tipo2", $offsetxradio+227, 45, 100, 17) GUICtrlSetState($RadioTipo2, $GUI_CHECKED) $RadioTipo3 = GUICtrlCreateCheckbox("Tipo3", $offsetxradio+341, 45, 100, 17) GUICtrlSetState($RadioTipo3, $GUI_CHECKED) $LabelTipo = GUICtrlCreateLabel("TIPO:", $offsetxradio + 24 + 35, 45+2, 50, 17) Global $offsetxradio = 345 ;~ GUIStartGroup() $Radio1 = GUICtrlCreateCheckbox("A", $offsetxradio+112, 80, 50, 17) ;~ Local $idCheckbox = GUICtrlCreateCheckbox("Standard Checkbox", 10, 10, 185, 25) GUICtrlSetState($Radio1, $GUI_CHECKED) $Radio2 = GUICtrlCreateCheckbox("B", $offsetxradio+169, 80, 50, 17) GUICtrlSetState($Radio2, $GUI_CHECKED) $Radio3 = GUICtrlCreateCheckbox("C", $offsetxradio+227, 80, 50, 17) GUICtrlSetState($Radio3, $GUI_CHECKED) $Radio4 = GUICtrlCreateCheckbox("D", $offsetxradio+284, 80, 50, 17) GUICtrlSetState($Radio4, $GUI_CHECKED) $Radio5 = GUICtrlCreateCheckbox("E", $offsetxradio+341, 80, 50, 17) GUICtrlSetState($Radio5, $GUI_CHECKED) $Radio6 = GUICtrlCreateCheckbox("F", $offsetxradio+399, 80, 50, 17) GUICtrlSetState($Radio6, $GUI_CHECKED) $Radio7 = GUICtrlCreateCheckbox("ALL", $offsetxradio+456, 80, 50, 17) GUICtrlSetState($Radio7, $GUI_CHECKED) $LabelGruppi = GUICtrlCreateLabel("LABEL:", $offsetxradio + 24 + 35, 80+2, 50, 17) $ButtonFiltra = GUICtrlCreateButton("Filter", 870, 12, 150, 84) ;~ GUICtrlSetBkColor(-1,0x00FF00 $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Graphic) $hPen = _GDIPlus_PenCreate(0xff000000, 2);red, 3pixels wide ; ******************************************************************************************************* ; **************************************** CREAZIONE BOTTONI ******************************************* ; ******************************************************************************************************* $cDelete_Button = GUICtrlCreateButton("Delete Line", 870, 115, 150, 30) $idListviewL1 = GUICtrlCreateListView("LISTVIEWL1", 400, 6+96, 450, 96) _GUICtrlListView_SetColumnWidth($idListviewL1, 0, 446) $idListviewL2 = GUICtrlCreateListView("LISTVIEWL2", 400, 6+96+96, 450, 96) _GUICtrlListView_SetColumnWidth($idListviewL2, 0, 446) $idListviewL3 = GUICtrlCreateListView("LISTVIEWL3", 400, 6+96+96+96, 450, 96) _GUICtrlListView_SetColumnWidth($idListviewL3, 0, 446) $idListview = GUICtrlCreateListView("LISTVIEW", 400, 6+96+96+96+96, 450, 573-96-96-96) _GUICtrlListView_SetColumnWidth($idListview, 0, 446) if $fatto = 0 Then ConsoleWrite("fatto = 0" & @CRLF) For $i = 1 To $listaTotaleCodici[0] ; Loop through the array to display the individual values. local $aArray = StringSplit($listaTotaleCodici[$i], '_');, $STR_ENTIRESPLIT) ; Pass the variable to StringSplit and using the delimiter "\n". Local $aList[$listaTotaleCodici[0]+1], $sText If IsArray($aArray) Then $sText = $aArray[1] & " " & $aArray[2] & " " & $aArray[3] & " " & $aArray[4] & " " & $aArray[6] $aList[$i] = $sText GUICtrlCreateListViewItem($sText, $idListview) EndIf Next $iLV_Codici = _GUIListViewEx_Init($idListview, $aList, 0, 0, True, 128 + 256) $TotaleEtichetteCodici = _GUIListViewEx_ReadToArray($idListview) $fatto = 1 EndIf $iLV_L1 = _GUIListViewEx_Init($idListviewL1, $idItemL1, 0, 0, True) ; No external drop, will drag to others - items deleted on drag $iLV_L2 = _GUIListViewEx_Init($idListviewL2, $idItemL2, 0, 0, True) ; No external drop, will drag to others - items deleted on drag $iLV_L3 = _GUIListViewEx_Init($idListviewL3, $idItemL3, 0, 0, True) ; No external drop, will drag to others - items deleted on drag ;~ $iLV_Codici = _GUIListViewEx_Init($idListview, $idItem, 0, 0, True, 128 + 256) ; No external drop, will drag to others - items NOT deleted on drag ;~ GUISetState() _GUIListViewEx_MsgRegister() _GUICtrlListView_SetColumnWidth($idListview, 0, $LVSCW_AUTOSIZE_USEHEADER) _GUICtrlListView_SetColumnWidth($idListview, 1, 1) ; <<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; ******************************************************************************************************* ; ********************************************* MAIN LOOP *********************************************** ; ******************************************************************************************************* Global $idMsg ;~ ; Loop until the user exits. While 1 Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $cDelete_Button $listaTotaleCodiciaAttiva = _GUIListViewEx_GetActive() ConsoleWrite(" active = " & $listaTotaleCodiciaAttiva & @CRLF) if $listaTotaleCodiciaAttiva <> 1 Then _GUIListViewEx_Delete() EndIf Case $ButtonFiltra _filtraCodici() EndSwitch WEnd ; Clean up resources _GDIPlus_GraphicsDispose($Graphic) _GDIPlus_Shutdown() ; ******************************************************************************************************* ; ***************************************** QUIT FUNCTION *********************************************** ; ******************************************************************************************************* Func Quit() _GDIPlus_Shutdown() Exit EndFunc ; ******************************************************************************************************* ; **************************************** ISCHECKED FUNCTION ******************************************* ; ******************************************************************************************************* Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked ; ******************************************************************************************************* ; ************************************ WM_NOTIFY FUNCTION *********************************************** ; ******************************************************************************************************* Func WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) _GUIListViewEx_WM_NOTIFY_Handler($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $index $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) $hWndFrom = DllStructGetData($tStruct, 1) $idFrom = DllStructGetData($tStruct, 2) $code = DllStructGetData($tStruct, 3) $index = DllStructGetData($tStruct, 4) $hWndListView1 = GUICtrlGetHandle($iLV_L1) ;($idListviewL1) $hWndListView2 = GUICtrlGetHandle($iLV_L2) ;($idListviewL2) $hWndListView3 = GUICtrlGetHandle($iLV_L3) ;($idListviewL3) $hWndListViewCodici = GUICtrlGetHandle($iLV_Codici) ;($idListview) Switch $code Case $NM_CLICK ;Left Mouse Button ConsoleWrite("left mouse button") Switch $idFrom Case $iLV_L1 $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) ;~ ConsoleWrite("+Click: " & $index & @CRLF) $text = _GUICtrlListView_GetItemText($iLV_L1, DllStructGetData($tInfo, "Index")) ConsoleWrite("+text: " & $text & @CRLF) EndSwitch Case $NM_DBLCLK ;Double Left Mouse Button Switch $idFrom Case $idListviewL1 $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) ;~ ConsoleWrite("+Click: " & $index & @CRLF) $text = _GUICtrlListView_GetItemText($idListviewL1, DllStructGetData($tInfo, "Index")) ConsoleWrite("+textDBClick: " & $text & @CRLF) Case $idListview $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) ;~ ConsoleWrite("+Click: " & $index & @CRLF) $text = _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index")) ConsoleWrite("+textDBClick: " & $text & @CRLF) EndSwitch Case $GUI_EVENT_CLOSE Quit() EndSwitch EndFunc ;==>WM_NOTIFY ; ******************************************************************************************************* ; ***************************************** FILTRA CODICI *********************************************** ; ******************************************************************************************************* Func _filtraCodici() $aTempArray = $TotaleEtichetteCodici ;$listaTotaleCodici Local $filtrato = 0 If _IsChecked($Radio1) Then $filtrare[1] = 1 Else $filtrare[1] = "A" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = StringLeft($aTempArray[$b][0],3) If StringInStr($tmp_String,$filtrare[1]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($Radio2) Then $filtrare[2] = 1 Else $filtrare[2] = "B" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = StringLeft($aTempArray[$b][0],3) If StringInStr($tmp_String,$filtrare[2]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($Radio3) Then $filtrare[3] = 1 Else $filtrare[3] = "C" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = StringLeft($aTempArray[$b][0],3) If StringInStr($tmp_String,$filtrare[3]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($Radio4) Then $filtrare[4] = 1 Else $filtrare[4] = "D" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = StringLeft($aTempArray[$b][0],3) If StringInStr($tmp_String,$filtrare[4]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($Radio5) Then $filtrare[5] = 1 Else $filtrare[5] = "E" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = StringLeft($aTempArray[$b][0],3) If StringInStr($tmp_String,$filtrare[5]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($Radio6) Then $filtrare[6] = 1 Else $filtrare[6] = "F" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = StringLeft($aTempArray[$b][0],3) If StringInStr($tmp_String,$filtrare[6]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($RadioTipo1) Then $filtrare[7] = 1 Else $filtrare[7] = "Tipo1" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = $aTempArray[$b][0] If StringInStr($tmp_String,$filtrare[7]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($RadioTipo2) Then $filtrare[8] = 1 Else $filtrare[8] = "Tipo2" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 $tmp_String = $aTempArray[$b][0] If StringInStr($tmp_String,$filtrare[8]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($RadioTipo3) Then $filtrare[9] = 1 Else $filtrare[9] = "Tipo3" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 $tmp_String = $aTempArray[$b][0] If StringInStr($tmp_String,$filtrare[9]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($RadioCodice1) Then $filtrare[10] = 1 Else $filtrare[10] = "CHECK1" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = $aTempArray[$b][0] If StringInStr($tmp_String,$filtrare[10]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($RadioCodice2) Then $filtrare[11] = 1 Else $filtrare[11] = "CHECK2" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = $aTempArray[$b][0] ;~ ConsoleWrite(@CRLF & "$tmp_Stringgg= " & $tmp_String & @CRLF) If StringInStr($tmp_String,$filtrare[11]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf If _IsChecked($RadioCodice3) Then $filtrare[12] = 1 Else $filtrare[12] = "CHECK3" $filtrato = 1 For $b=UBound($aTempArray) -1 to 0 step -1 Global $tmp_String = $aTempArray[$b][0] ;~ ConsoleWrite(@CRLF & "$tmp_Stringgg= " & $tmp_String & @CRLF) If StringInStr($tmp_String,$filtrare[12]) Then _ArrayDelete($aTempArray, $b) EndIf Next EndIf _ArrayDisplay($aTempArray,"fine ciclo") _GUICtrlListView_DeleteAllItems($idListview) ;~ $iLV_Codici = _GUIListViewEx_Close($idListview) ConsoleWrite("_GUICtrlListView_DeleteAllItems" & @CRLF) IF $filtrato = 0 Then For $a=0 to UBound($TotaleEtichetteCodici)-1 ; Loop through the array to display the individual values. Local $aList1[UBound($TotaleEtichetteCodici)], $sText If IsArray($TotaleEtichetteCodici) Then $sText = $TotaleEtichetteCodici[$a][0] ConsoleWrite("sText non filtrato = " & $sText & @CRLF) $aList1[$a] = $sText GUICtrlCreateListViewItem($sText, $idListview) EndIf Next EndIf if $filtrato = 1 Then For $a=0 to UBound($aTempArray)-1 ; Loop through the array to display the individual values. Global $aList1[UBound($aTempArray)], $sText If IsArray($aTempArray) Then $sText = $aTempArray[$a][0] ConsoleWrite("sText = " & $sText & @CRLF) $aList1[$a] = $sText GUICtrlCreateListViewItem($sText, $idListview) EndIf Next EndIf $iLV_Codici = _GUIListViewEx_Close($idListview) $iLV_Codici = _GUIListViewEx_Init($idListview, $aList1, 0, 0, True, 128 + 256); 0, 0, True, 1 + 2 + 8, "0;2") EndFunc ;==>_filtraCodici
×
×
  • Create New...