ttleser Posted January 13, 2007 Share Posted January 13, 2007 I want to create a simple program that will scan multiple computers in a certain directory for any files with certain key words in it. I want to use have a Listview that'll show all 20 computers across the top of the table and all the files it finds listed below the appropriate computer. For example, I've got 20 computers I need to scan for files. In the Gui it'll have a box that I'll fill in the directory path of where I want it to scan (but we'll use c:\test for now) and of course a button that'll say "scan". I want to click on scan and have the program scan computer1 for the files and list them underneath computer1 in the table, then do onto computer2 and so forth. I'm pretty sure I can get the Do loop setup properly to scan each computer, but I'm unsure how to setup the listview properly. Link to comment Share on other sites More sharing options...
ttleser Posted January 14, 2007 Author Share Posted January 14, 2007 OK, here's my script so far. Still need a little help though. expandcollapse popupGUICreate("File Search", 850, 400) GUISetState() $listView = GUICtrlCreateListView("PC1|PC2|PC3|PC4|PC5|PC6|PC7|PC8|PC9|PC10|PC11|PC12|PC13|PC14|PC15|PC16|PC17|PC18|PC19|PC20", 0, 80, 850, 150) $button_scan = GUICtrlCreateButton('&Scan', 5, 290, 75, 23) $button_exit = GUICtrlCreateButton('E&xit', 90, 290, 75, 23) GUICtrlCreateLabel ("File Name", 10, 10) $name = GUICtrlCreateInput ("", 70, 10, 300, 20) GUICtrlCreateLabel ("Directory", 10, 40) $dir = GUICtrlCreateInput ("", 70, 40, 300, 20) While 1 $msg = GUIGetMsg() Select Case $msg = $button_exit Exit Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button_scan $directory = GUICtrlRead($dir) $filename = GUICtrlRead($name) $IP = 1 $sep = "" _GUICtrlListViewDeleteAllItems($listView) Do DriveMapAdd("y:", "\\192.168.100."&$IP&"\c$") FileChangeDir("y:\"&$directory) $search = FileFindFirstFile($filename&".*") While 1 $file = FileFindNextFile($search) If @error Then ExitLoop GUICtrlCreateListViewItem($sep&$file, $listView) WEnd $sep = "|"&$sep $IP = $IP + 1 Until $IP = 4 EndSelect WEnd The script works good, it'll scan each computer (just got it set to scan 3 computers for now) and it'll display the results in the table the way I want it with one small problem. It does scan computer 1 and display the info in the 1st column correctly, when it scans the 2nd computer it'll display the information on the next column but it starts it after the 1st column got done, same with the 3rd computer.. So, for example. Say there are 2 files on each computer that match the criteria I set. That's 6 total files that'll display. Here's how it displays after I click "scan" (please ignore the dashes as I needed to use them in these forums to show the proper formatting for you guys.) PC1-------PC2-------PC3 file1 file2 ------------file1 ------------file2 -----------------------file1 -----------------------file2 Link to comment Share on other sites More sharing options...
Zedna Posted January 14, 2007 Share Posted January 14, 2007 I think for you will be better use this ListView structure:Computer File name----------- -----------PC1 file1PC1 file2PC2 file1PC2 file2PC3 file1PC3 file3Because on each computer can be different count of files.Or maybe use treeview instead of listview.In first level will be nodes for computers each with child nodes of files. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
ttleser Posted January 20, 2007 Author Share Posted January 20, 2007 Sorry, that won't work for me. There'll probably be like 20+ files per computer at 20 computers equals alot of files. Anyone else know on how I can make the table appear correctly?? Link to comment Share on other sites More sharing options...
Zedna Posted January 20, 2007 Share Posted January 20, 2007 Sorry, that won't work for me. There'll probably be like 20+ files per computer at 20 computers equals alot of files. Anyone else know on how I can make the table appear correctly??Make array of file names for each computer.Then in FOR loop compose strings for every listview line from all that arrays.You must check different bounds of each arrarys and add "" when neccessary. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
ttleser Posted January 20, 2007 Author Share Posted January 20, 2007 (edited) Ok, how about this. I could just have 20 listviews, 1 for each of the computers. I would have them side by side, like: $listView1 = GUICtrlCreateListView("PC1", 0, 80, 20, 150) $listView2 = GUICtrlCreateListView("PC2", 20, 80, 20, 150) $listView3 = GUICtrlCreateListView("PC3", 40, 80, 20, 150) $listView4 = GUICtrlCreateListView("PC4", 60, 80, 20, 150) $listView5 = GUICtrlCreateListView("PC5", 80, 80, 20, 150) etc But, for my loop, how do I make it so that the line: GUICtrlCreateListViewItem($sep&$file, $listView1) has the variable $listview incremented by 1 each time the "do loop" happens again. Also, how can I get _GUICtrlListViewGetItemText() to report which itemview and line that was selected. Say I choose file#2 on listview#4, is there a way to report which listview was selected as well as what was selected? Thoughts? Edited January 20, 2007 by ttleser Link to comment Share on other sites More sharing options...
ttleser Posted January 21, 2007 Author Share Posted January 21, 2007 Bump? Link to comment Share on other sites More sharing options...
ttleser Posted January 27, 2007 Author Share Posted January 27, 2007 Bump again?? Link to comment Share on other sites More sharing options...
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