AutoHotkey Community

It is currently May 26th, 2012, 12:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: May 14th, 2008, 6:00 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Nice improvements!

Do you know why the Vista shell32.dll icon numbers are so weird? After Icon #338 the next one is #512, followed by #1001..1011, then #8240, and #16710..16783.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2008, 10:39 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Laszlo wrote:
Do you know why the Vista shell32.dll icon numbers are so weird? After Icon #338 the next one is #512, followed by #1001..1011, then #8240, and #16710..16783.


It is ditto in XP!
Those are Ordinal numbers, almost similar to A_Index

The numbers between 338 and 512 would probably been used by other types of resources in the same DLL

For example :

For a project: I collect my different type of resources like Bitmaps, Jpeg and Icons and place them in folder and loop them.
A_LoopFileName would give me them in the order they were added.
I would ascertain the data type by the file extension, and pass A_Index+100 as Ordinal number

like.. .
ICO will be added as RT_GROUP_ICON
BMP will be added as RT_BITMAP
JPG will be added as RT_RCDATA

When I open the resource file with ResHacker,
it shows me the resources arranged according to data type,
and my A_Index+100 numbers gets jumbled across various data types

In XP - shell32.dll, the last ordinal for Group Icon is 16721.
As you say, for Vista it is 16783, they have been added later.


:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2008, 11:06 pm 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
hey SKAN nice improvements
it seems it's reasonable to be called v1.0
i have no more suggestion. close to perfect now :)
i love it Thanks!

PS. also thanks for informing sean's neat function
sometimes treasures are in Ask for Help that we missing usually

_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2008, 11:17 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Thanks heresy. :)

heresy wrote:
i have no more suggestion. close to perfect now :)


I find that with some DLLs, IconEx acts strange.. though nothing is wrong with my code. I have learn more to handle these exceptions.

Please do report any glitches in the GUI interface.. I have applied lots of hellish workarounds.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2008, 11:40 pm 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
i think there's a little mistake.
FileSelectFolder dialog doesn't submit the selected path

and it's not that important but i just curious that why it doesn't support ICL (icon library)?

_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2008, 11:58 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
heresy wrote:
i think there's a little mistake.
FileSelectFolder dialog doesn't submit the selected path


Corrected!

Line #320 : ControlSetText,,%tFolder%, ahk_id %hSHAC%
should have been
ControlSetText,,%nFolder%, ahk_id %hSHAC%

Thanks for reporting it.

heresy wrote:
and it's not that important but i just curious that why it doesn't support ICL (icon library)?


ICL file is not a PE file .. it is a 16bit NE file, means all the goody API functions available in >= W2K will not work with it.

You do not need ICL unless you use Windows 98 SE
DLL is the way to go and I am already working on script that will create a Resource-only-DLL when provided with a folder full of the extracted ICONS.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2008, 12:28 am 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
SKAN wrote:
DLL is the way to go and I am already working on script that will create a Resource-only-DLL

i really expect this :)
thank you SKAN for all your devotions

_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Set Icons for folder
PostPosted: December 19th, 2008, 5:54 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
Hey Skan,

Great Job with the Icon Explorer program! it works great.

It's close to something i've been looking for in AHK.
Setting a custom Folder Icon easily. I was wondering if there's any way to modify the program to give me the exact path of the selected icon group (copy it to clipboard maybe)...

and then i can select a folder and change it's icon quickly with that one with the help of a hotkey. Is this possible? I always change my download,upload folder icons to make them more easily recognizable... Currently I have to manually change icons and it's a pain, no shortcut way of doing it.

The way AHK can set the custom icon is via the Desktop.ini file in that folder. Here's a sample.

Code:
[.ShellClassInfo]
IconFile=Compile_AHK_Setup.exe
IconIndex=0


I had to manually modify this to make the paths relative such that when i move the folder it copies it automatically as well. I would prefer the paths to be relative for all i guess...

another example...
Code:
[.ShellClassInfo]
IconFile=%SystemRoot%\system32\SHELL32.dll
IconIndex=161


