[script] Desktop shortcuts script
#1
Posted 04 August 2006 - 03:10 PM
Here it is:
It uses an AutoIT script that runs after Explorer and creates the shortcuts, and refreshes the desktop.
It looks for a file called "shortcut.inf" in i386\system32. It reads what shortcuts are to be created from there.
The syntax of the shortcut.inf file is this:
On each line, there is a string like this:
nr,str1,str2
nr is: 1 for creating a shortcut, and 2 for creating a folder
str1 is the source exe for the shortcut, or the name of the folder to be created
str2 is the destination of the shortcut (it is not used if creating a folder)
There are 4 "!" commands
!DE - the desktop folder
!WD - the WinDir (X:\I386)
!SM - the path to start\programs
!PE - the PE Drive (X:)
Examples:
This line makes a shortcut to cmd.exe on the desktop:
1,!WD\system32\cmd.exe,!DE\Command Prompt
These 2 lines create a folder on the desktop, and places a shortcut of cmd.exe there
2,!DE\Tools
1,!WD\system32\cmd.exe,!DE\Tools\Command Prompt
To better illustrate this, I have modified the taskman and regedit scripts to add shortcuts. They are attached here also.
Known problems:
You CAN make shortcuts in the start menu using this tool, BUT Explorer does NOT refresh automatically (don't know why, working on it...). So the shortcuts get created, but start\programs shows (empty). If anyone knows how to make Explorer refresh automatically, PLEASE let me know
Problems, bugs, suggestions, post them here.
#2
Posted 04 August 2006 - 05:59 PM
Known problems:
You CAN make shortcuts in the start menu using this tool, BUT Explorer does NOT refresh automatically (don't know why, working on it...). So the shortcuts get created, but start\programs shows (empty). If anyone knows how to make Explorer refresh automatically, PLEASE let me know
You could maybe kill Explorer and then reload it with an AutoIt script? I know it's not a good solution, and it wouldn't be a permanent fix, but it might work.
#3
Posted 04 August 2006 - 07:10 PM
#4
Posted 04 August 2006 - 07:41 PM
Sorry for not giving feedback for these new scripts yet, I'm still working on 049, but I'll be giving news as soon as I start adding them in the next release..
Keep it up!
#5
Posted 05 August 2006 - 04:31 PM
You could maybe kill Explorer and then reload it with an AutoIt script? I know it's not a good solution, and it wouldn't be a permanent fix, but it might work.
I don't think that killing explorer is a good solution because its the shell and this will make the pc to restart
#6
Posted 06 August 2006 - 06:18 PM
It's not the refresh problem that's the cause of the start menu not working...
It was 2 registry keys.
Start menu shortcuts will work if you use my new explorer script (v 005)
But the refresh problem still persists.
I'll see if it can be fixed
#7
Posted 07 August 2006 - 01:40 PM
http://www.nirsoft.n...ils/nircmd.html
Creates a shortcut to Windows Calculator:
nircmd.exe shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator"
Haven't tested using nircmd directly in a .SCRIPT, but it's got some pretty nice scripting features.
There's actually a TON of NirSoft utilities and such that are freeware that are great tools for probably any PE build listed here:
http://www.nirsoft.n...tils/index.html
One of them, NirExt, is about 38 kb in size and adds the ability to make custom shortcuts, custom folders, and an "advanced run" feature so you can pass arguments to a commandline app from GUI:
http://www.nirsoft.n...ils/nirext.html
#9
Posted 07 August 2006 - 04:20 PM
#10
Posted 07 August 2006 - 06:32 PM
\Projects\Standard\Tweaks
I let it Replace any scripts that where there.
#11
Posted 07 August 2006 - 06:37 PM
Which of the above Scripts actually makes the Shortcuts.
And how could a person include there own. For developers.
What I was thinking is that the shortcut.script.zip is the one that handles the shortcut creation and is needed to create them. And the actual command to create what shortcuts are within the
Taskman.script.zip and regedit.script.zip themselves.
If the creation of the shortcuts are withing the Taskman.script.zip and regedit.script.zip then it would be best to have the user have the choice to create a Desktop, Start Menu, Quicklaunch Shortcut or any other options I have forgotten. Instead of just forcing shortcuts on the user. Similiar to the tick item options within present scripts.
#12
Posted 08 August 2006 - 11:52 AM
the command to create what shortcuts are in the taskman and regedit scripts
To make taskman create a shortcut, you need to add these 2 lines in the script:
If,NotExistFile,"%TargetDir%\i386\system32\shortcut.inf",FileCreateBlank,"%TargetDir%\i386\system32\shortcut.inf" TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,!WD\system32\taskmgr.exe,!DE\Windows Task Manager","Append" TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,!WD\system32\taskmgr.exe,!SM\Windows Task Manager","Append"
#13
Posted 18 August 2006 - 10:55 AM
I have a directory "B:\ProfilesDir\Default User\Start Menu\Programs" which contains the shortcuts.
But when I click Start > Programme I get the submenu "Leer" (means empty)
Maybe there is another question of internalization.
Peter
#14
Posted 18 August 2006 - 12:19 PM
In my installation (XP German) the shortcut works mit desktop but not with start menu.
I have a directory "B:\ProfilesDir\Default User\Start Menu\Programs" which contains the shortcuts.
But when I click Start > Programme I get the submenu "Leer" (means empty)
Maybe there is another question of internalization.
Peter
I had the same problems with you but this was solved when a made this script to fix the wrong paths in profiles folder
#15
Posted 18 August 2006 - 01:02 PM
I had the same problems with you but this was solved when a made this script to fix the wrong paths in profiles folder
That was just what I thought.
When building my Localization script I found that in any HIVE???.INF file.
I'll include it into my Localization script.
Peter
#16
Posted 31 August 2006 - 03:11 PM
Change the line-split-character in the script to "|" so we can also commandline parameters which includes a ",", like i.e. "explorer.exe /e,%ramdrv%"
Also to specify the icon number is sometimes good.
The new "shortcut.inf" would look like:
1|!WD\explorer.exe|!DE\Explorer|/e,%RAMDRV%\|4
So it will create a link "Explorer.lnk" on the desktop with the parameters "/e,%RAMDRV%" and the icon number 4.
And maybe for future use you could implement the Quicklaunch-folder like:
... $pedrive=StringLeft($windir,1)&":";detect PEdrive -> $qlaunch=@AppDataDir&"\Microsoft\Internet Explorer\Quick Launch" -> If Not FileExists($qlaunch) Then DirCreate($qlaunch); should created before using Opt("WinTitleMatchMode",4) ... $line=StringReplace($line,"!DE",$deskt);replace !DE with Desktop -> $line=StringReplace($line,"!QL",$qlaunch);replace !DE with QuickLaunch $arr=StringSplit($line,"|");split the 2 - 4 parts of the line into an array ...What do you think?
Thanks
Holger
#17
Posted 31 August 2006 - 03:29 PM
#18
Posted 31 August 2006 - 03:34 PM
#19
Posted 31 August 2006 - 03:48 PM
Just create at first the folder and after that the shortcut, like:
... 2,%UserProfile%\Desktop\Tools 1,!WD\system32\notepad.exe,!DE\Tools\Notepad 2,%UserProfile%\Start Menu\Tools 1,!WD\system32\notepad.exe,!SM\Tools\Notepad ...
Hmmm...ok, with environment variables it doesn't work this way...
Edit: I think we should the "Autoit3.exe" update to the new version "3.2.0.1" cause this allows you to expand also filereading-strings with "Opt("ExpandEnvStrings",1)" which does not function like this in the old "3.1.1"-version.
#20
Posted 31 August 2006 - 04:16 PM
@smiley: this should be already possible.
Just create at first the folder and after that the shortcut, like:... 2,%UserProfile%\Desktop\Tools 1,!WD\system32\notepad.exe,!DE\Tools\Notepad 2,%UserProfile%\Start Menu\Tools 1,!WD\system32\notepad.exe,!SM\Tools\Notepad ...
Hmmm...ok, with environment variables it doesn't work this way...
Edit: I think we should the "Autoit3.exe" update to the new version "3.2.0.1" cause this allows you to expand also filereading-strings with "Opt("ExpandEnvStrings",1)" which does not function like this in the old "3.1.1"-version.
why not doing this:
... 2,!DE\Tools 1,!WD\system32\notepad.exe,!DE\Tools\Notepad 2,!SM\Tools 1,!WD\system32\notepad.exe,!SM\Tools\Notepad ...
#21
Posted 31 August 2006 - 04:25 PM
#22
Posted 01 September 2006 - 01:56 PM
That is very difficult to manage.
There are some API-commands I tried to save/create and restore the quicklaunch-toolbar - no luck
However, I changed the "shc.au3"-script so far that you can use also a comma and a different iconfile/iconnumber (not so difficult you know )
#notrayicon $file=FileOpen ( @WindowsDir&"\system32\shortcut.inf", 0);open the file If($file=-1)Then Exit;if it does not exist, exit $windir=@WindowsDir;detect WinDir $smprog=@ProgramsDir;detect Start\programs $deskt=@DesktopDir;detect desktopdir $pedrive=StringLeft($windir,1)&":";detect PEdrive Opt("WinTitleMatchMode",4) WinWait("classname=Shell_TrayWnd");wait until the taskbar appears While(1) $line=FileReadLine($file);read a line from the file If(@error=-1)Then ExitLoop;if end of file, then exit $line=StringReplace($line,"!WD",$windir);replace !WD with WinDir $line=StringReplace($line,"!SM",$smprog);replace !SM with Start\programs $line=StringReplace($line,"!PE",$pedrive);replace !PE with PEDrive $line=StringReplace($line,"!DE",$deskt);replace !DE with Desktop $arr=StringSplit($line,",");split the 2 - 6 parts of the line into an array If $arr[1]=1 Then $param="" $iconfile="" $icon=0 If $arr[0]>=4 Then $param=$arr[4] If StringInStr($param,"|") Then $param=StringReplace($param,"|",",") If $arr[0]>=5 Then $iconfile=$arr[5] If $iconfile="" Then $iconfile=$arr[2] If $arr[0]>=6 Then $icon=$arr[6] FileCreateShortcut($arr[2],$arr[3],"",$param,"",$iconfile,"",$icon);if line says to create a shortcut, create it EndIf If $arr[1]=2 Then DirCreate($arr[2]);if line says to make a dir, make it WEnd FileClose($file);close the file WinActivate("classname=Progman");set focus to the desktop Send("{F5}");refresh the desktop
The shortcut.inf could then look like:
1,!WD\system32\notepad.exe,!DE\Notepad 1,!WD\system32\notepad.exe,!SM\Notepad 1,!WD\system32\regedit.exe,!DE\Windows Registry Editor 1,!WD\system32\regedit.exe,!SM\Windows Registry Editor 1,!WD\system32\taskmgr.exe,!DE\Windows Task Manager 1,!WD\system32\taskmgr.exe,!SM\Windows Task Manager 1,!WD\explorer.exe,!DE\Explorer,/e|%RAMDRV%\,%SystemRoot%\system32\shell32.dll,45 1,!WD\system32\notepad.exe,!QL\Editor
One scriptline should then looks like:
TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,!WD\explorer.exe,!DE\Explorer,/e|%RAMDRV%\,shell32.dll,45","Append"Thisone creates a shortcut to "%WindowsDir%\Explorer.exe" with name "Explorer", the cmdline argument "/e,%RAMDRV%\" with the icon "45" from the "shell32.dll".
Edit: forgot that it is not easy to write "#$c" to a txtfile - changed it to "|".
So long
#23
Posted 03 September 2006 - 03:23 PM
Good work everybody!
QuickLaunch doesn't work yet beacause of resource limitations.
When it does, I'll add QuickLaunch support
#24
Posted 03 September 2006 - 03:26 PM
#25
Posted 05 September 2006 - 06:30 PM
Yeah, it's difficult to manageForget it with the "QuickLaunch" so far.
That is very difficult to manage.
That's why I couldn't rest until I got it to work.
QuickLaunch works.
You can create shortcuts with parameters(even commas), icons, hotkeys, initial states(norm,min,max), working directories in QuickLaunch too (!QL)
And Windows Picture and fax viewer works
All in my new scripts
Get them at ove.boot-land.net
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users