 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Mon Jun 27, 2005 8:26 pm Post subject: v1.0.36 released: Gui context menus and ListView |
|
|
Here are the changes for v1.0.36:
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. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Jun 27, 2005 8:46 pm Post subject: |
|
|
Yieeepppiiieeee,
Thanks Chris. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Jun 27, 2005 10:10 pm Post subject: |
|
|
In the beginning I was a little bit confused, due to the functions. It is a different style to write code compared to the rest of GUI/GUIControl commands. Since text has to be in "" and variables do not need %%, but I think I can get used to it. I see the benefit in the loops. It will result in very short code compared to normal commands.
Thanks for this new feature. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Rabiator
Joined: 17 Apr 2005 Posts: 260 Location: Sauerland
|
Posted: Mon Jun 27, 2005 10:18 pm Post subject: Re: v1.0.36 released: Gui context menus and ListView |
|
|
Marvelously figured out.
Thanks! |
|
| Back to top |
|
 |
daonlyfreez
Joined: 16 Mar 2005 Posts: 738 Location: Berlin
|
Posted: Mon Jun 27, 2005 11:15 pm Post subject: |
|
|
Excellent!
(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  _________________
Get your own Ron Paul 2008 userbar! |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Tue Jun 28, 2005 12:37 am Post subject: |
|
|
| daonlyfreez wrote: | (RichEdit and InternetExplorerContainerWindow too please ) | 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. |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1715
|
Posted: Tue Jun 28, 2005 8:45 am Post subject: |
|
|
congrats on another big achievment Chris!
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. _________________
 |
|
| Back to top |
|
 |
dijiyd
Joined: 01 Apr 2004 Posts: 90 Location: Philippines
|
Posted: Tue Jun 28, 2005 8:54 am Post subject: |
|
|
| Alright! Even AutoIt's ListView doesn't have sorting. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Tue Jun 28, 2005 11:09 am Post subject: |
|
|
| Rajat wrote: | | the example script looks complicated and i'm kinda afraid to get my feet wet! | 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:
| Code: | 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 |
| Quote: | | i did a li'l research and found that shell32.dll\ExtractAssociatedIcon gives the correct icon | I was wondering how to do that and now I know. Thanks.
I think the following script segment can get the associated icon because ExtractAssociatedIcon() does not seem to strictly require a valid hInstance:
| Code: | ; 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.
| Quote: | | shouldn't [App.hInstance] be built-in? | 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.
Thanks.
Edit: Changed one comment to "Due to root drive having backslash from FileSelectFolder."
Last edited by Chris on Tue Jun 28, 2005 11:27 pm; edited 1 time in total |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1715
|
Posted: Tue Jun 28, 2005 12:52 pm Post subject: |
|
|
its slow but if icons are to be shown than random icon won't help. and the idea of maintaining an array of file extensions and imagelist is good.
thanx! _________________
 |
|
| Back to top |
|
 |
daonlyfreez
Joined: 16 Mar 2005 Posts: 738 Location: Berlin
|
Posted: Tue Jun 28, 2005 1:19 pm Post subject: |
|
|
@Rajat: Thank you for your answer. Am using the 'workaround' as you described already (I always use a copy of a script for fiddling with the GUI with your tool, and copy the generated GUI definitions to my 'real' script). Did replace ListView with ListBox to avoid erroring out yes, but please add something like: 'IfTheLineStartsWith "Gui, Add, ListView", just ignore it and put it back in when generating the resultfile'
@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'....
| Quote: | | 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... _________________
Get your own Ron Paul 2008 userbar! |
|
| Back to top |
|
 |
neyon
Joined: 29 May 2005 Posts: 34 Location: The Netherlands
|
Posted: Tue Jun 28, 2005 2:52 pm Post subject: |
|
|
Chris,
Another fantastic improvement! I fully agree with all the positive comments written here. Fantastic.
Thanks!
Neyon |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Tue Jun 28, 2005 11:26 pm Post subject: |
|
|
| Rajat wrote: | | i did a li'l research and found that shell32.dll\ExtractAssociatedIcon gives the correct icon | 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.
| Quote: | | You make this sound so simple, but it's mumbo jumbo to me for now... | 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.
| Quote: | | I think we need to try to collect 'useful DLLCalls' somewhere, maybe in the 'Utilities & Resources' section? | I agree. Either there or in Scripts/Functions, whichever seems more appropriate (case by case). Hopefully the collection will grow over time. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Tue Jun 28, 2005 11:29 pm Post subject: |
|
|
Here are the changes for v1.0.36.01:
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] |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jun 29, 2005 5:01 pm Post subject: |
|
|
| Chris wrote: | | Rajat wrote: | | i did a li'l research and found that shell32.dll\ExtractAssociatedIcon gives the correct icon | 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. |
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. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|