Jump to content

COM Obj Error Handling


Recommended Posts

Hello again, i have a code that changes username to favorite, my problem is how to use ObjEvent() function to catch errors, i've red Help File and Forum's Topics but i can't understand too much😐

Here is a code (I've copied this codes from a user of AutoIt Forum):
 

$sOldUser = "Administrator"
$sNewUser = "Admin"
$oUser = ObjGet("WinNT://" & @ComputerName & "/" & $sOldUser & ",user")
$oComputer = ObjGet("WinNT://" & @ComputerName)
$oNewUser = $oComputer.MoveHere($oUser.ADsPath, $sNewUser)

Thanks for your care, I'm new to AutoIt and days should be passed with my coding and practicing to don't bother you :)❤

Link to comment
Share on other sites

Link to comment
Share on other sites

13 hours ago, Danyfirex said:

Did you check help file. 🤔

Hello @Danyfirex, yep!, as i told in topic's message, i've seen Help File but i didn't understand too much, i've red some topics and got some informations about handling errors but those examples were as a Functional Object (Func...EndFunc type) and i didn't understand.

Link to comment
Share on other sites

First step is to read the section about objects in the help file.

Then have a look at the Excel or Word UDF that come with AutoIt.
Then have a look at the MSDN pages for the Excel or Word object model.

Then check some example scripts in the forum like this.

Happy reading :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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

×
×
  • Create New...