ziggy2000 Posted February 24, 2011 Share 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 Link to comment Share on other sites More sharing options...
water Posted February 24, 2011 Share 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ziggy2000 Posted February 24, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
Juvigy Posted February 24, 2011 Share Posted February 24, 2011 try changing : $oExcel.Worksheets("riepilogo").range("r30").value to $oExcel.Application.ActiveSheet.Range("r30").value Link to comment Share on other sites More sharing options...
ziggy2000 Posted February 24, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
Juvigy Posted February 24, 2011 Share Posted February 24, 2011 Strange - that works for me. Have you lowered your security and macro settings ? Link to comment Share on other sites More sharing options...
ziggy2000 Posted February 24, 2011 Author Share Posted February 24, 2011 Strange - that works for me.Have you lowered your security and macro settings ?Yes low protection Link to comment Share on other sites More sharing options...
ziggy2000 Posted February 26, 2011 Author Share Posted February 26, 2011 Sorry if I insist I'm trying to all but the problem remains thanks luca Link to comment Share on other sites More sharing options...
Juvigy Posted February 28, 2011 Share Posted February 28, 2011 First of all i would remove the sleep and the msgbox functions. Also change $oExcel.Visible = 0 Link to comment Share on other sites More sharing options...
FF255 Posted April 11, 2011 Share 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. Link to comment Share on other sites More sharing options...
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