b0ris Posted March 31, 2009 Share Posted March 31, 2009 Hello there, I just can't figure out how to list all the running excel files. I tried the following, but I just can't get it to work. #include <Array.au3> Dim $window=WinList() dim $wTitle[1][1] dim $title[1] $title = _ArrayFindAll($window, "Microsoft Excel -",0,0,0,1) _ArrayDisplay($title) For $x = 0 To UBound($title)-1 _ArrayAdd($wTitle, $title[$x]) ;~ _ArrayDelete($wTitle, 0) Next _ArrayDisplay($wTitle) Is there anyone who can help me with this? Thanks in advance! b0ris Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 31, 2009 Moderators Share Posted March 31, 2009 b0ris,According to that ever-useful Help file, WinList() returns a 2D array with titles in the [0] dimension and handles in the [1] dimension. So you need to specify 2 dimensions when you try and read the array. You also need to read the correct array - at the moment you are trying to _ArrayAdd from $title which lists the indices returned from the search for "Microsoft Excel" and not $window which lists the titles of the windows. Try this:#include <Array.au3> Dim $window=WinList() dim $wTitle[1][1] dim $title[1] $title = _ArrayFindAll($window, "Microsoft Excel -",0,0,0,1) _ArrayDisplay($title) For $x = 0 To UBound($title)-1 _ArrayAdd($wTitle, $window[$title[$x]][0]) Next _ArrayDisplay($wTitle)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
b0ris Posted March 31, 2009 Author Share Posted March 31, 2009 b0ris, According to that ever-useful Help file, WinList() returns a 2D array with titles in the [0] dimension and handles in the [1] dimension. So you need to specify 2 dimensions when you try and read the array. You also need to read the correct array - at the moment you are trying to _ArrayAdd from $title which lists the indices returned from the search for "Microsoft Excel" and not $window which lists the titles of the windows. Try this:#include <Array.au3> Dim $window=WinList() dim $wTitle[1][1] dim $title[1] $title = _ArrayFindAll($window, "Microsoft Excel -",0,0,0,1) _ArrayDisplay($title) For $x = 0 To UBound($title)-1 _ArrayAdd($wTitle, $window[$title[$x]][0]) Next _ArrayDisplay($wTitle) M23 Unfortunately the code you've pasted above does not work. I do know that WinList() returns a 2D array, which as you can see, I can search, but can't just get the values out of the desired array element. I'm still trying different things, but no luck yet, so in case you'll figure out something, I'll be more than happy to try it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 31, 2009 Moderators Share Posted March 31, 2009 (edited) b0ris,My fault. I had several versions open and copied the wrong one.What I posted is failing because $wTitle is created with 2 dimensions and the code is only asking for one. The solution depends on what you want to do. If you want a single dimension array with just the names:#include <Array.au3> Dim $window=WinList() dim $wTitle[1] dim $title[1] $title = _ArrayFindAll($window, "Microsoft Excel -",0,0,0,1) _ArrayDisplay($title) For $x = 0 To UBound($title)-1 _ArrayAdd($wTitle, $window[$title[$x]][0]) Next _ArrayDisplay($wTitle)If you want a 2D array with names and handles (which as you had created $wTitle as a 2D array I think is more likely:#include <Array.au3> Dim $window=WinList() dim $title[1] $title = _ArrayFindAll($window, "Microsoft Excel -",0,0,0,1) _ArrayDisplay($title) dim $wTitle[UBound($title)][2] For $x = 0 To UBound($title)-1 $wTitle[$x][0] = $window[$title[$x]][0] $wTitle[$x][1] = $window[$title[$x]][1] Next _ArrayDisplay($wTitle)Apologies again - it is age you know.... ;-)M23Edit: Speeling Edited March 31, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
b0ris Posted April 1, 2009 Author Share Posted April 1, 2009 b0ris, My fault. I had several versions open and copied the wrong one. What I posted is failing because $wTitle is created with 2 dimensions and the code is only asking for one. The solution depends on what you want to do. If you want a single dimension array with just the names:#include <Array.au3> Dim $window=WinList() dim $wTitle[1] dim $title[1] $title = _ArrayFindAll($window, "Microsoft Excel -",0,0,0,1) _ArrayDisplay($title) For $x = 0 To UBound($title)-1 _ArrayAdd($wTitle, $window[$title[$x]][0]) Next _ArrayDisplay($wTitle) If you want a 2D array with names and handles (which as you had created $wTitle as a 2D array I think is more likely:#include <Array.au3> Dim $window=WinList() dim $title[1] $title = _ArrayFindAll($window, "Microsoft Excel -",0,0,0,1) _ArrayDisplay($title) dim $wTitle[UBound($title)][2] For $x = 0 To UBound($title)-1 $wTitle[$x][0] = $window[$title[$x]][0] $wTitle[$x][1] = $window[$title[$x]][1] Next _ArrayDisplay($wTitle) Apologies again - it is age you know.... ;-) M23 Edit: Speeling Ok, thank you very much! By the way, do you know how to configure scythe to use the UDF's added later to the include folder, to use them as the built-in ones. I hope you know what I mean, unfortunately I can't describe this better... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 1, 2009 Moderators Share Posted April 1, 2009 b0ris,I assume by "scythe" you mean "SciTE" - the editor? If so, this is how you get new include files to offer CallTips and AutoCompleteCalltips first. Use the 'Tools - UserCallTip' menu item to get au3.usercall.tips.api onscreen. Then add a line to the page for each function you want to add:_Function($param1, $param2, $param3) Explanation of function (Requires: #Include <UDF.au3>)Of course you need to change the Function, $param and UDF words to the correct values for the UDF function you want to include.Now the AutoComplete. If you use the newest version of SciTE, then create the file: "C:\Program Files\AutoIt3\SciTE\Properties\au3.userudfs.properties" (you may have adjust the path if you have installed SciTE elsewhere than the recommended option). Then file should read as follows:au3.keywords.user.udfs=_function1 _function2 _function3 _function4 \ _function5Once you have created the file, you can access it via the 'Options - Open au3.UserUdfs.properties' menu item.If you do not have the latest version of SciTE (and why not?) then use 'Options - Open au3.keywords.properties' to get the au3.keywords.properties on screen. Scroll down to the au3.keywords.keywords section (it will be about line 547) and add the function names to the section ABOVE. Put the function names in lowercase and do not forget to add the "\" if you have to start a new line - just like the example above.Then save all files, close and restart SciTE. You will have AutoComplete when you start typing the UDF function name in a script and syntax CallTips as you enter the parameters!I take it you know you can also set specific folders that Autoit will search for include files as well as the standard "C:\Program Files\AutoIt3\Include"? From the Help file:"There is a special registry value that can be created at "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" called "Include". It should be a REG_SZ (string) value. The contents of this value are a semi-colon delimited list of directories that should be searched for files when resolving #include's in addition to the standard locations."So now you will be able to get all your new includes into a folder away from "C:Program Files" - which will make Vista very happy if you use it!M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
b0ris Posted April 1, 2009 Author Share Posted April 1, 2009 b0ris, I assume by "scythe" you mean "SciTE" - the editor? If so, this is how you get new include files to offer CallTips and AutoComplete Calltips first. Use the 'Tools - UserCallTip' menu item to get au3.usercall.tips.api onscreen. Then add a line to the page for each function you want to add: _Function($param1, $param2, $param3) Explanation of function (Requires: #Include <UDF.au3>) Of course you need to change the Function, $param and UDF words to the correct values for the UDF function you want to include. Now the AutoComplete. If you use the newest version of SciTE, then create the file: "C:\Program Files\AutoIt3\SciTE\Properties\au3.userudfs.properties" (you may have adjust the path if you have installed SciTE elsewhere than the recommended option). Then file should read as follows:au3.keywords.user.udfs=_function1 _function2 _function3 _function4 \ _function5 Once you have created the file, you can access it via the 'Options - Open au3.UserUdfs.properties' menu item. If you do not have the latest version of SciTE (and why not?) then use 'Options - Open au3.keywords.properties' to get the au3.keywords.properties on screen. Scroll down to the au3.keywords.keywords section (it will be about line 547) and add the function names to the section ABOVE. Put the function names in lowercase and do not forget to add the "\" if you have to start a new line - just like the example above. Then save all files, close and restart SciTE. You will have AutoComplete when you start typing the UDF function name in a script and syntax CallTips as you enter the parameters! I take it you know you can also set specific folders that Autoit will search for include files as well as the standard "C:\Program Files\AutoIt3\Include"? From the Help file: "There is a special registry value that can be created at "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" called "Include". It should be a REG_SZ (string) value. The contents of this value are a semi-colon delimited list of directories that should be searched for files when resolving #include's in addition to the standard locations." So now you will be able to get all your new includes into a folder away from "C:Program Files" - which will make Vista very happy if you use it! M23 Thank you, that was really helpful, and it works perfectly! Tons of thanks mate! 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