ziggy2000 Posted February 24, 2011 Posted February 24, 2011 Hello This is my script: $oExcel = ObjCreate("Excel.Application") ; Create an Excel Object $oExcel.Visible = 1 ; Let Excel show itself $oExcel.Workbooks.Open("C:\Users\Giovanni\Documents\ilmioprogramma\segnali.xls");Open Workbook"segnali" $oExcel.Worksheets("riepilogo").select ;Select worksheet"riepilogo" ;start loop while 1 $nuovo = $oExcel.Worksheets("riepilogo").range("r30").value ;read cell value 1 $vecchio = $oExcel.Worksheets("riepilogo").range("r33").value ;read cell value 2 ;case result by the difference of cell value Select case $nuovo = 1 And $vecchio = 0 MsgBox(0,"posizione long",$nuovo) case $nuovo = -1 and $vecchio = 0 MsgBox(0,"posizione short",$nuovo) case $nuovo = 0 and $vecchio = -1 MsgBox(0,"posizione flat",$nuovo) case $nuovo = 0 and $vecchio = 1 MsgBox(0,"posizione flat",$nuovo) case $nuovo = -1 and $vecchio = 1 MsgBox(0,"posizione reverse",$nuovo) case $nuovo = 1 and $vecchio = -1 MsgBox(0,"posizione reverse",$nuovo) case $nuovo = $vecchio MsgBox(0,"in posizione",$nuovo,1) EndSelect $oExcel.range("r33").value = $nuovo ;write e cell Sleep(9000) WEnd the script reads the values of cells in an Excel workbook that is updated with data received from a DDE server. If I leave the excelworkbook maximized the program works well But if I Minimize it or open other APPLICATIONS autoit crashes. How can I change the script to make it more stable and allow me to use the computer during its execution? tks luca
water Posted February 24, 2011 Posted February 24, 2011 To help you we need additional information: What operating system version do you use? What Office version do you use? Do you run 32/64 bit of the OS and/or Office? Do you get any error messages? 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
ziggy2000 Posted February 24, 2011 Author Posted February 24, 2011 To help you we need additional information:What operating system version do you use?What Office version do you use?Do you run 32/64 bit of the OS and/or Office?Do you get any error messages?Vista home basic6.0.6001 service Pack 1 build 6001office professional edition 2003No idea about 32/64 bit . where i can find this information?>Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Giovanni\Documents\ilmioprogramma\programma(excel.application).au3" C:\Users\Giovanni\Documents\ilmioprogramma\programma(excel.application).au3 (10) : ==> The requested action with this object has failed.:$nuovo = $oExcel.Worksheets("riepilogo").range("r30").value$nuovo = $oExcel.Worksheets("riepilogo")^ ERROR->12:32:40 AutoIT3.exe ended.rc:1>Exit code: 1 Time: 89.177tks luca
Juvigy Posted February 24, 2011 Posted February 24, 2011 try changing : $oExcel.Worksheets("riepilogo").range("r30").value to $oExcel.Application.ActiveSheet.Range("r30").value
ziggy2000 Posted February 24, 2011 Author Posted February 24, 2011 try changing :$oExcel.Worksheets("riepilogo").range("r30").valueto $oExcel.Application.ActiveSheet.Range("r30").valueSame resultC:\Users\Giovanni\Documents\ilmioprogramma\programma(excel.application).au3 (9) : ==> The requested action with this object has failed.:$nuovo = $oExcel.Application.ActiveSheet.Range("r30").value$nuovo = $oExcel.Application^ ERROR->13:05:48 AutoIT3.exe ended.rc:1tksluca
Juvigy Posted February 24, 2011 Posted February 24, 2011 Strange - that works for me. Have you lowered your security and macro settings ?
ziggy2000 Posted February 24, 2011 Author Posted February 24, 2011 Strange - that works for me.Have you lowered your security and macro settings ?Yes low protection
ziggy2000 Posted February 26, 2011 Author Posted February 26, 2011 Sorry if I insist I'm trying to all but the problem remains thanks luca
Juvigy Posted February 28, 2011 Posted February 28, 2011 First of all i would remove the sleep and the msgbox functions. Also change $oExcel.Visible = 0
FF255 Posted April 11, 2011 Posted April 11, 2011 I have the same problem with a similar script when reading an excel value that originates from a DDE or RTD server. AutoIT will crash when the script attempts to read the cell. No problem arises when the cell is not of DDE/RTD origin. Line 224: (exe file) Error: The requested action with this object has failed. In the source code, that line refers to a listbox, so the line doesn't seem to link up.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now