Jump to content

My executable started producing the following error, does anyone know what I should look at to fix it?


Recommended Posts

My executable started producing the following error, does anyone know what I should look at to fix it?

-----------------------------------------------------------------------

| Line -1: |

| |

| Error: The requested action with this object has failed. |

-----------------------------------------------------------------------

Link to comment
Share on other sites

The code?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

If you run the script from SciTe do you get the error as well? If yes, we have the line number which produces the error.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

CODE:

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("FINAID RECON", 447, 365, 192, 124)
$Input1 = GUICtrlCreateInput("", 144, 112, 178, 21)
$Combo1 = GUICtrlCreateCombo("", 144, 184, 178, 25)
GUICtrlSetData(-1, "PELL|ACG|SMART|HOPE|ACCEL")
$Label1 = GUICtrlCreateLabel("ENTER FILENAME", 144, 80, 178, 32)
GUICtrlSetFont(-1, 14, 400, 0, "Arial Rounded MT Bold")
$Label2 = GUICtrlCreateLabel("CHOOSE TYPE", 144, 149, 178, 32)
GUICtrlSetFont(-1, 14, 400, 0, "Arial Rounded MT Bold")
$Button1 = GUICtrlCreateButton("SUBMIT!", 184, 224)
GUISetState()
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Select
  Case $nMsg = $GUI_EVENT_CLOSE
   Exit
  Case $nMsg = $Button1
   $ReconFile = GUICtrlRead($Input1)
   $CHOICE = GUICtrlRead($Combo1)
   ExitLoop
EndSelect
WEnd
; Empty EAMASTER.UPLOAD_DATA table in REAL database for use with new recon.
$DSN = "DSN=REAL;uid=userid;pwd=password"
$adoCon = ObjCreate("ADODB.Connection")
$adoCon.Open($DSN)
$current = $adoCon.execute("delete from EAMASTER.UPLOAD_DATA")
;MsgBox(0, "Current", $current)
;#comments-start
$current = $adoCon.execute("drop table SMMASTER.temp ")
$current = $adoCon.execute("CREATE TABLE SMMASTER.TEMP ( ORIGINATIONID VARCHAR2(9 BYTE), EID VARCHAR2(9 BYTE), ACCEPTEDDISBAMT NUMBER, LNAME VARCHAR2(30 BYTE), FNAME VARCHAR2(30 BYTE));")
$DSN2 = "DSN=DWPROD;uid=userid;pwd=password"
$adoCon2 = ObjCreate("ADODB.Connection")
$adoCon2.Open($DSN2)
$adoRs2 = ObjCreate("ADODB.Recordset")

