Jump to content

Recommended Posts

Posted

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

Posted

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

 

SET fso = Wscript.CreateObject("Scripting.FileSystemObject")
SET WshShell = WScript.CreateObject("WScript.Shell")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")
strDsk = WshShell.SpecialFolders("[url="http://www.tek-tips.com/viewthread.cfm?qid=1235645&page=7#"]Desktop[/url]")
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

  • Thanks 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...