Sign in to follow this  
Followers 0
trids

IconMap

14 posts in this topic

#1 ·  Posted (edited)

Thanks to PaulIA's ListView UDFs, which you can get here, we can do some cool things ...

INTRODUCTION

IconMap saves and restores the desktop icon layout using ini-format *.ICN files.

Using IconMap you can update your desktop icon mappings at any time, or restore any saved layout at any time. Or you can create as many mappings as you like, such as for different screen resolutions, or different users. You can even copy your desktop layout from one machine to another.

OPERATION

  • Compile and copy IconMap.EXE to "C:\Program Files\IconMaps\IconMap.exe" .. or change the code for the "/INSTALL" switch below to reflect your chosen path.
  • Run the EXE with no commandline parameters to activate an option that installs shell context menu options for when *.ICN files are rightclicked in Windows File Explorer.
  • In any folder (even directly on the desktop itself), create a "New Text Document" with with a right-click option, and give it a meaningful name with an *.ICN extension. For example: "1280 x 1024 (trids).icn" or "my_mappings.icn", etc.
  • When you right-click the *.ICN file, and select the option Save IconMap layout, the positions of the icons on the desktop are recorded into that *.ICN file.
  • Select the right-click option Restore IconMap layout to re-arrange the icons according to previously saved mapping coordinates in the *.ICN file.
Enjoy

:)

Edit: added a link to PaulIA's Auto3Lib for the A3LListView.AU3 dependency

IconMap.au3

post-54-1188814913_thumb.jpg

Edited by trids

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Realy usefull idea! :) - Thanks!

One question: the new files that i create on desktop after saving positions, they appears on the top of my icons list when i restore the positions, is it designed like this? because i think it's not very convinient - it better that these icons will moved to the buttom (end) of the list (i have like 30 icons on the desktop).

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Thanks for the feedback, MsCreatoR.

The paradigm is to save and restore your layouts .. so if you create new icons after having saved a map, then position them where you want them and update your map by rightclicking and selecting Save IconMap layout

This will register the new icons and their positions in your selected map.

HTH

:)

Share this post


Link to post
Share on other sites

trids

The paradigm is to save and restore your layouts

I understand, but what i mean, is that i want to be able restore my previouse session but without touching the new icons (that they will not change position)...

But i am figured out how to do it, and even more - i take your idea to whole another level, i make a Gui for it, and now it's very convinient to use the app (the CmdLine still supported)...

If you not mind, i would like to post new topic, because this will be a litle diferend name of the app, but all credits and the main idea is belong to you :)


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

..

If you not mind, i would like to post new topic, because this will be a litle diferend name of the app, but all credits and the main idea is belong to you :P

..

Be my guest - I'm looking forward to seeing how the idea progresses :)

And for those who are looking for the A3LListView.au3 dependency, here is PaulIA's thread for his Auto3Lib UDFs. Hopefully one day this will be absorbed into AU3 as intrinsic functions. :)

Share this post


Link to post
Share on other sites

Be my guest - I'm looking forward to seeing how the idea progresses

Thanks, here it is - http://www.autoitscript.com/forum/index.php?showtopic=53209 :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

I'm wondering as well why there has been not an updated IconMap.au3

You have to replace following code:

1)

#INCLUDE "C:\Program Files\AutoIt3\Include\A3LListView.au3"

to

#INCLUDE <GuiListView.au3>

2x:

2)

_ListView_GetItemCount

to

_GUICtrlListView_GetItemCount

3)

_ListView_GetItemText

to

_GUICtrlListView_GetItemText

4)

_ListView_GetItemPosition

to

_GUICtrlListView_GetItemPosition

Now this cool program works again great with v3.2.10.0!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I did all the changes needed and yet when I try and save my Icon Layout it beeps but the file isn't written to.

Edit: Renamed file to Layout 1024x768.icn and it worked :)

Edit 2: Tried again but nothing worked.

Edited by JamesB

Share this post


Link to post
Share on other sites

@Zedna: Thanks for completing the forgotten one :)

@JamesB: Did you try creating a icn by using IconMap with a command line?

What happens if you try this IconMap.exe /save C:\test.icn ?

Share this post


Link to post
Share on other sites

OK, so since it sort of worked and it didnt with me I decided I would add some things to it.

I added:

/UNINSTALL - Checks to see if there is a *.icn ext association. If there is then /UNINSTALL

Error - Any errors are notified and then logged

Confirmation - I didn't know if it had installed so I added a confirmation message

I will post the code soon!

Share this post


Link to post
Share on other sites

#include <GuiListView.au3>

; Get runtime instructions
If @Compiled Then
    Switch $CmdLine[0]
        Case 0
            If RegRead("HKCR\.icn", "") = "IconMaps" Then
                $sMode = "/UNINSTALL"
            Else
                $sMode = "/INSTALL"
            EndIf
        Case 2
            $sMode = ($CmdLine[1]); /SAVE or /RESTORE
            $sINI = $CmdLine[2]; The *.ICN filename to use as ini file
        Case Else
            MsgBox(4096 + 48, @ScriptName, "Error - Commandline Usage:" & @LF & @LF & 'IconMap.exe /save "<.icn filename>"' & @LF & _
                    'IconMap.exe /restore "<.icn filename>"')
    EndSwitch
Else
; Designtime testing;o)
    $sMode = "/RESTORE"
    $sINI = "C:\Documents and Settings\James\Desktop\Desktop.icn"
EndIf

; Get a handle on the desktop, which is actually a listview control.
$hWnd_LV = ControlGetHandle("Program Manager", "", "[CLASS:SysListView32]")

