trids Posted September 3, 2007 Posted September 3, 2007 (edited) Thanks to PaulIA's ListView UDFs, which you can get here, we can do some cool things ... INTRODUCTIONIconMap 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.OPERATIONCompile 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 dependencyIconMap.au3 Edited September 11, 2007 by trids
MrCreatoR Posted September 9, 2007 Posted September 9, 2007 (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 September 9, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
trids Posted September 10, 2007 Author Posted September 10, 2007 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
MrCreatoR Posted September 10, 2007 Posted September 10, 2007 tridsThe paradigm is to save and restore your layoutsI 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 Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
trids Posted September 11, 2007 Author Posted September 11, 2007 ..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 ..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.
MrCreatoR Posted September 12, 2007 Posted September 12, 2007 Be my guest - I'm looking forward to seeing how the idea progressesThanks, 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 Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Apzo Posted December 13, 2007 Posted December 13, 2007 Hello I'm very disappointed, because this soft works great but I can't play with the code. Since the PaulIA funcs has been merged with the official AU3 UDFs, the code won't compile anymore. How can I get/resore icon pos with AutoIt v3.2.10.0 ? Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else)
Clemens Posted February 8, 2008 Posted February 8, 2008 I'm wondering as well why there has been not an updated IconMap.au3You have to replace following code:1)#INCLUDE "C:\Program Files\AutoIt3\Include\A3LListView.au3"to#INCLUDE <GuiListView.au3>2x:2)_ListView_GetItemCountto_GUICtrlListView_GetItemCount3)_ListView_GetItemTextto_GUICtrlListView_GetItemText4)_ListView_GetItemPositionto_GUICtrlListView_GetItemPositionNow this cool program works again great with v3.2.10.0!
Zedna Posted February 8, 2008 Posted February 8, 2008 5)_ListView_SetItemPositionto_GUICtrlListView_SetItemPosition Resources UDF ResourcesEx UDF AutoIt Forum Search
James Posted February 9, 2008 Posted February 9, 2008 (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 February 9, 2008 by JamesB Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Clemens Posted February 10, 2008 Posted February 10, 2008 @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 ?
James Posted February 12, 2008 Posted February 12, 2008 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! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
James Posted February 12, 2008 Posted February 12, 2008 expandcollapse popup#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 Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
BrendonKoz Posted April 2, 2014 Posted April 2, 2014 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.)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now