;OPEN Year-To-Date file for READ.
$file = FileOpen("q:\ede\iam\data\" & $ReconFile, 0)
;Check if file opened for reading OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
ProgressOn("Progress Meter", "IMPORTING TXT FILE TO TEMP TABLE", "Records Complete")
$x = 0
$Y = 0

If $CHOICE = "PELL" Or $CHOICE = "ACG" Or $CHOICE = "SMART" Then
While 1
  $line = FileReadLine($file)
  If @error = -1 Then ExitLoop
  If StringMid($line, 1, 9) <> "GRANT HDR" Then
   $x = $x + 1
   $Y = $Y + 1
   If $Y = 100 Then $Y = 0
   ProgressSet($Y, $x)
   $varOriginationID = StringMid($line, 53, 9)
   $varEID = ""
   $varAcceptdDisbAmount = Number(StringMid($line, 87, 7)) / 100
   $varLname = StringReplace(StringMid($line, 1, 16), "'", "''")
   $varFname = StringReplace(StringMid($line, 17, 12), "'", "''")
   If $varAcceptdDisbAmount > 0 Then
    $adoSQL2 = "select f_getspridenid(spbpers_pidm) from spbpers where spbpers_ssn = '" & $varOriginationID & "';"
    $adoRs2.open($adoSQL2, $adoCon2)
    If Not $adoRs2.eof Then
     $varEID = $adoRs2.Fields(0).value
    Else
     $varEID = ""
    EndIf
    $adoRs2.close()
    $current = $adoCon.execute("INSERT INTO SMMASTER.TEMP values ('" & $varOriginationID & "', '" & $varEID & "', " & $varAcceptdDisbAmount & ", '" & $varLname & "','" & $varFname & "');")
   EndIf
  EndIf
WEnd
ElseIf $CHOICE = "HOPE" Or $CHOICE = "ACCEL" Then
While 1
  $line = FileReadLine($file)
  If @error = -1 Then ExitLoop
  $HOPE = StringSplit($line, "|") ;$HOPE[1] contains SSN, [2] FNAME, [4] LastName, [14] $ tuition, [15] $ fees, [16] $ books
  $x = $x + 1
  $Y = $Y + 1
  If $Y = 100 Then $Y = 0
  ProgressSet($Y, $x)
  $varOriginationID = $HOPE[1]
  $varEID = ""
  $varAcceptdDisbAmount = ($HOPE[14] + $HOPE[15] + $HOPE[16]) /100
  $varLname = StringReplace($HOPE[4], "'", "''")
  $varFname = StringReplace($HOPE[2], "'", "''")
  If $varAcceptdDisbAmount > 0 Then
   $adoSQL2 = "select f_getspridenid(spbpers_pidm) from spbpers where spbpers_ssn = '" & $varOriginationID & "';"
   $adoRs2.open($adoSQL2, $adoCon2)
   If Not $adoRs2.eof Then
    $varEID = $adoRs2.Fields(0).value
   Else
    $varEID = ""
   EndIf
   $adoRs2.close()
   $current = $adoCon.execute("INSERT INTO SMMASTER.TEMP values ('" & $varOriginationID & "', '" & $varEID & "', " & $varAcceptdDisbAmount & ", '" & $varLname & "','" & $varFname & "');")
  EndIf
WEnd
EndIf
 

ProgressOff()
FileClose($file)
$adoCon2.close
ProgressOn("Progress Meter", "LOADING APEX TABLES", "Records Complete")
$x = 0
$Y = 0
$adoRs3 = ObjCreate("ADODB.Recordset")
$adoSQL1 = "select * from SMMASTER.temp order by EID;"
$adoRs3.Open($adoSQL1, $adoCon)

While Not $adoRs3.eof
$x = $x + 1
$Y = $Y + 1
If $Y = 100 Then $Y = 0
ProgressSet($Y, $x)
$FLAG = False
$varEID = $adoRs3.Fields(1).value
$varREPSSN = $adoRs3.Fields(0).value
$amtpd = 0.00
$FNAME = StringReplace(StringLeft(StringStripWS($adoRs3.Fields(4).value, 2), 15), "'", "''")
$LNAME = StringReplace(StringStripWS($adoRs3.Fields(3).value, 2), "'", "''")
While $varEID = $adoRs3.Fields(1).value And Not $adoRs3.eof
  $amtpd = $amtpd + $adoRs3.Fields(2).value
  $adoRs3.movenext
  If $adoRs3.eof Then ExitLoop
WEnd
If $amtpd <> 0 Then
  $adoCon.execute("INSERT INTO EAMASTER.UPLOAD_DATA Values ('" & $varREPSSN & "', '" & $LNAME & "','" & $FNAME & "'," & $amtpd & ", '" & $varEID & "');")
EndIf
WEnd
ProgressOff()
MsgBox(0, "FINISHED", "COMPLETE - NOW RUN REPORTS IN APEX -- http://realapex.selectedurl.edu:7777/pls/apex/f?p=139")
ShellExecute ("iexplore", "http://realapex.selectedurl.edu:7777/pls/apex/f?p=139")
$adoRs3.close
$adoCon.close
;$adoCon2.close

When running the script in SciTE I got the following:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "R:\Common\Custom Scripts\RECON_FORM3.au3"

R:\Common\Custom Scripts\RECON_FORM3.au3 (38) : ==> The requested action with this object has failed.:

$adoCon.Open($DSN)

$adoCon.Open($DSN)^ ERROR

>Exit code: 1 Time: 11.141

Link to comment
Share on other sites

What you need is a COM error handler which tells you exactly what is going on.

Something like:

; At the top of your script
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")    ; Initialize a COM error handler
 
 
; This is my custom defined error handler
Func MyErrFunc()
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"    & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & hex($oMyError.number,8)  & @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 )
          
Endfunc

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

  • Recently Browsing   0 members

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