v1.0.36 released: Gui context menus and ListView
Fixed double syntax error for a bad function call in a block.
Improved "Process, Exist" to fetch the script's own PID when no other parameters are given. [thanks Junyx]
CHANGES FOR GUI
Added GuiContextMenu, which facilitates the display of custom Gui context menus.
Added Gui +Delimiter`n as a means to change the separator between fields.
Added A_EventInfo for use by OnClipboardChange, ListBox, GuiSize, and GuiDropFiles.
Added A_GuiEvent as a synonym for A_GuiControlEvent.
Added +/-Redraw as a means to accelerate the filling of a ListBox.
Adding new control type ListView, which is a tabular view of rows and columns. It features built-in sorting and support for displaying icons.
http://www.autohotkey.com/download/
If you've been using the alpha-test version of the ListView, "Gui, Add, Row" has been replaced by LV_Add(). Also, GetNextItem() has been renamed to GetNext(). There have also been many enhancements.
Thanks Chris.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
Thanks for this new feature.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
(RichEdit and InternetExplorerContainerWindow too please )
Need to fiddle around with them ListView rightaway...
Rajat, I know you are having some bad days right now, but can you please add preliminary support for ListView (so that it doesn't error out) to SmartGUI?
I'm speechless...
All I really need now is some more info/teachmyself on dll calling to avoid weird errors with DLLCall
Those would be good additions. In case you want to use them right away, I don't think there's anything that would prevent you from using DllCall("CreateWindow"...) to create any control of your choice inside a parent GUI window. After creation, you could send the control some messages to set it up and get things back out of it.(RichEdit and InternetExplorerContainerWindow too please )
listview looks great, though the example script looks complicated and i'm kinda afraid to get my feet wet!
by the way it doesn't show the actual icons of files, so i did a li'l research and found that shell32.dll\ExtractAssociatedIcon gives the correct icon (returns the handle of an indexed icon found in a file or an icon found in an associated executable file). but to use it i need App.hInstance which i don't know much about. i'm sure there'll be ppl asking for this soon, so shouldn't this be built-in?
daonlyfreez,
i'll try to put in basic support soon. but by that time u can create a listbox in sgui and rename it to listview in script.
CleanNews.in : Bite sized latest news headlines from India with zero bloat
I wanted to have both a simple and a complex example. If you wanted to reduce it to the bare minimum, the following is a fully functional ListView script that displays some files in report view:the example script looks complicated and i'm kinda afraid to get my feet wet!
Gui, Add, ListView, r20 w700, Name|Size (KB) ; Gather a list of file names from a folder and put them into the ListView: Loop, %A_MyDocuments%\*.* LV_Add("", A_LoopFileName, A_LoopFileSizeKB) Gui Show
I was wondering how to do that and now I know. Thanks.i did a li'l research and found that shell32.dll\ExtractAssociatedIcon gives the correct icon
I think the following script segment can get the associated icon because ExtractAssociatedIcon() does not seem to strictly require a valid hInstance:
; Gather a list of file names from a folder and append them to the ListView: Loop %Folder%\*.* { FileName := A_LoopFileFullPath ; Must save to writable variable for use below. StringReplace, FileName, FileName, \\, \ ; Due to root drive having backslash from FileSelectFolder. hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, str, FileName, UShortP, iIndex) if hIcon { DllCall("ImageList_ReplaceIcon", UInt, ImageListID1, int, -1, UInt, hIcon) IconNumber := DllCall("ImageList_ReplaceIcon", UInt, ImageListID2, int, -1, UInt, hIcon) + 1 ; +1 to convert to one-based. DllCall("DestroyIcon", Uint, hIcon) ; Free the memory. } else IconNumber = 1 ; Create the new row and assign it an icon number: LV_Add("Icon" . IconNumber, A_LoopFileName, A_LoopFileDir, A_LoopFileSizeKB) }The above is not the most efficient way to do it because it extracts the icon separately for every single file. For non-EXE files, memory and loading time could be reduced by maintaining an array of file extensions along with their associated index in the image list.
If there turns out to be a need for it, perhaps it should become a built-in variable A_hInstance. But perhaps someone knows if there's a function the script can call to discover its own hInstance value.shouldn't [App.hInstance] be built-in?
Thanks.
Edit: Changed one comment to "Due to root drive having backslash from FileSelectFolder."
thanx!
CleanNews.in : Bite sized latest news headlines from India with zero bloat
@Chris: I really like the potential power of the DLLCall command, but it's very hard to understand (for me) and also very hard to get the right 'commands' to use, and frankly the whole syntax 'scares me'....
In case you want to use them right away, I don't think there's anything that would prevent you from using DllCall("CreateWindow"...) to create any control of your choice inside a parent GUI window. After creation, you could send the control some messages to set it up and get things back out of it.
You make this sound so simple, but it's mumbo jumbo to me for now...
I hate the VB-style syntax, don't understand it, and when I look around the net to find useful DLLCalls, I always end up with finding exactly that, VB code...
I think we need to try to collect 'useful DLLCalls' somewhere, maybe in the 'Utilities & Resources' section? If everybody can post his/hers experiences with the different Hotkeys, PostMessages and DLLCalls in programs, that would be a great timesaver...
Another fantastic improvement! I fully agree with all the positive comments written here. Fantastic.
Thanks!
Neyon
I've improved the script at the bottom of the ListView page to contain your idea. Now it gets the correct icon for the file type, just like Explorer. It also caches the icons by keeping them in an array, which makes file-loading much quicker.i did a li'l research and found that shell32.dll\ExtractAssociatedIcon gives the correct icon
It was only suggested in case you were needed RichEdit or other controls right away. You're right that it would definitely take some time studying the documentation at MSDN. But I don't think you would have to have any programming experience to understand most of it.You make this sound so simple, but it's mumbo jumbo to me for now...
I agree. Either there or in Scripts/Functions, whichever seems more appropriate (case by case). Hopefully the collection will grow over time.I think we need to try to collect 'useful DLLCalls' somewhere, maybe in the 'Utilities & Resources' section?
Fixed FileCopy and FileMove to avoid deleting a file that is copied/moved onto itself. In such a case, FileCopy still counts it as a failure but FileMove now counts it as a success. [thanks mario_a]
Fixed continuation sections so that accents and commas after the word Join don't change the behavior of accents and commas in the section. [thanks Nemroth]
Added "WinSet Top", which attempts to bring a window to the top of the stack without activating it. [thanks catweazle]
I've improved the script at the bottom of the ListView page to contain your idea. Now it gets the correct icon for the file type, just like Explorer. It also caches the icons by keeping them in an array, which makes file-loading much quicker.i did a li'l research and found that shell32.dll\ExtractAssociatedIcon gives the correct icon
The last example had a small portion, where you specified different shell32.dll for different OS. I would need that part now. But I have already updated. damn. Could you please post that snippet. Thanks.