MCP Posted October 24, 2007 Share Posted October 24, 2007 (edited) I would like to hide all the user icons on the desktop and to restore them.I have extracted some pretty damn good code on this, but I cannot move the folders.Has anyone already faced this goal? Any idea on where to start will be greatly appreciated.This is what I am on now:expandcollapse popupFunc HideDesktopIcons() Local $handle = ControlGetHandle('Program Manager', '', 'SysListView321') Local $pos, _ $name, _ $iniDir = @AppDataDir & '\Uncover IT\' & GetUniversalAppName (), _ $currentDesktop = 'default' ;MsgBox(0, '', $iniDir & '\' & $currentDesktop & '.ini') FileDelete($iniDir & '\' & $currentDesktop & '.ini') DirCreate($iniDir & '\User Desktop') DirCreate($iniDir & '\System Desktop') For $i = 0 To _ListView_GetItemCount ($handle) - 1 $pos = _ListView_GetItemPosition ($handle, $i) $name = _ListView_GetItemText ($handle, $i) IniWrite($iniDir & '\' & $currentDesktop & '.ini', 'Last Positions', $name, $pos[0] & '|' & $pos[1]) Next FileMove(@DesktopDir & '\*.*', $iniDir & '\User Desktop') FileMove(@DesktopCommonDir & '\*.*', $iniDir & '\System Desktop') DirMove(@DesktopDir & '\*.*', $iniDir & '\User Desktop') DirMove(@DesktopCommonDir & '\*.*', $iniDir & '\System Desktop') EndFunc ;==>HideDesktopIcons Func ShowDesktopIcons() Local $pos, _ $name, _ $iniDir = @AppDataDir & '\Uncover IT\' & GetUniversalAppName (), _ $currentDesktop = 'default' FileMove($iniDir & '\User Desktop' & '\*.*', @DesktopDir) FileMove($iniDir & '\System Desktop' & '\*.*', @DesktopCommonDir) DirMove($iniDir & '\User Desktop' & '\*.*', @DesktopDir) DirMove($iniDir & '\System Desktop' & '\*.*', @DesktopCommonDir) Local $handle = ControlGetHandle('Program Manager', '', 'SysListView321'), _ $cords, $cordsSplit _ListView_BeginUpdate ($handle) For $i = 0 To _ListView_GetItemCount ($handle) $name = _ListView_GetItemText ($handle, $i) $cords = IniRead($iniDir & '\' & $currentDesktop & '.ini', 'Last Positions', $name, 'Unknown') $cordsSplit = StringSplit($cords, '|') If $cords <> 'Unknown' Then _ListView_SetItemPosition32 ($handle, $i, $cordsSplit[1], $cordsSplit[2]) Else IniDelete($iniDir & '\' & $currentDesktop & '.ini', 'Last Positions', $name) EndIf Next _ListView_EndUpdate ($handle) EndFunc ;==>ShowDesktopIconsEDIT: Please take note that these two UDF work, but they haven't been thoroughly tested/adapted well. They are not ready to be published as regular UDFs on the Examples forum.EDIT: I have now solved the problem. Look here. Edited October 25, 2007 by MCP Link to comment Share on other sites More sharing options...
Achilles Posted October 25, 2007 Share Posted October 25, 2007 You could probably adapt something from my Multiple Desktops program... it's in my signature. However, if you don't want to look through the code I'll give you the basic idea. Save all the icon positions (there's a function for that in the Multiple Desktops code) I move all the files to a different directory That would be pretty much all you need. Restoring icons is done in my program too... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
MCP Posted October 25, 2007 Author Share Posted October 25, 2007 You could probably adapt something from my Multiple Desktops program... it's in my signature.However, if you don't want to look through the code I'll give you the basic idea.Save all the icon positions (there's a function for that in the Multiple Desktops code)I move all the files to a different directoryThat would be pretty much all you need. Restoring icons is done in my program too...Thank you, I am studying your code as usual.@others reading, I have got this link too.Thank you. I will go deep in the code of both. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 25, 2007 Moderators Share Posted October 25, 2007 (edited) Wouldn't ControlHide("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]") and then ControlShow("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]") Be easier? ... Hell, I don't even know if that would work. Edit: A better example, but still haven't tried it myself. Edited October 25, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MCP Posted October 25, 2007 Author Share Posted October 25, 2007 Wouldn't ControlHide("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]") and then ControlShow("[CLASS:WorkerW], "", "[CLASSNN:SysListView321]") Be easier? ... Hell, I don't even know if that would work. Edit: A better example, but still haven't tried it myself. Unfortunately it does not work, no action seems to be taken (but I am a newbie). Thanks for pointing out this approach too. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 25, 2007 Moderators Share Posted October 25, 2007 Unfortunately it does not work, no action seems to be taken (but I am a newbie). Thanks for pointing out this approach too.This worked:ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]") Sleep(5000) ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]") Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MCP Posted October 25, 2007 Author Share Posted October 25, 2007 This worked:ControlHide("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]") Sleep(5000) ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")Nice. Thank you. As usual! 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