|
Answer» I have the below code which assists me in running a PLASMA display screen.
@ECHO OFF Start C:\Plasma\ACD_Refresh.acsauto ping -n 2 127.0.0.1 > nul Start C:\Plasma\Test_ACD_Report.xls :start Start C:\Plasma\ACD_Refresh.acsauto ping -n 21 127.0.0.1 > nul goto start
basically the code will the file ACD_Refresh.acsauto every 20 seconds which outputs real time data to a csv file.
Every now and then i seem to get the following error which causes a error messagge to appear over the top of my excel workbook which gets in the way of the display data.
Is there anyway to skip the refresh if it has a problem and then wait another 20 seconds it to loop round? mabe you have another suggestion?
sorry the error msg was 'The application failed to initalise properly (0xc0000142). Click on OK to terminate the application.The problem appears to be having ACD_Refresh.acsauto in one window, the spreadsheet in another window and the batch file itself in a third window. Does ACD_Refresh.acsauto return an errorlevel? A Windows Script solution is probably better than batch.
8-)im not sure, i dont pretend to know much about this at all and im not sure the answer to your question. How can i best go about this as i have the display screen working with exception to this error.Batch code does not do Windows; sad but true. This snippet may help:
Code: [Select]Set WshShell = CreateObject("WScript.Shell") WshShell.Run "C:\Plasma\ACD_Refresh.acsauto",,True Wscript.Sleep 2000 WshShell.Run "C:\Plasma\Test_ACD_Report.xls",,False Refresh
Sub Refresh() rc = WshShell.Run("C:\Plasma\ACD_Refresh.acsauto",,False) If rc <> 0 Then WshShell.AppActivate "[highlight]error box windows title goes here[/highlight]" WScript.Sleep 1000 WshShell.SendKeys "~" End if WScript.Sleep 20000 Refresh End Sub
Replace the highlighted text with the real title of the error box. Save the script with a vbs extension and run from the command prompt as wscript scriptname.vbs
Good luck 8-)
PS. I couldn't test this obviously so be prepared for the script to have errors. I assumed acsauto returned a non-zero return code when it failed. We all know what HAPPENS to people who assume.thats great thank you very much. Is there anyway to stop the script without rebooting?A reboot does seem RATHER harsh. Bring up the task manager (ctl-alt-del) and end the task wscript.
Try running the script as cscript scriptname.vbs. You should be able to use ctl-C to end the script. The spreadsheet may still have to manually shutdown.
8-)I got the following error when i checked the screen this morning and had to reboot the PC.
I THINK it may be because its trying to obtain data when the host system is going through its end of day run. Is there anyway to apply a time gate to it so it only runs between the hours of 7am and 11pm ?
windows script host script c:\plasma\ line 8 char 2 error out of memory: wshshell.run code 800a0007 source microsoft runtime vb errorThis morning i experianced the error again
sorry the error msg was 'The application failed to initalise properly (0xc0000142). Click on OK to terminate the application.
Im wondering if this error occurs vecause the ACD_refresh file the is run is trying to create the csv whilst my excel spreadsheet is importing from the existing one.
Is there a way to get the prog to CHECK if the file is in use before running the ACD_refresh script first, if its in use it could skip and reloop until its free.
thank you for your help this is really apppreciated,In your original post you had all the jobs being started into separate windows; it's amazing the jobs were ever able to get in sync. Now it beginning to appear this run unit should run each job in-line as the spreadsheet is dependent on the refresh program to create a csv file.
Questions: Are you using Excel for the spreadsheet? In your original post, the spreadsheet is loaded outside the loop. Is there a macro controlling the spreadsheet, in other words what triggers the spreadsheet to import the newest csv file from the refresh program?
8-)
Please post the title of the error box, not the error message. Thanks.Yes im using Excel to display sheets in a particular order through use of a macro.
To simplify
The ACD_refresh when run creates an csv The excel spreadsheet pulls in via code the csv file approx every 20 secs The excel spreadsheet also connects and download data from a server once an hour This allows me to display the data and through use of a macro i rotate the sheets every 20 seconds in this code the csv file is pulledNormally I would suggest writing a VBScript for the entire run unit since Excel can be scripted very easily. Since you've already written most of the code as an Excel macro, it should be a simple matter to run the refresh program from within the macro using the shell function. You will need to get the spreadsheet kickstarted (batch file?) and then all the components (refresh, import data, connect to server) will be under control of a single macro.
Good luck. 8-)
|