-
script to change icons
Morning all!!
one of the teachers here has had an idea...
they would like to change the icon on a document when its been marked. there would be two icons. one for "marked and needs changes" and another for "marked and is completed" (the icons would be a cross and a tick for example).
Instead of right clicking, properties, change icon, etc etc... is there a way to run a script that will change the icon when run.
What I woud like ideally is the document can be dragged onto the script file and the icon change??
Im sure some of you clever people can do this... but I can't!
tia
James
-
You would also need
1. The vbs code to get the path to the original document so that it applies the icon change to the said document instead of creating a new link
2. Have a dll that contains the relevant icons so in the vbs you could call icon 0, 1, 2 or what ever icon you want applied
Code snippet below is in vbs should give you a rough idea but will need some work doing to it assuming it will support what you are trying to do.
VBScript - Adding an icon to a shortcut
Code:
SET fso = Wscript.CreateObject("Scripting.FileSystemObject")
SET WshShell = WScript.CreateObject("WScript.Shell")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
strDsk = WshShell.SpecialFolders("Desktop")
strshortcut = strDsk & "\Calculator.lnk"
If Not fso.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = Windir & "\System32\Calc.EXE"
oUrlLink.IconLocation = Windir & "\System32\moricons.dll,6"
oUrlLink.Save
End If
Although this is more for a shortcut then an existing document - will look into this further unless someone has a better idea
-
what im thinking is having two .ico files, rather than a .dll with icons. Does that make it easier??