; Save or Restore?
Switch StringUpper($sMode)
    Case "/SAVE"
    ; Drop all previous icon positions
        IniDelete($sINI, "Icons")
    ; Walk the listview items, saving their positions to the INI file.
        For $nIdx = 0 To _GUICtrlListView_GetItemCount($hWnd_LV) - 1
            $sIconText = _GUICtrlListView_GetItemText($hWnd_LV, $nIdx)
            $aPos = _GUICtrlListView_GetItemPosition($hWnd_LV, $nIdx)
            If @error Then MsgBox(32, StringTrimRight(@ScriptName, 4), "There was an error writing details for program: " & $sIconText)
            IniWrite($sINI, "Icons", $sIconText, $aPos[0] & ":" & $aPos[1])
        Next
        Beep(1500, 100)
        Beep(1000, 100)
        Beep(500, 100)
    Case "/RESTORE"
    ; Walk the listview items, applying their positions from the INI file.
        For $nIdx = 0 To _GUICtrlListView_GetItemCount($hWnd_LV) - 1
            $sIconText = _GUICtrlListView_GetItemText($hWnd_LV, $nIdx)
            $aPos = StringSplit(IniRead($sINI, "Icons", $sIconText, "0:0"), ":")
            If $aPos[0] <> 2 Then
                MsgBox(0, StringTrimRight(@ScriptName, 4), "Error - invalid coordinates for icon:" & @LF & @LF & $sIconText)
                Exit
            EndIf
            _GUICtrlListView_SetItemPosition($hWnd_LV, $nIdx, $aPos[1], $aPos[2])
        Next
        Beep(500, 100)
        Beep(1000, 100)
        Beep(1500, 100)
    Case "/INSTALL"
    ; Setup a context menu for the command shell
        If MsgBox(4096 + 4 + 32, StringTrimRight(@ScriptName, 4), "Configure shell options for Right-clicking on *.ICN map files?" & @LF & _
                "This requires writing to the registry!") = 6 Then;6=Yes
        ; Prep Registry entries to handle ".icn" files
            RegWrite("HKCR\.icn", "", "REG_SZ", "IconMaps")
            If @error Then
                MsgBox(32, StringTrimRight(@ScriptName, 4), "There was an error installing *.ICN extension!")
                $ErrorLog = FileOpen(@ScriptDir & '\error.log', 1)
                FileWrite($ErrorLog, "Error installing IconMap *.ICN information to registry!")
                FileClose($ErrorLog)
            EndIf
            RegWrite("HKCR\IconMaps", "", "REG_SZ", "Desktop Icon Positions")
            If @error Then
                MsgBox(32, StringTrimRight(@ScriptName, 4), "There was an error installing registry information!")
                $ErrorLog = FileOpen(@ScriptDir & '\error.log', 1)
                FileWrite($ErrorLog, "Error installing IconMap information to registry!")
                FileClose($ErrorLog)
            EndIf
            RegWrite("HKCR\IconMaps\Shell", "", "REG_SZ", "1_save")
            RegWrite("HKCR\IconMaps\Shell\1_save", "", "REG_SZ", "S&ave IconMap layout")
            RegWrite("HKCR\IconMaps\Shell\1_save\command", "", "REG_SZ", '"C:\Program Files\IconMaps\IconMap.exe" /save "%1"')
            RegWrite("HKCR\IconMaps\Shell\2_restore", "", "REG_SZ", "R&estore IconMap layout")
            RegWrite("HKCR\IconMaps\Shell\2_restore\command", "", "REG_SZ", '"C:\Program Files\IconMaps\IconMap.exe" /restore "%1"')
            MsgBox(64, StringTrimRight(@ScriptName, 4), "IconMap was succesfully installed!")
        EndIf
    Case "/UNINSTALL"
        If MsgBox(4096 + 4 + 32, StringTrimRight(@ScriptName, 4), "Are you sure you want to remove " & @ScriptName & "?" & @LF & "This will remove the " & _
                "*.ICN extension - You will not be able to run IconMap.exe!") = 6 Then;6=Yes
        ; Remove previously Registered entires
            RegDelete("HKCR\.icn")
            If @error Then
                MsgBox(32, StringTrimRight(@ScriptName, 4), "There was an error removing *.ICN extension!" & @LF & "Error was logged!")
                $ErrorLog = FileOpen(@ScriptDir & '\error.log', 1)
                FileWrite($ErrorLog, "Error removing IconMap *.ICN information from registry!")
                FileClose($ErrorLog)
            EndIf
            RegDelete("HKCR\IconMaps")
            If @error Then
                MsgBox(32, StringTrimRight(@ScriptName, 4), "There was an error removing registry keys for IconMap information." & @LF & _
                        "Error was logged!")
                $ErrorLog = FileOpen(@ScriptDir & '\error.log', 1)
                FileWrite($ErrorLog, "Error removing IconMap information from registry!")
                FileClose($ErrorLog)
            EndIf
            MsgBox(64, StringTrimRight(@ScriptName, 4), "IconMap has been removed!")
        EndIf
    Case Else
        MsgBox(4096 + 48, StringTrimRight(@ScriptName, 4), "Error - Commandline Usage:" & @LF & @LF & 'IconMap.exe /save "<.icn filename>"' & @LF & _
                'IconMap.exe /restore "<.icn filename>"')
EndSwitch

Share this post


Link to post
Share on other sites

This code still works on Windows 8.1 which is awesome since our imaging software doesn't seem to modify icon layout (or resolution - using a different AutoIt script for that) for some reason. It's a kludge, but we run this (and the resolution change) after pushing an image to a bunch of PCs and it fixes the issue we have. Thanks to everyone for pitching in with this!

(I know this is a bump...but not only does this validate it still works for Windows 8.1, I really, really wanted to thank the people involved with this in case they're still around here somewhere.)

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