+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, script to change icons in Coding and Web Development; Morning all!! one of the teachers here has had an idea... they would like to change the icon on a ...
  1. #1
    Admiral208's Avatar
    Join Date
    Mar 2008
    Location
    Bridgwater
    Posts
    720
    Thank Post
    176
    Thanked 63 Times in 55 Posts
    Rep Power
    40

    Question 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

  2. #2

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,807
    Thank Post
    3,320
    Thanked 1,056 Times in 977 Posts
    Rep Power
    365
    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

  3. Thanks to mac_shinobi from:

    Admiral208 (16th March 2011)

  4. #3
    Admiral208's Avatar
    Join Date
    Mar 2008
    Location
    Bridgwater
    Posts
    720
    Thank Post
    176
    Thanked 63 Times in 55 Posts
    Rep Power
    40
    what im thinking is having two .ico files, rather than a .dll with icons. Does that make it easier??

SHARE:
+ Post New Thread

Similar Threads

  1. Desktop Icons script help
    By tommccann in forum Scripts
    Replies: 5
    Last Post: 15th June 2011, 02:36 PM
  2. script to change password
    By Birkhall in forum Scripts
    Replies: 2
    Last Post: 16th February 2011, 01:16 PM
  3. Replies: 0
    Last Post: 22nd April 2010, 10:08 PM
  4. Change a file name to something else by script
    By andy_nic in forum Scripts
    Replies: 11
    Last Post: 28th January 2010, 11:57 AM
  5. Script to change folder permissions
    By scottyses in forum General Chat
    Replies: 1
    Last Post: 15th January 2008, 08:52 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •