Jump to content

Object referencing


Recommended Posts

Hello all.

I would first like to say that you all rock. Awesome code, techniques, and camaraderie in here. Nicest forum Ive seen in a while.

I have one question. I converted this wscript to .au3 but get an error.

Const MY_COMPUTER = &H11&

Set objNetwork = CreateObject("Wscript.Network")

objComputerName = objNetwork.ComputerName

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_COMPUTER)

Set objFolderItem = objFolder.Self

objFolderItem.Name = objComputerName

Converted code:

Const $MY_COMPUTER = "&H11&"
$objNetwork = ObjCreate("Wscript.Network")
$objComputerName = $objNetwork.ComputerName
$objShell = ObjCreate("Shell.Application")
$objFolder = $objShell.Namespace($MY_COMPUTER) 
$objFolderItem = $objFolder.Self    ; <--------------------------  Error here
$objFolderItem.Name = $objComputerName

The requested action with this object has failed.:

$objFolderItem = $objFolder.Self

$objFolderItem = $objFolder.Self^ ERROR

I've researched but found no help. lack of time requires me to break down and ask. i'm still learning about objects. So much to learn. ;):P I'm thinking of buying a book. :whistle:

Any direction or tips would be greatly appreciated. ;)

This part assumes you care.

I myself stopped coding 15 years ago to consult but recently contracted with a company to develop automated procedures for setting up remote computers for the purpose of remote service and maintenance. Its great to install software, hack the reg, and dig into windows with the ease of AutoIt. And honestly, I couldnt have done it without this forum (kept me from buying a book or two or learning VB all over again).

So thank you all.

My girlfriend sitting here wants to know if you feel the breeze? Upon my inquiry, her response was: ..you blowing smoke up their asses? LOL Such class!

Link to comment
Share on other sites

Hey Larry,

Thnx for all your help.

Is there a better way to do this? i'm sure you know where the error is. and yes, i'm using AConverter.au3 to get this. :">

Thx in advance.

$HKEY_CURRENT_USER = &H80000001

$strComputer = @ComputerName

$objReg = ObjGet("winmgmts:\\" & $strComputer & "\root\default:StdRegProv")

$strKeyPath = "SOFTWARE\Microsoft\Internet Explorer\Main"

$objReg.CreateKey ($HKEY_CURRENT_USER, $strKeyPath)

$ValueName = "Start Page"

$strValue = "about:blank"

$objReg.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $ValueName, $strValue)

Hello all.

Link to comment
Share on other sites

I've seen someone post information about error handling with COM objects but have since lost that information (oh the things I should have written down.. :"> )

Anyone know where it is? Perhaps a search pattern or two that would help unearth the beast?

“Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker

Link to comment
Share on other sites

actually, the search engine here sucks. but whos complaining!

I've seen someone post information about error handling with COM objects but have since lost that information (oh the things I should have written down.. :"> )

Anyone know where it is? Perhaps a search pattern or two that would help unearth the beast?

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...