
Press
Members-
Posts
15 -
Joined
-
Last visited
Everything posted by Press
-
Hi @BigDaddyO, Tried as you suggested, by selecting the an item in the list by using arrow keys and highlighting it. Then used the spy to see whether the text field shows the value. But it doesn't and hence the ControlGetText returns null value Send("{DOWN}") ConsoleWrite("Select board Plan" & @CRLF) Sleep($SleepBig) $hWindow = WinGetHandle($TitleBBTSMain, "") $hWnd = ControlGetHandle($hWindow, "", "[CLASS:TVirtualStringTree; INSTANCE:2]") ConsoleWrite("$hWnd " & $hWnd & @CRLF) $Text = ControlGetText($hWindow, "", "$hWnd") ConsoleWrite("$Text " & $Text & @CRLF) o/p $hListView 0x00120268$Text
-
Hi @Nine Tried as you suggested with the below code considering it as ListView , but no luck. The script doesn't throw any error but didn't do any action $hWindow = WinGetHandle($TitleBBTSMain, "") $hListView = ControlGetHandle($hWindow, "", "[CLASS:TVirtualStringTree; INSTANCE:2]") ConsoleWrite("$hListView " & $hListView & @CRLF) $iItemCnt = _GUICtrlListView_GetItemCount($hListView) ConsoleWrite("$iItemCnt " & $iItemCnt & @CRLF) For $i = 0 To $iItemCnt Step +1 $test= _GUICtrlListView_GetItem($hListView,$i) if ($test[3] = $parameterBoardPlan) Then _GUICtrlListView_ClickItem($hListView,$i) EndIf Next o/p: $hListView 0x00120268 $iItemCnt 0
-
Hi @FrancescoDiMuro Thanks for the reply, yes the control handle returns value like this $hWindow = WinGetHandle($TitleBBTSMain, "") $hWnd = ControlGetHandle($hWindow, "", "[CLASS:TVirtualStringTree; INSTANCE:2]") ConsoleWrite("$hWnd " & $hWnd & @CRLF) $iItemCnt = _GUICtrlTreeView_GetCount($hWnd) ConsoleWrite("$iItemCnt " & $iItemCnt & @CRLF) $searchText = "bs bp 1 -no restrictions" $hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True) ConsoleWrite("$hItemFound " & $hItemFound & @CRLF) While $hItemFound _GUICtrlTreeView_SelectItem($hWnd, $hItemFound) _GUICtrlTreeView_ClickItem($hWnd, $hItemFound) $next = _GUICtrlTreeView_GetNextVisible($hWnd, $hItemFound) $hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True, $next) Sleep($SleepBig) WEnd o/p : $hWnd 0x00610450 $iItemCnt 0 $hItemFound 0
-
Hi I am new to AutoIT and I have a scenario in delphi application to interact with a list of items in a list named "Available" and select a particular one and move it to another list named "Current". On initial look it seemed to be a ListView control but on using the Window info it seems to both controls are VirtualStringTree . Tried the below code to find and select a particular item from the Treeview but I couldn't. The script doesn't throw any error when ran but doesn't perform any action $hWindow = WinGetHandle($TitleBBTSMain, "") $hWnd = ControlGetHandle($hWindow, "", "[CLASS:TVirtualStringTree; INSTANCE:2]") $iItemCnt = _GUICtrlTreeView_GetCount($hWnd) ConsoleWrite("$iItemCnt " & $iItemCnt & @CRLF) $searchText = "bs bp 1 -no restrictions" $hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True) ConsoleWrite("$hItemFound " & $hItemFound & @CRLF) While $hItemFound _GUICtrlTreeView_SelectItem($hWnd, $hItemFound) _GUICtrlTreeView_ClickItem($hWnd, $hItemFound) $next = _GUICtrlTreeView_GetNextVisible($hWnd, $hItemFound) $hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True, $next) Sleep(5000) WEnd o/p : $iItemCnt 0 $hItemFound 0 Note that there is no default selection of the item inside the treelist and the itemcount was also returned as zero. Both SelectItem and ClickItem doesn't work either. The instances for both "Available" and "Current" list doesn't change during runtime and remains constant. Both application and AutoIT are 32bit. Is there any way to select a particular item from the list and move them to the next
-
Smtp Mailer That Supports Html And Attachments.
Press replied to Jos's topic in AutoIt Example Scripts
TheXman, Sorry I tried that too earlier by mentioning the username with qualifier as $Username = "pradeep.haridoss@companyXX.com" , forgot to mention it . No luck , It returns the same error. ### COM Error ! Number: 80020009 ScriptLine: 396 Description:The server rejected the sender address. The server response was: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [BL0PR05CA0026.namprd05.prod.outlook.com] May be i should check on the authentication /configuration part possibly as per your suggestion. Thanks a lot for confirming its not an Autoit issue anymore. I was really having hard time to double check that. Appreciate it. Any other suggestion on the authentication part if someone has encountered something similar worth sharing would be much helpful. Thanks -
Smtp Mailer That Supports Html And Attachments.
Press replied to Jos's topic in AutoIt Example Scripts
Hi TheXman, Thank you for your quick response and helping me out i did search initially in the forum for answers but couldn't find it out. Am i new learner to autoit and the forum As per the post i did try changing the line to TLS instead of SSL $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendtls") = True ### COM Error ! Number: 80020009 ScriptLine: 396 Description:The server rejected the sender address. The server response was: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [BL0PR05CA0026.namprd05.prod.outlook.com] Now the above error is thrown by the server response as 530 requesting for authentication. Used Port for TLS : 587 Any suggestions ? -
Smtp Mailer That Supports Html And Attachments.
Press replied to Jos's topic in AutoIt Example Scripts
Hi Jos, I used your udf to send email of the results generated. The SMTP server is my office outlook and i have entered the inputs just as mentioned in udf but i get COM Error ! Number: 80020009 ScriptLine: 394 Description:The transport failed to connect to the server. Assume the From .To , Username and Password are valid. Tried with all possible ports - 25, 587 , 465 with SSL enabled and Disabled but none of them worked. Spent sometime to search through the forum for answers but i was kind of lost to find any clue . My guess is to make it work, TLS should be enabled. Is there anything we should include in script to make TLS enabled ? Honestly i am not sure. I am sure the UDF works for many people perfectly, but any clue in resolving my issue would be much helpful. Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $SmtpServer = "smtp.office365.com" ; address for the smtp-server to use - REQUIRED $FromName = "Auto Test - AutoIT Workstation" ; name from who the email was sent $FromAddress = "pradeep.haridoss@companyXX.com" ; address from where the mail should come $ToAddress = "karthik.anandakumar@companyXX.com" ;destination address of the email - REQUIRED $Subject = "" ; subject from the email - can be anything you want it to be $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Low" ; Send message priority: "High", "Normal", "Low" $Username = "pradeep.haridoss" ; username for the account used from where the mail gets sent $Password = "########" ; password for the account used from where the mail gets sent ;$IPPort = 587 ; port used for sending the mail IPPort = 25 ;$ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS ;$IPPort=465 ; GMAIL port used for sending the mail $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS ;Attachmets $FilesTOAttach = "" ;Help variable with files to attach $Path = @ScriptDir & "\Results" ;Path to Results $StartTime = StringReplace(_NowCalcDate ( ),"/","") & StringReplace(_NowTime (4),":","") $MaxSize = 16 ;Max size of attachments (in MB) ;UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username="", $s_Password="", $IPPort="25", $ssl = 1) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" EndFunc ;==>_INetSmtpMailCom Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc ;Checking valid email address Func _IsValidEmail($email) If stringregexp($email,'^[\_]*([a-z0-9]+(\.|\_*)?)+@([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$',0) = 1 Then Return 1 Else Return "Invalid email address" EndIf EndFunc -
Capturing state of Checkbox using GetPixelColor
Press replied to Press's topic in AutoIt General Help and Support
Hi Nine, I Tried adding the line Opt("PixelCoordMode", ) in CheckCheckbox Function and gave a run Trial 1 - set Opt("PixelCoordMode", 1) returns same color value - 15790320 [ greyish for all checkboxes even if checked or unchecked] Trial 2 - set Opt("PixelCoordMode", 0) returns color value as shown below Period 1 mt checkbox - Color value : 16777215 [ white as expected since its unchecked] Coordinates $x value : 295 $y Value : 490 Period 2 mt checkbox - Color value : 15790320 [ greyish as expected since its checked] Coordinates $x value : 295 $y Value : 503 Period 3 mt checkbox - Color value : 15658734 [ greyish as expected since its checked] Coordinates $x value : 295 $y Value : 516 Period 4/ 5 mt and Sick Tray / Standard checkboxes - Color value : 16777215 [ white not expected since its checked] Tried as per your suggestion to locate the coordinates through au3info and seems the coordinates for all checkboxes used were correct but still the script fails due to mismatch value in color code returned by Coordinates located by au3info for Period 1 mt checkbox is shown below The color always point as 0xFFFFFF for all checkboxes but PixelGetColor returns diff values using opt PixelCoordMode 0 or 1 values for the same coordinates -
Capturing state of Checkbox using GetPixelColor
Press replied to Press's topic in AutoIt General Help and Support
Hi Nine, Thanks a lot for your response. Bear with my question as i a new. Can you explain a little bit on how to set Opt("PixelCoordMode", 1) set in Script ? If i add the above line in CheckCheckBox function , then run the script, how to use au3info.exe tool mouse tab to find the coordinates? or its something that i need to set in au3info.exe tool options menu and open the application to figure out the mouse coordinates? -
I am new to autoit, Need help in debugging the code written by another QA to understand and make it work as expected The code tries to find the state of checkbox inside a listbox control named "Board Meal type allowed" (Attached screenshot) and return output accordingly. The listbox has 2 checkboxes Period 1mt and period 2mt. The checkbox controls cannot be identifed directly and a function Checkcheckbox is written to identify the checkbox color using coordinates to identify the position and its Pixel Color. Inside the function, the postion of the listbox is captured in $bPos and position of the checkbox is captured in $aPos variable $x variable adds x cordinates of $aPos and $bPos and + 7 to it $Y variable adds y cordinates of $aPos and $bPos and + 10 to it Finally PixelGetColor($X,$Y) is fetched and its value is compared with decimal value 16777215 to identify the checkbox state Since i am new i have tough time understanding below points in the code 1. Can anybody help in understanding the logic on how $x and $y variable is arrived and what possibly the reason value 7 and 10 are added before using PixelGetColor in CheckCheckBoxFunction 2. is there anyway i can get the coordinates using AutoIt window info from sciTE so that i can confirm the PixelGetColor($X,$Y) exactly points to the checkbox 3. The code always returns value PixelGetColor as 15790320 no matter the checkbox is checked or unchecked causing the script to return value "[CheckPosOptionGene"ralPosOptions] Board Meal Type - "& $parameterFieldValue &" not as expected is it because the PixelGetColor($X,$Y) is pointing to someother place rather than the checkbox element. I am kind of stuck here and any clue on above 3 points would be much helpful Func CheckPosOptionGeneralPosOptions($parameterFieldName, $parameterFieldValue, $parameterFieldValueTwo) $Result = 1 Switch $parameterFieldName Case "Board Meal Type Allowed" $handle = ControlGetHandle($TitleBBTSMain,"","[CLASS:TCheckListBox; INSTANCE:1]") ConsoleWrite("Board Meal Type Allowed - ControlGetHandle value : " & $handle & @CRLF) $Check = CheckCheckBoxList($handle,$parameterFieldValue) ConsoleWrite("Board Meal Type Allowed -parameterFieldValue variable value : " & $parameterFieldValue & @CRLF) ConsoleWrite("Board Meal Type Allowed -CheckCheckBoxList value : " & $Check & @CRLF & @CRLF) If $Check <> $parameterFieldValue2 Then Return "[CheckPosOptionGeneralPosOptions] Board Meal Type - "& $parameterFieldValue &" Checkbox state not as expected" EndIf Sleep($SleepSmall) ControlClick($TitleBBTSMain,"","[CLASS:TbbDBEdit; INSTANCE:1]") Sleep($SleepSmall) Send("^a") Sleep($SleepSmall) Send("10000") Case Else Return "-EditPosAccountManagementCenter Field for changing not found" EndSwitch Return $Result EndFunc ;==>EditPosAccountManagementCenter Func CheckCheckBoxList($handle,$parameterItemName) $Select = _GUICtrlListBox_FindString($handle,$parameterItemName) If $Select < 0 Then Return "'" & $parameterItemName & "' not found in CheckBoxList" EndIf _GUICtrlListBox_SelectString($handle,$parameterItemName) $aPos = _GUICtrlListBox_GetItemRect($handle,$Select) $bPos = WinGetPos($handle) ConsoleWrite("$aPos[0] value : " & $aPos[0] & @CRLF & "$bPos[0] Value : " & $bPos[0] & @CRLF) ConsoleWrite("$aPos[1] value : " & $aPos[1] & @CRLF & "$bPos[1] Value : " & $bPos[1] & @CRLF) $X = $bPos[0] + $aPos[0]+7 $Y= $bPos[1] + $aPos[1]+10 ConsoleWrite("$x value : " & $X & @CRLF & "$y Value : " & $Y & @CRLF) $Color = PixelGetColor($X,$Y) ConsoleWrite("$Color value : " & $Color & @CRLF) If $Color <> 16777215 Then Return 1 Else Return 0 EndIf EndFunc $test = CheckPosOptionGeneralPosOptions("Board Meal Type Allowed","Period 1 mt",0) ConsoleWrite("$test:" & $test & @CRLF ) $test2 = CheckPosOptionGeneralPosOptions("Board Meal Type Allowed","Period 2 mt",1) ConsoleWrite("$test2:" & $test2 & @CRLF ) Output of the above code Board Meal Type Allowed - ControlGetHandle value : 0x006804D4 $aPos[0] value : 0 $bPos[0] Value : 288 $aPos[1] value : 0 $bPos[1] Value : 480 $x value : 295 $y Value : 490 $Color value : 15790320 Board Meal Type Allowed -parameterFieldValue variable value : period 1 mt Board Meal Type Allowed -CheckCheckBoxList value : 1 $test : CheckPosOptionGeneralPosOptions] Board Meal Type - Period 1 mt Checkbox state not as expected Board Meal Type Allowed - ControlGetHandle value : 0x006804D4 $aPos[0] value : 0 $bPos[0] Value : 288 $aPos[1] value : 13 $bPos[1] Value : 480 $x value : 295 $y Value : 503 $Color value : 15790320 Board Meal Type Allowed -parameterFieldValue variable value : period 2 mt Board Meal Type Allowed -CheckCheckBoxList value : 1 $test2 : [CheckPosOptionGeneralPosOptions] Board Meal Type - Period 2 mt Checkbox state not as expected Expected output $test : 0 $test2 : 1
-
Return statement doesn't exit a function - Need Help
Press replied to Press's topic in AutoIt General Help and Support
This is reposted in AutoIT General Help & Support Forum. This post can be deleted. Apologize for the inconvenience. -
Return statement doesn't exit a function - Need Help
Press replied to Press's topic in AutoIt General Help and Support
Hi i am new to Autoit. i wrote the below code and tried executing it. Script moves to first switch case as expected and the If condition is satisfied. Hence the return value for $test is set as "EditPosAccountManagementCenter 'Accept Cash' is not set" but still the code continues to execute inside the case and the $parameterFieldValue "99998" is set in the text box in application. Can anyone help why this happens? Func EditPosAccountManagementCenter($parameterFieldName, $parameterFieldValue, $parameterFieldValueTwo) $Result = 1 Switch $parameterFieldName Case "Disable Bill collector when bills collected reaches" If ControlGetHandle("BBTSMain", "Accept Cash", "[CLASS:TCheckBox; INSTANCE:2]") <> 1 Then Return "EditPosAccountManagementCenter 'Accept Cash' is not set" EndIf Sleep($SleepSmall) ControlClick("BBTSMain", "", "[CLASS:TbbDBEdit; INSTANCE:1]") Sleep($SleepSmall) Send("^a") Sleep($SleepSmall) Send($parameterFieldValue) Case "Account Management Center Configuration" If $parameterFieldValue = "Default" Or $parameterFieldValue == "Default" Then ControlClick("BBTSMain", "Use default settings", "[CLASS:TRadioButton; INSTANCE:4]") Else If $parameterFieldValue = "Custom" Or $parameterFieldValue == "Custom" Then ControlClick("BBTSMain", "Use custom settings", "[CLASS:TRadioButton; INSTANCE:3]") Else $Result = "EditPosAccountManagementCenter Unknown option of Account Management Center Configuratin " EndIf EndIf Case Else Return "-EditPosAccountManagementCenter Field for changing not found" EndSwitch Return $Result EndFunc ;==>EditPosAccountManagementCenter $test = EditPosAccountManagementCenter("Disable Bill collector when bills collected reaches",99998,"") ConsoleWrite($test) -
Hi i am new to Autoit. i wrote the below code and tried executing it. Script moves to first switch case as expected and the If condition is satisfied. Hence the return value for $test is set as "EditPosAccountManagementCenter 'Accept Cash' is not set" but still the code continues to execute inside the case and the $parameterFieldValue "99998" is set in the text box in application. Can anyone help why this happens? Func EditPosAccountManagementCenter($parameterFieldName, $parameterFieldValue, $parameterFieldValueTwo) $Result = 1 Switch $parameterFieldName Case "Disable Bill collector when bills collected reaches" If ControlGetHandle("BBTSMain", "Accept Cash", "[CLASS:TCheckBox; INSTANCE:2]") <> 1 Then Return "EditPosAccountManagementCenter 'Accept Cash' is not set" EndIf Sleep($SleepSmall) ControlClick("BBTSMain", "", "[CLASS:TbbDBEdit; INSTANCE:1]") Sleep($SleepSmall) Send("^a") Sleep($SleepSmall) Send($parameterFieldValue) Case "Account Management Center Configuration" If $parameterFieldValue = "Default" Or $parameterFieldValue == "Default" Then ControlClick("BBTSMain", "Use default settings", "[CLASS:TRadioButton; INSTANCE:4]") Else If $parameterFieldValue = "Custom" Or $parameterFieldValue == "Custom" Then ControlClick("BBTSMain", "Use custom settings", "[CLASS:TRadioButton; INSTANCE:3]") Else $Result = "EditPosAccountManagementCenter Unknown option of Account Management Center Configuratin " EndIf EndIf Case Else Return "-EditPosAccountManagementCenter Field for changing not found" EndSwitch Return $Result EndFunc ;==>EditPosAccountManagementCenter $test = EditPosAccountManagementCenter("Disable Bill collector when bills collected reaches",99998,"") ConsoleWrite($test)
-
Hi All, I am new to AutoIT and i couldn't establish a connection to a oracle DB through AutoIT script Below is my code i tried few connection strings to connect but none of them worked and i was getting a com error each time #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Local $ServerAddress = "xxxxxx.xxxx.cloudapp.azure.com" Local $ServerUserName = "xxxxxxx" Local $ServerPassword = "xxxxxxx" Local $Database = "xxxx" Local $username = 'PHTestUser' Local $Driver = "{Microsoft ODBC for Oracle}" Dim $oMyError ; Initializes COM handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ;$conn1 = "Driver={Microsoft ODBC for Oracle};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx.xxxx.cloudapp.azure.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xxx)));Uid=xxx;Pwd=xxxx; ;$conn2= "Provider='OraOLEDB.Oracle';SERVER=xxxx.xxx.cloudapp.azure.com;DATABASE=india;uid=xxxx;pwd=xxxx;" $conn3="Provider=OraOLEDB.Oracle;Data Source=xxxx.xxxx.cloudapp.azure.com:1521;Initial Catalog=$Database;User Id=xxxx;Password=xxxxx;" $ObjConn = ObjCreate("ADODB.Connection") MsgBox(0,"",$conn) $Objconn.open ($conn) If @error Then ConsoleWrite(@error & @CRLF) EndIf $sQuery = "select * from users where username=" & $username ;$result = $ObjConn.Execute($sQuery) ;MsgBox(0, "", $result.username( " = username" ).Value) ;ConsoleWrite($result.username & " username present") ;$ObjConn.Close ; ==> Close the database ; This COM error Handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) ConsoleWrite("We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc Output: 1. conn1 = We intercepted a COM Error ! err.description is: Catastrophic failure err.windescription: Exception occurred. err.number is: 80020009 err.lastdllerror is: 0 err.scriptline is: 66 err.source is: Provider 2. Conn2 = We intercepted a COM Error ! err.description is: ORA-12560: TNS:protocol adapter error err.windescription: Exception occurred. err.number is: 80020009 err.lastdllerror is: 0 err.scriptline is: 66 err.source is: OraOLEDB 3. Conn3 = We intercepted a COM Error ! err.description is: ORA-12170: TNS:Connect timeout occurred err.windescription: Exception occurred. err.number is: 80020009 err.lastdllerror is: 0 err.scriptline is: 66 err.source is: OraOLEDB it would be much helpful if anyone can suggest what might be the issue