Sign in to follow this  
Followers 0
Mat

Enhanced Icons V1.1 + V2 by smashly + another version by corgano!

53 posts in this topic

#1 ·  Posted (edited)

Yawn... Got the second half of school off due to inset or something, and decided I needed to sit down and settle back in with ma keys!! It took me 2 hours. I'd forgotten how easy it was to put togethor GUI's and functions. Its a small script... But it does the job very well.

What does it do? It is a very simple dialog that helps you make your own special icons Posted Image, They are special becuse they have a customizable context menu. This solves a lot of problems, such as overcrowded desktops, and having similar Icons for similar programs doing different things, and always clicking on the wrong one.

I have used this idea before, but never completed a creator like this one, but to see an example of the icon you can look here (Script is out of date, but I can't change it at the mo).

Thanks to... ResNullius and Smashly... Both made helpful comments in the thread linked. Also thanks to Herby, who showed me how its done.

"to Au3" is not yet done, and since I don't really need it, its not going to be in the near future. but there is a space for the function if someone wants to write it - it will get added in.

When It makes the reg file... It will write a file with the same name except with ".remove" on the end. Running this removes it from the registry.

http://code.google.com/p/m-a-t/downloads/detail?name=EnhancedIcons.zip

downloads: 50ish + 216 + Number on download page

MDiesel

a new and improved version by smashly can be found here

and yet another version by corgano can be found here!

And a second version from corgano about 6 months later... here

Edited by Mat

Share this post


Link to post
Share on other sites



Error:

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\David\Desktop\circle2.2.au3"

C:\Users\David\Desktop\circle2.2.au3 (150) : ==> Variable used without being declared.:

$hFile = FileOpen ($sFile, 2)

$hFile = FileOpen (^ ERROR

->19:23:05 AutoIT3.exe ended.rc:1


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

Error:

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\David\Desktop\circle2.2.au3"

C:\Users\David\Desktop\circle2.2.au3 (150) : ==> Variable used without being declared.:

$hFile = FileOpen ($sFile, 2)

$hFile = FileOpen (^ ERROR

->19:23:05 AutoIT3.exe ended.rc:1

Local $aArray[$Count]

Local $aArray[....]

Array Variable subscript bably formatted.

Share this post


Link to post
Share on other sites

Local $aArray[$Count]

Local $aArray[....]

Array Variable subscript bably formatted.

Thanks Corgano + lequocthachv, Will edit now. Corgano's error is a very bad one from me. Sorry :D. I Can't see yours though Leq.

Edited and first post updated.

MDiesel

Share this post


Link to post
Share on other sites

error again....

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\David\Desktop\New AutoIt v3 Script (2).au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>09:19:19 Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/ CPU:X86 OS:X86)

>Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3

C:\Users\David\Desktop\New AutoIt v3 Script (2).au3(170,62) : ERROR: _ToReg() called with wrong number of args.

FileWrite ($hFile, _ToReg ($sName, $sInfo, $sIco, $sCxt)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\David\Desktop\New AutoIt v3 Script (2).au3(134,51) : REF: definition of _ToReg().

Func _ToReg ($sFile, $sName, $sInfo, $sIco, $sCxt)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\David\Desktop\New AutoIt v3 Script (2).au3 - 1 error(s), 0 warning(s)

!>09:19:21 AU3Check ended.rc:2

>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\David\Desktop\New AutoIt v3 Script (2).au3"

C:\Users\David\Desktop\New AutoIt v3 Script (2).au3 (170) : ==> Incorrect number of parameters in function call.:

FileWrite ($hFile, _ToReg ($sName, $sInfo, $sIco, $sCxt))

FileWrite ($hFile, ^ ERROR

->09:19:52 AutoIT3.exe ended.rc:1

+>09:19:53 AutoIt3Wrapper Finished

>Exit code: 1 Time: 34.128


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

grrrr... Thanks again. I solved it for one function only so I could wreck another. Done now too.

MDiesel

Share this post


Link to post
Share on other sites

OK now i have an icon, how do I remove it?


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

I just ran a test and it worked, but gave me no remove.reg

I need a way to remove the icon, I cannot delete it, and I have spent hours looking through the regestry trying to find it, but with no luck.


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

I just ran a test and it worked, but gave me no remove.reg

I need a way to remove the icon, I cannot delete it, and I have spent hours looking through the regestry trying to find it, but with no luck.

When you search the registry try searching for the default icon you used or the text you used for a context menu..

Start your search in the HKCR\CLSID key..

Myself I'd make the program write a log or config file with every reg change made for any icon added..

Then in the gui have it so it lists the Icons that it's added by reading the config file..

Once loaded, select the desired icon from the list and then remove the keys based on the config file..

Once an icon is removed , remove it from the config file..

Bugger playing around with .reg files, since autoit supports to read/write/delete registry keys/values..

Or

When an Icon is added, then add a remove string with the CLSID for the new icon in the registry under the HKLM\...\..\Uninstall registry key. This way a user can remove the icon through add and remove programs even if they no longer have the Enhanced Icons programs on their pc.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I have a method... All the things have to be added to the namespace key to get added to the desktop, so I can read that and find the keys etc...

a remove file is made during the merge...

Try running this script:

Run ("Regedit.exe \S """ & @TempDir & "\tempfileiconcreate.remove.reg""")

To Remove All:

$i = 0
While 1
   $i += 1
   $sVal = RegEnumKey ("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\", $i)
   If @Error Then ExitLoop
   RegDelete ("HKEY_CLASSES_ROOT\CLSID\" & $sVal)
   RegDelete ("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\" & $sVal)
WEnd
MsgBox (0, "done", "done and dusted!")

I am writing a remover... That does not need a log. Much more sensible. It will work on a similar basis to the remve all script above.

MDiesel

Edit: Remove all script is now working. RegEnumKey

Edited by mdiesel

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Hi, I just wrote an uninstall string to the registry so i can remove any icon I've added via windows add and remove programs.

I add the uninstall string when the icon is being added to the registry.

The uninstall string just uses cmd.exe..

example (do not run the code without first setting the variables to what suites your needs!):

$sCLSID = "{whatever-icon-clsid-was-generated}"
$sName = "My Super Icon"
$string = "cmd.exe /c REG DELETE HKCR\CLSID\" & $sCLSID & " /f & "
$string &= "REG DELETE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\" & $sCLSID & " /f & "
$string &= "REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $sCLSID & " /f"
RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $sCLSID, "DisplayName", "REG_SZ", $sName)
RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $sCLSID, "UninstallString", "REG_SZ", $string)

PS. I've only tried it this way under x86 XP, will try it in win 7 x64 when I'm at home.

Edited by smashly

Share this post


Link to post
Share on other sites

Thats an interesting way to do it smashly... A very good way too! I might look at that a bit closer... But i'm getting there with my deleter... Its just merging into more of an editor...

What it does: Read all current ones, and shows them in a list with name, infotip etc. You can delete them from there now, and it works well... Only I'm now integrating it into the maker, and allowing you to edit it. I'm then going to write the au3 creator function, and remove reg files completely (maybe leave the option in there anyway). Thats the future for the project as I see it. And That will probably be version 2, and next week sometime. Maybe sooner, as there looks to be a fair birt of interest here for once... I'm used to no replies for my scripts :D

Has that "remove all" function been working??

MDiesel

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I have a method... All the things have to be added to the namespace key to get added to the desktop, so I can read that and find the keys etc...

a remove file is made during the merge...

Try running this script:

Run ("Regedit.exe \S """ & @TempDir & "\tempfileiconcreate.remove.reg""")

To Remove All:

$i = 0
While 1
   $i += 1
   $sVal = RegEnumVal ("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\", $i)
   If @Error Then ExitLoop
   RegDelete ("HKEY_CLASSES_ROOT\CLSID\" & $sVal)
   RegDelete ("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\" & $sVal)
WEnd
MsgBox (0, "done", "done and dusted!")

I am writing a remover... That does not need a log. Much more sensible. It will work on a similar basis to the remve all script above.

MDiesel

The second one didn't work, but the first did, thanks!

It said something about the regestry with the command line /S.... Make a failsafe to insure that it will ALWAYS leave a remove.reg (why did you use .reg files instead of doing it directly?)

I am gonna start working on a program to do the same thing as this one, see if I can make something that works a little better. It is going to store all of its icons in the same area (of the registry) so if the worst happens, someone can always manually delete them. Keep up the good work

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

wrong

[HKEY_CLASSES_ROOT\CLSID\{2368BDE7-2206-49B3-BDE6-409C629E542C}\DefaultIcon]

@="%SystemRoot%\\system32\\SHELL32.dll, 220"

right

[HKEY_CLASSES_ROOT\CLSID\{2368BDE7-2206-49B3-BDE6-409C629E542C}\DefaultIcon]

@="%SystemRoot%\\system32\\SHELL32.dll,220"

no space in %SystemRoot%\\system32\\SHELL32.dll,220"

Share this post


Link to post
Share on other sites

wrong

[HKEY_CLASSES_ROOT\CLSID\{2368BDE7-2206-49B3-BDE6-409C629E542C}\DefaultIcon]

@="%SystemRoot%\\system32\\SHELL32.dll, 220"

right

[HKEY_CLASSES_ROOT\CLSID\{2368BDE7-2206-49B3-BDE6-409C629E542C}\DefaultIcon]

@="%SystemRoot%\\system32\\SHELL32.dll,220"

no space in %SystemRoot%\\system32\\SHELL32.dll,220"

kk... I'll change that quicly... does it actually make a difference?

MDiesel

Share this post


Link to post
Share on other sites

kk... I'll change that quicly... does it actually make a difference?

MDiesel

it shows a generic icon

Share this post


Link to post
Share on other sites

updated with a simple way to delete current ones, and also to edit them... although thats not working perfectly yet.

MDiesel

Share this post


Link to post
Share on other sites

Hi, here's another function you might find useful.

Call it after adding or removing icons from the desktop.

It'll save the user having to manually refresh the desktop :D

Func _RefreshDesktop()
    Local Const $SHCNE_ASSOCCHANGED = 0x8000000
    Local Const $SHCNF_IDLIST = 0x0
    DllCall("shell32.dll", "int", "SHChangeNotify", "long", $SHCNE_ASSOCCHANGED, "int", $SHCNF_IDLIST, "ptr", 0, "ptr", 0)
    If @error Then Return SetError(@error, 0, 0)
    Return SetError(0, 0, 1)
EndFunc   ;==>_RefreshDesktop

Cheers

Share this post


Link to post
Share on other sites

I was thinking about that.... but was left with minimizing all windows and sending F5... Will be added soon smashly!

MDiesel

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0