
rakibdepu
Members-
Posts
15 -
Joined
-
Last visited
Everything posted by rakibdepu
-
GUI_Extender - New Version 16 Apr 2022
rakibdepu replied to Melba23's topic in AutoIt Example Scripts
So I am waiting for any update in the distant future. আপনার সদয় দিক নির্দেশনার জন্য আপনাকে অনেক ধন্যবাদ। -
GUI_Extender - New Version 16 Apr 2022
rakibdepu replied to Melba23's topic in AutoIt Example Scripts
Dear Melba, YES 😃 Thanks for the quick reply. I have one more small question, please guide me if possible. I wanted to also add the details group into the UDF section, so that after the gui is open, when the refresh button is clicked, the details group will first extend to the bottom, after five seconds the rest of the gui will open to the right. -
GUI_Extender - New Version 16 Apr 2022
rakibdepu replied to Melba23's topic in AutoIt Example Scripts
Dear Melba, I am creating a GUI using the GUI Extender UDF you created. I don't understand why the first line created by GUICtrlCreateGraphic is changing after using the UDF. Here is before & after screenshot and code. Opt("GUIOnEventMode", 1) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include "GUIExtender.au3" #Region (=== GUI generated by GuiBuilderPlus 1.2.0 ===) Global $g_gui_Main ;------------------------------------------------------ ; Title...........: _guiCreate ; Description.....: Create the main GUI ;------------------------------------------------------ Func _guiCreate() $g_gui_Main = GUICreate("Droid Control", 800, 360, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_onExitMain") GUISetBkColor(0xFFFFFF) _GUIExtender_Init($g_gui_Main, 1, 1, True) _GUIExtender_Section_Create($g_gui_Main, Default, 400) _GUIExtender_Section_Activate($g_gui_Main, 2) Local $g_group_DeviceList = GUICtrlCreateGroup("Device List", 5, 5, 390, 135, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) Local $g_btn_Refresh = GUICtrlCreateButton("Refresh", 320, 20, 70, 53) GUICtrlSetOnEvent(-1, "Refresh") Local $g_btn_Reset = GUICtrlCreateButton("Reset", 320, 83, 70, 52) GUICtrlCreateGroup("", -99, -99, 1, 1) Local $g_group_Wireless = GUICtrlCreateGroup("Wireless", 5, 145, 390, 40, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) Local $g_btn_GetIP = GUICtrlCreateButton("Get IP", 10, 160, 70, 20) Local $g_btn_Connect = GUICtrlCreateButton("Connect", 320, 160, 70, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) Local $g_group_Details = GUICtrlCreateGroup("Details", 5, 190, 390, 140, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) $g_graphic_Line = GUICtrlCreateGraphic(81, 220, 309, 105) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_PENSIZE, 1) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_COLOR, 0x000000) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 0) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 33) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 33) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 51) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 51) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 69) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 117, 69) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 0, 87) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 117, 87) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 192, 69) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 69) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_MOVE, 192, 87) GUICtrlSetGraphic($g_graphic_Line, $GUI_GR_LINE, 309, 87) Local $g_lbl_User_1 = GUICtrlCreateLabel("User", 10, 205, 66, 15) Local $g_lbl_User_2 = GUICtrlCreateLabel(":", 76, 205, 5, 15) Local $g_data_User = GUICtrlCreateLabel("", 81, 205, 309, 15) Local $g_lbl_Account_1 = GUICtrlCreateLabel("Accounts", 10, 223, 73, 30) Local $g_lbl_Account_2 = GUICtrlCreateLabel(":", 76, 223, 2, 30) Local $g_data_Account = GUICtrlCreateLabel("", 81, 223, 309, 30) Local $g_lbl_Model_1 = GUICtrlCreateLabel("Device Model", 10, 256, 66, 15) Local $g_lbl_Model_2 = GUICtrlCreateLabel(":", 76, 256, 5, 15) Local $g_data_Model = GUICtrlCreateLabel("", 81, 256, 309, 15) Local $g_lbl_Serial_1 = GUICtrlCreateLabel("Device Serial", 10, 274, 66, 15) Local $g_lbl_Serial_2 = GUICtrlCreateLabel(":", 76, 274, 5, 15) Local $g_data_Serial_2 = GUICtrlCreateLabel("", 81, 274, 117, 15) Local $g_lbl_Battery_1 = GUICtrlCreateLabel("Battery Status", 10, 292, 66, 15) Local $g_lbl_Battery_2 = GUICtrlCreateLabel(":", 76, 292, 5, 15) Local $g_data_Battery = GUICtrlCreateLabel("", 81, 292, 117, 15) Local $g_lbl_Uptime_1 = GUICtrlCreateLabel("Up Time", 10, 310, 66, 15) Local $g_lbl_Uptime_2 = GUICtrlCreateLabel(":", 76, 310, 5, 15) Local $g_data_Uptime = GUICtrlCreateLabel("", 81, 310, 117, 15) Local $g_lbl_Connection_1 = GUICtrlCreateLabel("Connected by", 202, 274, 66, 15) Local $g_lbl_Connection_2 = GUICtrlCreateLabel(":", 268, 274, 5, 15) Local $g_data_Connection = GUICtrlCreateLabel("", 273, 274, 117, 15) Local $g_lbl_Wifi_1 = GUICtrlCreateLabel("Wi-Fi SSID", 202, 292, 66, 15) Local $g_lbl_Wifi_2 = GUICtrlCreateLabel(":", 268, 292, 5, 15) Local $g_data_Wifi = GUICtrlCreateLabel("", 273, 292, 117, 15) Local $g_lbl_IP_1 = GUICtrlCreateLabel("IP Address", 202, 310, 66, 15) Local $g_lbl_IP_2 = GUICtrlCreateLabel(":", 268, 310, 5, 15) Local $g_data_IP = GUICtrlCreateLabel("", 273, 310, 117, 15) GUICtrlSetColor(-1, 0x006A4E) GUICtrlCreateGroup("", -99, -99, 1, 1) _GUIExtender_Section_Create($g_gui_Main, Default, Default) Local $g_group_Options = GUICtrlCreateGroup("Options", 405, 5, 315, 135, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) Local $g_lbl_Title_1 = GUICtrlCreateLabel("Window Title", 410, 22, 62, 15) Local $g_lbl_Title_2 = GUICtrlCreateLabel(":", 472, 22, 5, 15) Local $g_input_Title = GUICtrlCreateEdit("", 478, 20, 237, 17) Local $g_chk_AlwaysOnTop = GUICtrlCreateCheckbox("Always On Top", 410, 43, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_Borderless = GUICtrlCreateCheckbox("Borderless", 512, 43, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_FullScreen = GUICtrlCreateCheckbox("Full Screen", 613, 43, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_NoScreenSaver = GUICtrlCreateCheckbox("No ScreenSaver", 410, 74, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_PowerOffOnExit = GUICtrlCreateCheckbox("Power Off On Exit", 512, 74, 96, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_ShowTouch = GUICtrlCreateCheckbox("Show Touch", 613, 74, 96, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_StayAwake = GUICtrlCreateCheckbox("Stay Awake", 410, 105, 96, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_TurnOffTheScreen = GUICtrlCreateCheckbox("Turn Off The Screen", 512, 105, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) Local $g_chk_ViewOnlyMode = GUICtrlCreateCheckbox("View Only Mode", 613, 105, 97, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE)) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetColor(-1, 0x006A4E) Local $g_group_Resolution = GUICtrlCreateGroup("Resolution", 725, 5, 70, 65, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) Local $g_rad_ResolutionAuto = GUICtrlCreateRadio("Auto", 730, 20, 60, 20) Local $g_rad_ResolutionMax = GUICtrlCreateRadio("Max", 730, 45, 60, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) Local $g_group_Shortcut = GUICtrlCreateGroup("ShortCut", 725, 75, 70, 65, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) Local $g_rad_ShortcutCtrl = GUICtrlCreateRadio("Ctrl", 730, 90, 60, 20) Local $g_rad_ShortcutAlt = GUICtrlCreateRadio("Alt", 730, 115, 60, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) Local $g_group_Parameter = GUICtrlCreateGroup("Parameter", 405, 145, 390, 130, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) Local $g_lbl_Parameter = GUICtrlCreateLabel("g_ini_ScrcpyCommand", 410, 160, 380, 30) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetColor(-1, 0x006A4E) Local $g_btn_DeviceShutdown = GUICtrlCreateButton("Device%CRLF%Shutdown", 405, 280, 70, 50, $BS_MULTILINE) Local $g_btn_DeviceReboot = GUICtrlCreateButton("Device%CRLF%Reboot", 485, 280, 70, 50, $BS_MULTILINE) Local $g_btn_DisplayPowerOnOff = GUICtrlCreateButton("Display%CRLF%On / Off", 565, 280, 70, 50, $BS_MULTILINE) Local $g_btn_DeviceUnlock = GUICtrlCreateButton("Device%CRLF%Unlock", 645, 280, 70, 50, $BS_MULTILINE) Local $g_btn_ScrcpyOn = GUICtrlCreateButton("Scrcpy%CRLF%On", 725, 280, 70, 50, BitOR($BS_MULTILINE, $GUI_SS_DEFAULT_BUTTON, $BS_FLAT)) _GUIExtender_Section_Create($g_gui_Main, -99) _GUIExtender_Section_Action($g_gui_Main, 2, False) ; hide section 2 EndFunc ;==>_guiCreate #EndRegion (=== GUI generated by GuiBuilderPlus 1.2.0 ===) _main() ;------------------------------------------------------ ; Title...........: _main ; Description.....: run the main program loop ;------------------------------------------------------ Func _main() _guiCreate() GUISetState(@SW_SHOWNORMAL) While 1 Sleep(100) WEnd EndFunc ;==>_main Func Refresh() _GUIExtender_Section_Action($g_gui_Main, 2, 9) EndFunc ;==>Refresh ;------------------------------------------------------ ; Title...........: _onExitMain ; Description.....: Clean up and exit the program ;------------------------------------------------------ Func _onExitMain() GUIDelete() Exit EndFunc ;==>_onExitMain -
Thanks, it works the way it's supposed to, but not the way I wanted it to. The task I will be using it for requires separate single file output. The input file can be in different locations from different folders and multi selections. That's why I choose this GUI. It features drag and drop, multi file selection and folder selection. Suppose, I am searching images with prefix "_P-" in 'Everything Search' window. Then results showed 5 files, 2 in desktop, 1 in downloads and others 2 in D:\New Folder. Then I drag and drop those files in GUI. Each images in its source directory will be converted to pdf and compressed to zip files. Actually I am very poor in speaking English, hence using google translator.
-
As you said, it worked but some problems remained. Func _Main_Processing($sFilePath, $nCurrent = 0, $nTotal = 0) ;_GUI_SwitchMsg() ;_TRAY_SwitchMsg() $sPercent = Round(($nCurrent / $nTotal) * 100, 2) GUICtrlSetData($idProgress_Total, $sPercent) ConsoleWrite("Total Progress: " & $sPercent & "%" & @CRLF) GUICtrlSetData($idProgress_Current, 0) GUICtrlSetData($idLabel_Titles, "Total selected " & $nTotal & " files. (" & $sPercent & "%)") 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), '.*\\', '') 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("Total selected " & $nTotal & " files. (" & $sPercent & "%)" & @CRLF) If _IsFile($sFilePath) Then ConsoleWrite("Processing now: (" & $nCurrent & ") " & $sFileName & @CRLF) GUICtrlSetData($idLabel_Task, "Processing now: (" & $nCurrent & ") " & $sFileName) ; Your file handler is here! Else If IsDir($sFilePath) Then $aList = _FileListToArray($__aDropFiles[$i], '*', 1) For $f = 1 To $aList[0] ConsoleWrite("Processing now: (" & $nCurrent & ") " & $sFileName & @CRLF) GUICtrlSetData($idLabel_Task, "Processing now: (" & $nCurrent & ") " & $sFileName) Next 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 Here is output: +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. Total Progress: 50% [1] Drive: C:\ [2] ParentDir: \Users\*****\Desktop\Images to PDF & ZIP\ [3] CurrentDir: New folder\ [4] FileName NoExt: New Text Document (1) [5] Extension: .txt [6] FileName: New Text Document (1).txt [7] PathParentDir: C:\Users\*****\Desktop\Images to PDF & ZIP\ [8] PathCurrentDir: C:\Users\*****\Desktop\Images to PDF & ZIP\New folder\ [9] PathFileName NoExt: C:\Users\*****\Desktop\Images to PDF & ZIP\New folder\New Text Document (1) Total selected 2 files. (50%) Processing now: (1) New Text Document (1).txt Total Progress: 100% [1] Drive: C:\ [2] ParentDir: \Users\*****\Desktop\Images to PDF & ZIP\New folder\ [3] CurrentDir: New folder\ [4] FileName NoExt: <<<<<<<<<<<<<<<<<<< [5] Extension: <<<<<<<<<<<<<<<<<<< [6] FileName: <<<<<<<<<<<<<<<<<<< [7] PathParentDir: C:\Users\*****\Desktop\Images to PDF & ZIP\New folder\ [8] PathCurrentDir: C:\Users\*****\Desktop\Images to PDF & ZIP\New folder\New folder\ [9] PathFileName NoExt: C:\Users\*****\Desktop\Images to PDF & ZIP\New folder\New folder\ Total selected 2 files. (100%) Processing now: (2) <<<<<<<<<<<<<<<<<<< Processing now: (2) <<<<<<<<<<<<<<<<<<< Processing now: (2) <<<<<<<<<<<<<<<<<<< +>13:51:10 AutoIt3.exe ended.rc:0 Please guide me.
-
Hi Everyone, I need help. I have been searching help files and browsing forums about this for the past 7 days. I am trying to create gui for Images Convert to PDF and ZIP in the basis of Drag and Drop or Select multi Files or Select Folder. I am using Trong's exmple "dragging and dropping folder/files into the GUI". But I'm stuck on the drag and drop folder and select folder part. When I select multi files it processes, but when I select folders, it processes the folder and not the files inside the folder. It's either I don't understand, or it's going over my head. Here is part of my script. 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_SelectFolder _GUI_OnProgress() ; Display an open dialog to select a folder. Local $zFolderIN = FileSelectFolder("Select a folder", "", Default, Default, $hGUI) If Not @error Then _Main_Processing($zFolderIN, 1, 1) EndIf _GUI_OnStandby() 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 $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("Total Progress: " & $sPercent & "%" & @CRLF) GUICtrlSetData($idProgress_Current, 0) GUICtrlSetData($idLabel_Titles, "Total selected " & $nTotal & " files. (" & $sPercent & "%)") 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), '.*\\', '') 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("Total selected " & $nTotal & " files. (" & $sPercent & "%)" & @CRLF) If _IsFile($sFilePath) Then ConsoleWrite("Processing now: (" & $nCurrent & ") " & $sFileName & @CRLF) GUICtrlSetData($idLabel_Task, "Processing now: (" & $nCurrent & ") " & $sFileName) ; Your file handler is here! Else If (FileExists($sPathCurrentDir)) Then ; Is Root Drive ; Your drive handler is here! ConsoleWrite("Processing directory: " & _PathRemove_Backslash($sPathCurrentDir) & @CRLF) GUICtrlSetData($idLabel_Task, "Currently Folder: " & _PathRemove_Backslash($sCurrentDir)) Else ; Your directory handler is here! ConsoleWrite("Processing drive: " & $sDrive & @CRLF) GUICtrlSetData($idLabel_Task, "Currently Drive: " & $sDrive) 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 Full script and others extra files in zip attachment. Images to PDF & ZIP.zip
-
Help needer for StdoutRead to ListView
rakibdepu replied to rakibdepu's topic in AutoIt GUI Help and Support
Finally . . . Func Refresh() IniDelete ( $ini, "Devices" ) Local $iPID = Run(@ComSpec & " /c adb devices", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($iPID) $adbdevices = StdoutRead($iPID) $ADBOutput = StringReplace(StringStripWS(StringTrimLeft($adbdevices, 26), $STR_STRIPTRAILING), @CR, " =") If $ADBOutput = "" Then IniWriteSection($ini, "Devices", $WiFiAddressV & " device =") Else IniWriteSection($ini, "Devices", $ADBOutput & " =") EndIf _GUICtrlListView_DeleteAllItems($DeviceList) DeviceRefresh() EndFunc ;==>Refresh Func DeviceRefresh() $aList = IniReadSection($ini, "Devices") _GUICtrlListView_BeginUpdate($DeviceList) For $i = 1 To $aList[0][0] _GUICtrlListView_AddItem($DeviceList, $i) $aStr = StringSplit($aList[$i][0], " ", 1) _GUICtrlListView_AddSubItem($DeviceList, $i-1, $aStr[1], 1) _GUICtrlListView_AddSubItem($DeviceList, $i-1, $aStr[2], 2) Next _GUICtrlListView_EndUpdate($DeviceList) Param() EndFunc Thank you Zedna Help got from your post ListView save/load checked scenarios - need an idea I will publish when complete. RHD -
Help needer for StdoutRead to ListView
rakibdepu replied to rakibdepu's topic in AutoIt GUI Help and Support
Sorry, my mistake. I didn't really notice. I tried, but StdoutRead result first line "List of devices attached" give me error. Then add StringTrimLeft, but no result. -
Help needer for StdoutRead to ListView
rakibdepu replied to rakibdepu's topic in AutoIt GUI Help and Support
I know StdoutRead result. adb devices result: My question was how to redirect StdoutRead result in ListView. -
Help needer for StdoutRead to ListView
rakibdepu replied to rakibdepu's topic in AutoIt GUI Help and Support
Sorry, I didn't understand something, the help file says, ; Wait until the process has closed using the PID returned by Run. ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead. -
Hi All, I need help. I have been searching help files and browsing forums about this for the past 7 days. It's either I don't understand, or it's going over my head. I am trying to create gui for ADB & Scrcpy. I have pretty much everything under control, but I'm stuck on the StdoutRead to ListView part. See the attached link for what I want with ListView. https://github.com/gxj8885718/ScrcpyGui_New/raw/master/Preview.gif Here is my Scrcpy Helper Gui. #include <ButtonConstants.au3> #include <ComboConstants.au3> #Include <GuiComboBox.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <GUIListView.au3> #include <GuiStatusBar.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Global $ini = "settings.ini" ReadSettings() Func ReadSettings() Global $AlwaysOnTopV = IniRead($ini, "Main", "AlwaysOnTop", 1) Global $FullScreenV = IniRead($ini, "Main", "FullScreen", 0) Global $HideBorderV = IniRead($ini, "Main", "HideBorder", 1) Global $LastDevicesV = IniRead($ini, "Main", "LastDevices", "?") Global $LastWiFiAddressV = IniRead($ini, "Main", "LastWiFiAddress", "?") Global $NoPowerOnV = IniRead($ini, "Main", "NoPowerOn", 0) Global $NoScreenSaverV = IniRead($ini, "Main", "NoScreenSaver", 1) Global $PowerOffOnCloseV = IniRead($ini, "Main", "PowerOffOnClose", 1) Global $ReadOnlyModeV = IniRead($ini, "Main", "ReadOnlyMode", 0) Global $SerialV = IniRead($ini, "Main", "Serial", "?") Global $ShowTouchV = IniRead($ini, "Main", "ShowTouch", 0) Global $StayAwakeV = IniRead($ini, "Main", "StayAwake", 0) Global $TurnOffTheScreenV = IniRead($ini, "Main", "TurnOffTheScreen", 1) Global $Parameter = IniRead($ini, "Main", "Parameter", "") ADBReboot() EndFunc ;==>ReadSettings #Region ### START Koda GUI section ### Form=hgui.kxf $MainGUI = GUICreate("Scrcpy Helper", 405, 561, 184, 129) GUISetOnEvent($GUI_EVENT_CLOSE, "Off") $MainGroup = GUICtrlCreateGroup("", 10, 6, 380, 525) $DeviceGroup = GUICtrlCreateGroup("Device", 20, 18, 360, 118, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) $DeviceList = GUICtrlCreateListView("Device Connected", 30, 36, 260, 90) _GUICtrlListView_SetExtendedListViewStyle($DeviceList, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 255) $ConnectedDevice = GUICtrlCreateListViewItem("", $DeviceList) _GUICtrlListView_JustifyColumn(GUICtrlGetHandle($DeviceList), 0, 2) GUICtrlSetTip(-1, "Double click on serial") $Refresh = GUICtrlCreateButton("Refresh", 300, 36, 70, 90) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetOnEvent($Refresh, "Refresh") $ADBGroup = GUICtrlCreateGroup("ADB", 20, 142, 360, 58, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) $GoWireless = GUICtrlCreateButton("Go Wireless", 220, 160, 70, 30, $BS_MULTILINE) GUICtrlSetTip(-1, "Enter IP address") GUICtrlSetOnEvent($GoWireless, "GoWireless") $ADBReboot = GUICtrlCreateButton("ADB Reboot", 300, 160, 70, 30, $BS_MULTILINE) GUICtrlSetOnEvent($ADBReboot, "ADBReboot") $IPAddress = _GUICtrlIpAddress_Create($MainGUI, 30, 160, 180, 30, -1, 0) _GUICtrlIpAddress_Set($IPAddress,$LastWiFiAddressV) GUICtrlCreateGroup("", -99, -99, 1, 1) ;GUICtrlSetData(-1, Local $IPAddressV = $IPAddress, "") $ScrcpyGroup = GUICtrlCreateGroup("Scrcpy", 20, 206, 360, 49, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) $Resolution = GUICtrlCreateCombo("", 300, 224, 70, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Auto|Max") GUICtrlSetTip(-1, "Resolution") _GUICtrlComboBox_SelectString($Resolution, IniRead($ini, "Main", "Size", "")) $FullScreenC = GUICtrlCreateCheckbox("", 30, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Full Screen") GUICtrlSetState($FullScreenC, $FullScreenV) $PowerOffOnCloseC = GUICtrlCreateCheckbox("", 60, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Power Off On Close") GUICtrlSetState($PowerOffOnCloseC, $PowerOffOnCloseV) $AlwaysOnTopC = GUICtrlCreateCheckbox("", 90, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Always On Top") GUICtrlSetState($AlwaysOnTopC, $AlwaysOnTopV) $ReadOnlyModeC = GUICtrlCreateCheckbox("", 120, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Read Only Mode") GUICtrlSetState($ReadOnlyModeC, $ReadOnlyModeV) $ShowTouchC = GUICtrlCreateCheckbox("", 150, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Show Touch") GUICtrlSetState($ShowTouchC, $ShowTouchV) $NoScreenSaverC = GUICtrlCreateCheckbox("", 180, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "No Screensaver") GUICtrlSetState($NoScreenSaverC, $NoScreenSaverV) $TurnOffTheScreenC = GUICtrlCreateCheckbox("", 210, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Turn off the screen") GUICtrlSetState($TurnOffTheScreenC, $TurnOffTheScreenV) $StayAwakeC = GUICtrlCreateCheckbox("", 240, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Stay Awake") GUICtrlSetState($StayAwakeC, $StayAwakeV) $HideBorderC = GUICtrlCreateCheckbox("", 270, 224, 20, 20, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Hide Border") GUICtrlSetState($HideBorderC, $HideBorderV) GUICtrlCreateGroup("", -99, -99, 1, 1) $TouchGroup = GUICtrlCreateGroup("Touch", 20, 261, 260, 183, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) $ShortCutC = GUICtrlCreateRadio("", 120, 279, 20, 20, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Ctrl") $ShortCutA = GUICtrlCreateRadio("", 160, 279, 20, 20, BitOR($GUI_SS_DEFAULT_RADIO, $BS_PUSHLIKE)) GUICtrlSetTip(-1, "Alt") $VolumeUP = GUICtrlCreateButton("+", 30, 309, 50, 35) GUICtrlSetTip(-1, "Volume UP") $ScreenOn = GUICtrlCreateButton("Screen On", 90, 309, 50, 35, $BS_MULTILINE) $NotificationOn = GUICtrlCreateButton("Notification On", 160, 309, 50, 35, $BS_MULTILINE) $Menu = GUICtrlCreateButton("Menu", 220, 309, 50, 35) GUICtrlSetTip(-1, "Menu") $VolumeDown = GUICtrlCreateButton("-", 30, 354, 50, 35) GUICtrlSetTip(-1, "Volume Down") $ScreenOff = GUICtrlCreateButton("Screen Off", 90, 354, 50, 35, $BS_MULTILINE) $NotificationOff = GUICtrlCreateButton("Notification Off", 160, 354, 50, 35, $BS_MULTILINE) $Power = GUICtrlCreateButton("Power", 220, 354, 50, 35) GUICtrlSetTip(-1, "Power On/Off") $Back = GUICtrlCreateButton("<", 65, 399, 50, 35) GUICtrlSetTip(-1, "Back") $Home = GUICtrlCreateButton("?", 125, 399, 50, 35) GUICtrlSetTip(-1, "Home") $Switch = GUICtrlCreateButton("=", 185, 399, 50, 35) GUICtrlSetTip(-1, "Switch") GUICtrlCreateGroup("", -99, -99, 1, 1) $OnOFFGroup = GUICtrlCreateGroup("", 290, 261, 90, 183) $On = GUICtrlCreateButton("On", 300, 276, 70, 74) $Off = GUICtrlCreateButton("Off", 300, 360, 70, 74) GUICtrlSetOnEvent($Off, "Off") GUICtrlCreateGroup("", -99, -99, 1, 1) $Parameter = GUICtrlCreateEdit("", 20, 446, 360, 75, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN), 0) GUICtrlSetData(-1, "") GUICtrlCreateGroup("", -99, -99, 1, 1) $StatusBar1 = _GUICtrlStatusBar_Create($MainGUI) _GUICtrlStatusBar_SetBkColor($StatusBar1, 0xD1B499) _GUICtrlStatusBar_SetMinHeight($StatusBar1, 20) If IniRead($ini, "Main", "ShortCutCtrl", "0") = 1 Then GUICtrlSetState ($ShortCutC,$GUI_CHECKED) IniWrite($ini, "Main", "ShortCutCtrl", $ShortCutC) ElseIf IniRead($ini, "Main", "ShortCutAlt", "0") = 1 Then GUICtrlSetState ($ShortCutA,$GUI_CHECKED) IniWrite($ini, "Main", "ShortCutCtrl", $ShortCutA) EndIf ;If IniRead($ini, "Main", "ShortCutCtrl", "0") = 1 Then ; GUICtrlSetState ($ShortCutC,$GUI_CHECKED) ; IniWrite($ini, "Main", "ShortCut", $ShortCutC) ;ElseIf IniRead($ini, "Main", "ShortCutAlt", "0") = 1 Then ; GUICtrlSetState ($ShortCutA,$GUI_CHECKED) ; IniWrite($ini, "Main", "ShortCut", $ShortCutA) ;EndIf GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Refresh() While 1 Sleep(100) ; Sleep to reduce CPU usage WEnd ;==>Func INICreate() ;==> IniWrite($ini, "Main", "AlwaysOnTop", "") ;==> IniWrite($ini, "Main", "FullScreen", "") ;==> IniWrite($ini, "Main", "HideBorder", "") ;==> IniWrite($ini, "Main", "LastDevices", "") ;==> IniWrite($ini, "Main", "LastWiFiAddress", "") ;==> IniWrite($ini, "Main", "NoPowerOn", "") ;==> IniWrite($ini, "Main", "NoScreenSaver", "") ;==> IniWrite($ini, "Main", "PowerOffOnClose", "") ;==> IniWrite($ini, "Main", "ReadOnlyMode", "") ;==> IniWrite($ini, "Main", "Serial", "") ;==> IniWrite($ini, "Main", "ShortCut", "") ;==> IniWrite($ini, "Main", "ShowTouch", "") ;==> IniWrite($ini, "Main", "Size", "") ;==> IniWrite($ini, "Main", "StayAwake", "") ;==> IniWrite($ini, "Main", "TurnOffTheScreen", "") ;==>EndFunc ;==>INICreate Func Refresh() ;RunWait(@ComSpec & " /c " & "adb connect 192.168.255.251 & adb connect 192.168.255.252", "", @SW_HIDE) $adbdevices = Run("adb devices", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($adbdevices) $ADBOut = StringTrimLeft(StdoutRead($adbdevices), 26) $ADBOut1 = StringRegExpReplace($ADBOut, "(\s+device+\s)\s*", "|", 0) $ADBOutput = StringTrimRight(StringStripCR($ADBOut1), 1) GUICtrlSetData($SerialV, $ADBOutput) GUICtrlSetData($Parameter, GUICtrlRead($Parameter) & '' & $ADBOutput & @CRLF) ;_GUICtrlListView_DeleteAllItems($DeviceList) ;_GUICtrlListView_AddArray($DeviceList, $ADBOutput) ;IniWriteSection($ini, "Main", "Devices" & "=" & $ADBOutput) IniWrite($ini, "Main", "Devices", $ADBOutput) EndFunc ;==>Refresh Func GoWireless() If _GUICtrlIpAddress_IsBlank($IPAddress) Then MsgBox($MB_SYSTEMMODAL, "", "Enter IP Address.") _GUICtrlIpAddress_SetFocus($IPAddress, 0) Else ;$GoWifi = Run("adb connect " & $IPAddress, "", @SW_HIDE) ;ProcessWaitClose($GoWifi) RunWait(@ComSpec & " /c " & "adb connect " & $IPAddress, "", @SW_HIDE) IniWrite($ini, "Main", "LastWiFiAddress", _GUICtrlIpAddress_Get($IPAddress)) Refresh() EndIf EndFunc ;==>GoWireless Func ADBReboot() RunWait(@ComSpec & " /c " & "adb" & " kill-server", "", @SW_HIDE) RunWait(@ComSpec & " /c " & "adb" & " start-server", "", @SW_HIDE) EndFunc ;==>ADBReboot Func Off() RunWait(@ComSpec & " /c " & "adb" & " kill-server", "", @SW_HIDE) Exit EndFunc ;==>CLOSEButton PS: Sorry for my English.