egridley
Members-
Posts
7 -
Joined
-
Last visited
About egridley
- Birthday 06/07/1977
Profile Information
-
Location
Salt Lake City, Utah
egridley's Achievements
Seeker (1/7)
0
Reputation
-
Melba23, Thank you so much! That was driving me crazy. I found that without that parameter, sorting by clicking on the column header wouldn't work at all. I'm not quite sure why. Anyway, your second solution of just adding a set number to it is working nicely. I would never have figured that one out on my own, so thanks again!
-
I am having trouble with duplicate ControlID. I have created a GUI with a ListView inside of it. However, some of the items in the list view are conflicting with the buttons that I have on the GUI. For example, if I click on the File12, it has the same ControlID as the column header, and so it sorts the column. If I click on File15, it has the same ControlID as the Refresh button. I'm sure it's something simple that I'm doing wrong, but any help would be appreciated. This is the most complex GUI I have ever done, so be patient with me! Here is the code I am using: Opt("TrayIconDebug",1) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListviewConstants.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <Array.au3> #include <File.au3> ; Script Start - Add your code below here Main() Func Main() Global $ColumnHeaders[9] = [8,"Title","Type","Video","Audio","Processing","Completed","Percent","Status"] Global $RefreshTime = 0 Local $wWidth = 800 Local $wHeight = 500 Local $iWindowStyle = BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_SYSMENU, $WS_MINIMIZEBOX) Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE) Local $iListViewStyle = BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_REPORT) Local $iExListViewStyle = BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_HEADERDRAGDROP) $MainGUI = GUICreate("File Monitor", $wWidth, $wHeight, 150, 150, $iWindowStyle, $iExWindowStyle) GUISetBkColor(0x94AAFF) ; will change background color Global $NotReadyCheckbox = GUICtrlCreateCheckbox("Not Ready: ",150,20) GUICtrlSetResizing(-1,802) GUICtrlSetState(-1,$GUI_CHECKED) Global $NotReadyLabel = GUICtrlCreateLabel(0,228,22,30) GUICtrlSetResizing(-1,802) GUICtrlSetFont(-1,12) GUICtrlSetColor(-1,0x0000FF) Global $ReadyCheckbox = GUICtrlCreateCheckbox("Ready: ",280,20) GUICtrlSetResizing(-1,802) GUICtrlSetState(-1,$GUI_CHECKED) Global $ReadyLabel = GUICtrlCreateLabel(0,338,22,30) GUICtrlSetResizing(-1,802) GUICtrlSetFont(-1,12) GUICtrlSetColor(-1,0x0000FF) Global $ProcessingCheckbox = GUICtrlCreateCheckbox("Processing: ",400,20) GUICtrlSetResizing(-1,802) GUICtrlSetState(-1,1) Global $ProcessingLabel = GUICtrlCreateLabel(0,479,22,30) GUICtrlSetResizing(-1,802) GUICtrlSetFont(-1,12) GUICtrlSetColor(-1,0x0000FF) Global $DoneCheckbox = GUICtrlCreateCheckbox("Done: ",540,20) GUICtrlSetResizing(-1,802) GUICtrlSetState(-1,$GUI_CHECKED) Global $DoneLabel = GUICtrlCreateLabel(0,593,22,30) GUICtrlSetResizing(-1,802) GUICtrlSetFont(-1,12) GUICtrlSetColor(-1,0x0000FF) Global $hListView = GUICtrlCreateListView("", 10, 60, $wWidth-20, $wHeight-110, $iListViewStyle, $iExWindowStyle) _GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle) GUICtrlSetResizing(-1,102) $OpenFolderButton = GUICtrlCreateButton("Open Folder",10,460,120,30) GUICtrlSetResizing(-1,834) $StartButton = GUICtrlCreateButton("Start",670,460,120,30) GUICtrlSetResizing(-1,836) $RefreshButton = GUICtrlCreateButton("Refresh", 10, 15, 120, 30) GUICtrlSetResizing(-1,802) GUISetState() For $i=1 To $ColumnHeaders[0] _GUICtrlListView_AddColumn($hListView, $ColumnHeaders[$i]) Next Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($hListView)] _Refresh($hListView) _GUICtrlListView_RegisterSortCallBack($hListView) While 1 $msg = GUIGetMsg() Switch $msg Case $RefreshButton MsgBox(0,"ControlID",$msg) _Refresh($hListView) Case $OpenFolderButton MsgBox(0,"ControlID",$msg) $CheckedItems = _GetCheckedItems() If $CheckedItems[0] > 0 Then _OpenFolder($CheckedItems) Else MsgBox(16,"Error","No items selected!") EndIf Case $StartButton MsgBox(0,"ControlID",$msg) $CheckedItems = _GetCheckedItems() If $CheckedItems[0] > 0 Then _Start($CheckedItems) Else MsgBox(16,"Error","No items selected!") EndIf Case $hListView MsgBox(0,"ControlID",$msg) _GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView)) Case $GUI_EVENT_CLOSE MsgBox(0,"ControlID",$msg) Exit EndSwitch WEnd _GUICtrlListView_UnRegisterSortCallBack($hListView) EndFunc ;==>Main Func _Refresh(ByRef $hWnd) Dim $CheckboxState[5][3] = [[4,""], [ _ "1_Not Ready", GUICtrlRead($NotReadyCheckbox), $NotReadyLabel], [ _ "2_Ready", GUICtrlRead($ReadyCheckbox), $ReadyLabel], [ _ "3_Processing", GUICtrlRead($ProcessingCheckbox), $ProcessingLabel], [ _ "4_Done", GUICtrlRead($DoneCheckbox), $DoneLabel]] _GUICtrlListView_BeginUpdate($hWnd) _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hWnd)) Dim $AllFilesToAdd[16] = [ _ "File1|2000k|0|3|0|3|0|1_Not Ready", _ "File2|2000k|0|3|0|3|0|1_Not Ready", _ "File3|2000k|0|3|0|3|0|1_Not Ready", _ "File4|2000k|0|3|0|3|0|1_Not Ready", _ "File5|1000k|1|74|3|74|100|4_Done", _ "File6|1000k|1|68|0|68|100|4_Done", _ "File7|1000k|2|55|0|55|100|4_Done", _ "File8|300k|3|55|1|54|98|3_Processing", _ "File9|2000k|3|3|0|1|33|2_Ready", _ "File10|8000k|1|68|0|68|100|4_Done", _ "File11|8000k|4|55|0|55|100|4_Done", _ "File12|300k|1|74|0|74|100|4_Done", _ "File13|8000k|1|68|0|68|100|4_Done", _ "File14|300k|1|74|0|74|100|4_Done", _ "File15|2000k|3|3|0|0|0|2_Ready", _ "File16|1000k|1|68|0|68|100|4_Done"] If IsArray($AllFilesToAdd) Then For $i In $AllFilesToAdd _AddRow($hWnd,$i) Next EndIf For $i=0 To $ColumnHeaders[0]-1 _GUICtrlListView_SetColumnWidth($hWnd, $i, $LVSCW_AUTOSIZE_USEHEADER) Next _GUICtrlListView_EndUpdate($hWnd) EndFunc ;==> _Refresh Func _AddRow(ByRef $hWnd, $sItem) Local $aItem = StringSplit($sItem, "|") If StringInStr($sItem,"1_Not Ready") > 0 Then $LineColor = 0 ElseIf StringInStr($sItem,"2_Ready") > 0 Then $LineColor = 1 ElseIf StringInStr($sItem,"3_Processing") > 0 Then $LineColor = 2 ElseIf StringInStr($sItem,"4_Done") > 0 Then $LineColor = 3 Else $LineColor = 4 EndIf Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], $LineColor, _GUICtrlListView_GetItemCount($hWnd)) $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hWnd, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hWnd, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hWnd, 0xFF00FF, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hWnd, 0x0000FF, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hWnd, 0x000000, 16, 16)) _GUICtrlListView_SetImageList($hWnd, $hImage, 1) _GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER) For $x = 2 To $aItem[0] _GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1) Next EndFunc ;==> _AddRow Func _GetCheckedItems() $TotalItems = _GUICtrlListView_GetItemCount($hListView) Dim $cItems[1] = [0] For $i=0 To $TotalItems-1 If _GUICtrlListView_GetItemChecked($hListView, $i) Then _ArrayAdd($cItems,$i) $cItems[0]+=1 EndIf Next If $cItems[0] = 0 Then For $i=0 To $TotalItems-1 If _GUICtrlListView_GetItemSelected($hListView, $i) Then _ArrayAdd($cItems,$i) $cItems[0]+=1 EndIf Next EndIf ;~ _ArrayDisplay($cItems) Return $cItems EndFunc ;==> _GetCheckedItems Func _OpenFolder(ByRef $cItems) For $i=1 To $cItems[0] $TempArray = _GUICtrlListView_GetItemTextArray($hListView,$cItems[$i]) Run("explorer.exe " & $TempArray[2]) Next EndFunc ;==> _OpenFolder Func _Start(ByRef $cItems) For $i=1 To $cItems[0] Dim $FilesToRun[1] = [0] Dim $TempFiles[1] = [0] $TempArray = _GUICtrlListView_GetItemTextArray($hListView,$cItems[$i]) If $TempArray[8] = "1_Not Ready" Or $TempArray[8] = "4_Done" Then MsgBox(16,"Error","No files need to be ran!") Else $Path = "C:\" & $TempArray[1] & "\" $TempFiles = _FileListToArray($Path,"*",1) _ArrayConcatenate($FilesToRun,$TempFiles) _ArrayDelete($FilesToRun,0) EndIf If IsArray($TempFiles) Then For $x=1 To $FilesToRun[0] Run("Notepad.exe" & " " & $Path & $FilesToRun[$x]) Sleep(250) Next EndIf Next EndFunc ;==> _Start
-
This function seems to report that files have been added once the copy starts. As a side note, I am copying files from a network location. Would that have anything to do with it?
-
I am trying to create a script that will watch a folder and when files show up it runs some commands against those files. Other computers are copying files into this folder. However, the files are very large and take a while to copy. So I need to make sure the files are finished copying before I start processing them. I have searched but haven't been able to find some sample code that can accomplish this. Does anyone know if this is available somewhere or how to accomplish this?
-
Very nice utility! Two comments/possible feature enhancements: 1) With the autocomplete feature using {TAB}, it automatically highlights everything. For example, I type c:\wind{TAB}... and it completes it with c:\windows, but it is all highlighted, so in order to continue moving down the tree structure, say I want to get to c:\windows\system32\drivers\etc...I have to hit {END} each time I hit {TAB}. Is it possible to leave the cursor at the end of the line so I can just keep typing. I don't know if that will conflict with the feature of hitting {TAB} to move to the next matching phrase or not, just an idea... 2) I bring up a DOS prompt all the time. I can do that with the command cmd...works great. However, the working directory is the directory containing the Run!.exe file. Would it be possible to change the default working directory, perhaps as a setting? If I type in "cmd /k cd\", then it goes to the root of my c drive, which is what I want. Thanks again for such a great utility! Eric
-
You can use all 3 variables, but you don't need to. Instead, you can do something like this: $FullOS = (@OSVersion & " " & @OSServicePack) MsgBox(0, "OS", $FullOS)
-
Haven't tried it out, but was looking through the AutoIt Help file, and I noticed this option: WinSearchChildren - Allows the window search routines to search child windows as well as top-level windows. 0 = Only search top-level windows (default) 1 = Search top-level and child windows Opt("WinSearchChildren", 1) Send("^o") WinWaitActive("Open")