Help - Search - Members - Calendar
Full Version: Save & Restore Positions Of Icons
The CD Forum > Bart's PE Builder > Plugins
da_buschi
Since I didn't like the way XPE arranges the icons on the desktop, I searched for a solution to save the position of icons after I arranged them the way I want. I found a little freeware tool named SR_ICONS. You can download the program here. You'll need PSKILL and SLEEP in order to get this plugin running.
Here is my quick and dirty plugin for this tool (feedback appreciated):

sr_icons.inf:
CODE
; ----------------------------------------
; PE Builder v3 plugin INF file
; Created by da_buschi
;
; Save and Restore Icon Positions
; ----------------------------------------

[Version]
Signature= "$Windows NT$"

[PEBuilder]
Name="Save & Restore Icons"
Enable=1

[WinntDirectories]
a="programs\sr_icons",2

[SourceDisksFiles]
files\sr_icons.exe=a,,1
files\sr_icons.cmd=a,,1
files\sr_icons2.cmd=a,,1
;files\1024-768=a,,1
files\pskill.exe=a,,1
files\sleep.exe=a,,1

[Software.AddReg]
; add to Start Menu\Programs (XPE)
0x2, "Sherpya\XPEinit\Programs", "Save & Restore Icon Position\Save New Layout", "%SystemDrive%\programs\sr_icons\sr_icons2.cmd||%SystemDrive%\programs\sr_icons\sr_icons.exe"
0x2, "Sherpya\XPEinit\Programs", "Save & Restore Icon Position\Restore Icons", "%SystemDrive%\programs\sr_icons\sr_icons.exe"


sr_icons.cmd:
QUOTE
@echo off

%systemdrive%
cd \programs\sr_icons

start /min sr_icons.exe
sleep 1
pskill sr_icons.exe
sr_icons2.cmd
QUOTE
@echo off
rem -------------------------------------------------------------------------
rem Script to start Save and Restore Icons
rem -------------------------------------------------------------------------
echo sr_icons.cmd: Starting...
setlocal
if "%temp%" == "" goto _err
if exist "%temp%\sr_icons\sr_icons.exe" goto _run

echo Copying "%~dp0*.*" to "%temp%\sr_icons\"
xcopy /s "%~dp0*.*" "%temp%\sr_icons\"

:_run
%temp%
cd \sr_icons
if exist 640-480 del 640-480
if exist 800-600 del 800-600
if exist 1024-768 del 1024-768
if exist 1280-1024 del 1280-1024
start sr_icons.exe
Echo.
Echo.
Echo Please copy the newly generated layout-file (640-480, 800-600, 1024-768, 1280-1024)
Echo from %temp%\RS_ICONS into the files-directory of your SR_ICONS plugin.
Echo Do not forget to modify sr_icons.inf accordingly!!
Echo.
Echo Press any key to remove RS_ICONS from memory...
pause
pskill sr_icons.exe

goto _end

:_err
echo.
echo No temp variable set...
echo Try adding a ramdrive...
echo.
pause.
:_end
endlocal


How it works:

SR_ICONS saves the position of icons in a file that has the current screen resolution as its filename, e.g. 1024-768 (no extension). Since this file has to be created by sr_icons first, I commented it out in sr_icons.inf. After booting the system select Save New Layout and SR_ICONS will create this file in %temp%\sr_icons . Copy that file from there into the files direcctory of your sr_icons plugin and change the .inf accordingly. After the next run of PEBuilder you can restore the position of your icons by selecting Restore Icons.
I did not put a shortcut in the startup folder because there is a timing problem with BGINFO. If SR_ICONS is started before BGINFO has finished it's work, the icons will be set back to their initial positions. Therefore I decided to add a line in BGINFO.CMD :
QUOTE
@echo off
%~d0
cd "%~dp0"
bginfo.exe bginfo.bgi /timer:0
call %systemdrive%\programs\sr_icons\sr_icons.cmd

This way I made sure that BGINFO is ready before SR_ICONS is started.

One remark: I realized that my system became unstable when I left SR_ICONS in memory (it's an TSR). That is the reason why the process is automatically killed with PSKILL about one second after it was started.

Greetz,
da_buschi
MrXP
Has anyonw found this to work? Or is there cleaner better way?
madmarty
Check this topic http://www.911cd.net/forums/index.php?show...=9748&hl=bginfo. All the way at the bottom is the solution. This one works for me.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.