qsek Posted August 6, 2007 Share Posted August 6, 2007 (edited) Hi,After a while, ive been learning here in the forums from others, i thought i share a bit of (to me) useful stuffto give a bit back what i received.With this little script you can save your Icon Positions on the Desktop and in Windows.The positions are written in inis in a folder created in the ScriptDir.Auto Arrange has to be turned off.Fixed: Restoring Icons now works (thx paulchen)I used and modified the Save/Restore Functions in smstroble's Unlimited Desktop Script.The Window Selection GUI is originally from Ozu.It looks like this: expandcollapse popup#include <A3LListView.au3> #include <GUIConstants.au3> #Include <GuiListView.au3> #include <File.au3> $guiwindow = GUICreate("Window Selection", 350, 150) $font = "Arial Bold" $LoadB = GUICtrlCreateButton(" Load ", 5, 123) $SaveB = GUICtrlCreateButton(" Save ", 45, 123) GUICtrlSetFont(-1, 8.5, 400, -1, $font) $refreshbutton = GUICtrlCreateButton("Refresh", 100, 123, 60, 25) GUICtrlSetFont(-1, 8.5, 400, -1, $font) $nListview = GUICtrlCreateListView(" Title|State ", 0, 0, 350, 120) GUICtrlSendMsg($nListview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($nListview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) RefreshWidth() Func RefreshWidth() _GUICtrlListViewSetColumnWidth($nListview,1,$LVSCW_AUTOSIZE_USEHEADER) _GUICtrlListViewSetColumnWidth($nListview,1,_GUICtrlListViewGetColumnWidth ($nListview,1)-2) EndFunc ListWindows() LoadInis() ; only that one visible in ListView While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_Event_Close GUIDelete($guiwindow) Exit Case $msg = $LoadB Restore() ContinueLoop Case $msg = $SaveB Save() ListWindows() LoadInis() ContinueLoop Case $msg = $refreshbutton ListWindows() LoadInis() EndSelect WEnd Exit Func ListWindows() GUISetState(@SW_SHOW) _GUICtrlListViewDeleteAllItems($nListview) $aWindows = WinList("[CLASS:CabinetWClass]") ; To remove visible windows take out 'IsVisible' function. For $i = 1 To $aWindows[0][0] ;~ MsgBox(0, 0, "You choose: " & ControlGetText ($aWindows[$i][0], "", "SysListView321")) If $aWindows[$i][0] <> "" And ControlGetText ($aWindows[$i][0], "", "SysListView321") = "FolderView" Then GUICtrlCreateListViewItem($aWindows[$i][0], $nListview) EndIf Next GUICtrlCreateListViewItem("Program Manager(Desktop)", $nListview) _GUICtrlListViewSetColumnWidth($nListview, 0, $LVSCW_AUTOSIZE) EndFunc ;==>ListWindows Func LoadInis() $FileList =_FileListToArray(@ScriptDir & "\WindowsPos","*.ini") If @error <> 0 Then If @error = 1 Then DirCreate ( @ScriptDir & "\WindowsPos" ) Return -1 EndIf For $i = 0 To _GUICtrlListViewGetItemCount ($nListview)-1 $name = _GUICtrlListViewGetItemText ( $nListview, $i ,0) If @error <> 0 Then Return False $Load = LoadIni($name,$i) If $Load Then _GUICtrlListViewSetItemText ( $nListview, $i, 1, $Load ) EndIf Next RefreshWidth() EndFunc Func LoadIni($name,$listnr) Dim $PosList[1][3] If Not FileExists(@ScriptDir & "\WindowsPos\"&$name&".ini") Then Return False ; keine Ini gefunden $IniSec = IniReadSection (@ScriptDir & "\WindowsPos\"&$name&".ini","Positions by Name") If @error=1 Then Return "Error in ini" ; ini gefunden aber fehlerhaft EndIf Return "Positions found" EndFunc Func Restore() $winname = _GUICtrlListViewGetItemText ( $nListview, -1 ,0) If $winname = "Program Manager(Desktop)" Then $handle = ControlGetHandle("Program Manager", "", "SysListView321") Else $handle = ControlGetHandle($winname, "", "SysListView321") EndIf _ListView_BeginUpdate ($handle) For $i = 0 To _ListView_GetItemCount ($handle) $name = _ListView_GetItemText ($handle, $i) $x = IniRead(@ScriptDir & "\WindowsPos\"&$winname&".ini", "Positions by Name", $name & "x", "Unknown") $y = IniRead(@ScriptDir & "\WindowsPos\"&$winname&".ini", "Positions by Name", $name & "y", "Unknown") If $x <> "Unknown" Then _ListView_SetItemPosition32 ($handle, $i, $x, $y) EndIf Next _ListView_EndUpdate ($handle) EndFunc ;==>Restore Func Save() $winname = _GUICtrlListViewGetItemText ( $nListview, -1 ,0) If $winname = "Program Manager(Desktop)" Then $handle = ControlGetHandle("Program Manager", "", "SysListView321") Else $handle = ControlGetHandle($winname, "", "SysListView321") EndIf If @error = 1 Then MsgBox(0,0," Error(ControlGetHandle) : cant get handle") $t= MsgBox(4, "Confirm","Window Name: "&$winname&@CRLF& _ "Icon Count: "&_ListView_GetItemCount ($handle)&@CRLF& _ "Name of first Icon: "&_ListView_GetItemText($handle, 0)&@CRLF&@CRLF& _ " Do you really want to save?") If $t <> 6 Then Return _GUICtrlListViewSetItemText ( $nListview, _GUICtrlListViewGetCurSel ($nListview), 1, "saving..." ) FileDelete(@ScriptDir & "\WindowsPos\"&$winname&".ini") For $i = 0 To _ListView_GetItemCount ($handle) $pos = _ListView_GetItemPosition ($handle, $i) $name = _ListView_GetItemText ($handle, $i) If $pos[0] = True Then IniWrite(@ScriptDir & "\WindowsPos\"&$winname&".ini", "Positions by Name", $name & "x", $pos[0]) IniWrite(@ScriptDir & "\WindowsPos\"&$winname&".ini", "Positions by Name", $name & "y", $pos[1]) EndIf Next _GUICtrlListViewSetItemText ( $nListview, _GUICtrlListViewGetCurSel ($nListview), 1, "done" ) RefreshWidth() Sleep(1500) EndFunc ;==>Save Edited August 6, 2007 by qsek Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite Link to comment Share on other sites More sharing options...
Toady Posted August 6, 2007 Share Posted August 6, 2007 Very nice! I can really use this at work. Keep up the great work www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
WolfWorld Posted August 6, 2007 Share Posted August 6, 2007 It Doesn't Work On Vista Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Paulchen Posted August 6, 2007 Share Posted August 6, 2007 the Restore function was not complete. here a updated version. Its work on Vista.IconPos.au3 Link to comment Share on other sites More sharing options...
WolfWorld Posted August 6, 2007 Share Posted August 6, 2007 (edited) the Restore function was not complete.here a updated version. Its work on Vista.It Work Thanks!! Edited August 6, 2007 by athiwatc Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
qsek Posted August 6, 2007 Author Share Posted August 6, 2007 (edited) the Restore function was not complete.here a updated version. Its work on Vista.Thx paulchen, before i posted this, i modified the the Save Function to add "(Desktop)" behind "Program Manager". In the hurry forgot to add it to the Restore Function too.My bad, that i didnt tested it I fixed it in the first post. Edited August 6, 2007 by qsek Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite Link to comment Share on other sites More sharing options...
SharkyEXE Posted January 14, 2022 Share Posted January 14, 2022 Hello Excusme, help me, please I have use this script https://www.autoitscript.com/forum/topic/50804-restore-icon-positions/?do=findComment&comment=384473 Please, make, on this script work on Windows 7 If i run this script on Windows 7 - I have warning Thank You! Link to comment Share on other sites More sharing options...
Developers Jos Posted January 14, 2022 Developers Share Posted January 14, 2022 Just now, SharkyEXE said: I have warning Great, care to share the details or you want us to guess after 15 years? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SharkyEXE Posted January 14, 2022 Share Posted January 14, 2022 (edited) Jos Hello See picture, please Spoiler Edited January 14, 2022 by SharkyEXE Link to comment Share on other sites More sharing options...
Developers Jos Posted January 14, 2022 Developers Share Posted January 14, 2022 (edited) You are using a old program with a newer version of autoit. Open the helpfile and change those udfs to the correct names. ..and please do not PM me to let me know you replied as the forum already does that! Edited January 14, 2022 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SharkyEXE Posted January 14, 2022 Share Posted January 14, 2022 2 minutes ago, Jos said: You are using a old program with a newer version of autoit. Open the helpfile and change those udfs to the correct names. ..and please do not PM me to let me know you replied as the forum already does that! I'm sorry, I'm new, I can't edit myself Please make a par or teach me what to change It's easy for you, it's hard for me Link to comment Share on other sites More sharing options...
SharkyEXE Posted January 17, 2022 Share Posted January 17, 2022 (edited) qsek Hello If i use your script - After picture, one icon do not move on green position Why? Spoiler Edited January 17, 2022 by SharkyEXE Link to comment Share on other sites More sharing options...
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