Actually now that i think about it, it would be easier for IconEx to create a Desktop.ini file with the selected icon and put the file on the clipboard, then i can select a folder and hit paste to apply the icon!. The file has to have the Archive, Hidden and System attributes set (i think, at least that's how it is now).

There's a slight risk in that it will overwrite any existing customizations for that folder.

What do you think?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Set Icons for folder
PostPosted: December 19th, 2008, 6:14 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
vixay wrote:
What do you think?


I think it is a great idea. Please allow me sometime to investigate.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Attempt1
PostPosted: December 19th, 2008, 6:47 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
Hey Skan...

I just spent 20 mins working on my idea.... and strangely i have it semi-working!
Let me explain. First here's the code.

Code:
F10:: ;Create a Custom Desktop.ini file and copy it to clipboard for easily changing folder icons.
;By Vixay on Fri December 19, 2008 12:38:19 PM
CustomFolderIcon:
  FileN = %A_Temp%\Desktop.ini
FileText =
(
[.ShellClassInfo]
IconFile=%tFolder%\%File%
IconIndex=%IconGroup%

)
  IfExist, %FileN%
  {
    FileDelete, %FileN%
  }
  FileAppend, %FileText%, %FileN%
  If ErrorLevel = 0
  {
    FileSetAttrib, +ASH, %FileN%
    FileToClipboard(FileN)
  }
Return

; Converts a file copied as Name to a file struct on clipboard
;^v::Send %Clipboard% ;Paste as plain text - opposite of function
;http://www.autohotkey.com/forum/topic25416.html
FileToClipboard(PathToCopy)
{
    ; Expand to full paths:
    Loop, Parse, PathToCopy, `n, `r
        Loop, %A_LoopField%, 1
            temp_list .= A_LoopFileLongPath "`n"
    PathToCopy := SubStr(temp_list, 1, -1)
   
    ; Allocate some movable memory to put on the clipboard.
    ; This will hold a DROPFILES struct and a null-terminated list of
    ; null-terminated strings.
    ; 0x42 = GMEM_MOVEABLE(0x2) | GMEM_ZEROINIT(0x40)
    hPath := DllCall("GlobalAlloc","uint",0x42,"uint",StrLen(PathToCopy)+22)
   
    ; Lock the moveable memory, retrieving a pointer to it.
    pPath := DllCall("GlobalLock","uint",hPath)
   
    NumPut(20, pPath+0) ; DROPFILES.pFiles = offset of file list
   
    pPath += 20
    ; Copy the list of files into moveable memory.
    Loop, Parse, PathToCopy, `n, `r
    {
        DllCall("lstrcpy","uint",pPath+0,"str",A_LoopField)
        pPath += StrLen(A_LoopField)+1
    }
   
    ; Unlock the moveable memory.
    DllCall("GlobalUnlock","uint",hPath)
   
    DllCall("OpenClipboard","uint",0)
    ; Empty the clipboard, otherwise SetClipboardData may fail.
    DllCall("EmptyClipboard")
    ; Place the data on the clipboard. CF_HDROP=0xF
    DllCall("SetClipboardData","uint",0xF,"uint",hPath)
    DllCall("CloseClipboard")
}


This works well! I put this right about the CreateSimpleIcon in IconEx V1.00. I have set F10 as the hotkey for this. I tried it, it creates the file flawlessly and puts it on the clipboard as well!
I can paste it and it has the correct attributes and everything. But when I try to refresh and see my changes, it doesn't work!
I suspect this has to do with how Windows manages the Icon Cache and all that. Or maybe you need a corresponding registry entry? I vaguely remember something about BAGS and the number of BAGS that windows can have for folder customizations and all. I think maybe restarting will solve this issue, haven't tested yet. But do you have any ideas? Anyone more knowledgable on this care to shed some light? I know that IconPackager had an option to rebuild the Icon Cache to ensure that their changes are shown... anyway i'm left scratching my head for right now. Maybe there needs to be a dllcall to refresh it correctly.

The second issue, is that the path is absolute... i don't know how to make it use the environment variables instead of the actual path, but i guess it's ok even then.

summary: 2 problems

1) Copying Desktop.ini doesn't actually change the folder icon (maybe refresh issue, maybe need something more)
2) Path to icon is absolute, doesn't use environment variables. (Impossible to make it relative since we don't know where it might be copied!)

/Edit: spelling and clarifications


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2008, 7:09 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
http://www.softwaretipsandtricks.com/wi ... Icon-Cache

http://www.fiveanddime.net/notes/folder-icons.html

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\\Max Cached Icons


HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\\NoNetCrawling
0 = for auto icon refresh, but slows down pc



some links i found while trying to research the issue


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Attempt1
PostPosted: December 20th, 2008, 9:40 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Been experimenting hard with ShChangeNotify but been only partly successful.
I am unable to update the treeview pane of open explorer windows, though I am able to manage with the right pane :( ...
..and does not work with vista .. can you test it in Vista ?


Last edited by SKAN on December 22nd, 2008, 5:14 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2008, 5:00 am 
Offline

Joined: June 12th, 2008, 10:29 am
Posts: 52
I don't have vista, so can't test on that.
Maybe doing it via mouseclicks is a better idea? you know like right-click folder, choose properties > Customize tab > Change Icon > choose correct Icon > oK > OK.

I am sure though that rather than using mouseclicks we can call the correct dll with the folder as the argument? just thinking out loud here.

Also I have absolutely zero experience with windows API so unfortunately I really can't help there.

I guess will have to just try the rebuild icon cache from TweakUI. I just tried that... and it didn't seem to help. hmmm... maybe i need to test on some other folders...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 22nd, 2008, 5:30 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
vixay wrote:
I don't have vista, so can't test on that.


I have installed, FileSetAttrib +S requires elevated priviliges, I guess.

Quote:
Maybe doing it via mouseclicks is a better idea? you know like right-click folder, choose properties > Customize tab > Change Icon > choose correct Icon > oK > OK.


I do not like mouse based automation.

Quote:
I guess will have to just try the rebuild icon cache from TweakUI. I just tried that... and it didn't seem to help. hmmm... maybe i need to test on some other folders...


Restarting explorer does it.. but cannot be accepted as a solution.

Code:
^#!E::
TrayTip, Restarting Windows Explorer, Please wait for a while
Sleep 1000
Loop 100 {
Process, Close, explorer.exe
Process, Exist, explorer.exe
IfEqual,ErrorLevel,0, Break
     }
Run %A_WinDir%\explorer.exe
WinWait ahk_class Shell_TrayWnd
TrayTip, Restarting Windows Explorer, Done!
Return


Allow me one day, & I will post a beta


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 23rd, 2008, 10:38 pm 
Offline

Joined: May 21st, 2007, 3:44 pm
Posts: 176
Location: USA
I was experimenting with sizing the GUI and found something, there are 4 buttons above the status bar.

Put "autosize" on the "gui, show" line, like so..."

Code:
Gui, Show, w655 h535 autosize, IconEx - v1.0


By The Way - Thank you for this script.

_________________
-------------
Scott Mattes
Image
My small, and slowly growing, collection of scripts.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot] and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group