Jump to content

Rename "My Computer" icon label


Recommended Posts

I'm trying to write a script that will change the label on the desktop computer icon to the computer name. The following vbs script works and i'm trying to convert it to autoit.

---VBS---

Dim objShell

Dim objFolder

Dim objFolderItem

Const MY_COMPUTER = &H11&

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_COMPUTER)

Set objFolderItem = objFolder.Self

objFolderItem.Name = "test"

---VBS---

I've researched and tried the following autoit script but it does not work on windows 7 because of registry permissions (?)

RegWrite ("HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "LocalizedString", "REG_SZ", "test")

Can anyone help me convert the VBS script to AutoIT?

Thanks in advance

Link to comment
Share on other sites

It's simple as we can use objects too :x All you need to do is change the syntax slightly.

Global Const $MY_COMPUTER = 0x11

Local $objShell = ObjCreate("Shell.Application")
Local $objFolder = $objShell.Namespace($MY_COMPUTER)
Local $objFolderItem = $objFolder.Self
$objFolderItem.Name = "Test Computer"

Is there a place i can look at that will tell me all the methods available for an object?

Another-words, how do I know i can use .Self as a method for the above object?

This is probably a basic question so thanks for your patience.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...