Sign in to follow this  
Followers 0
bigdwhite

Object referencing

8 posts in this topic

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!

Share this post


Link to post
Share on other sites



Awesome. Thank you very much!!

do you have or know of a site that could have answered that. a suggested book maybe?

to start

$MY_COMPUTER = 0x11

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Take a look at the ObjEvent page in the helpfile for handling COM errors.

ObjEvent ( "AutoIt.Error" [, "function name"])

Especially the example that shows a function acting as the error handlier being called.

:whistle:

Share this post


Link to post
Share on other sites

thanks guys. sarcasm and all. :whistle:

thats the info i've been looking for.

now that you've pointd me in the right direction, i won't have bother you with trivial request. right thephuxster ? oh sorry, no spell check here. ;))

Share this post


Link to post
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?

Share this post


Link to post
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
Sign in to follow this  
Followers 0