Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: 20 sec refresh error  (Read 3870 times)

0 Members and 1 Guest are viewing this topic.

JTWork

  • Guest
20 sec refresh error
« on: January 30, 2007, 09:13:39 AM »
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?


JTWork

  • Guest
Re: 20 sec refresh error
« Reply #1 on: January 30, 2007, 09:18:40 AM »
sorry the error msg was 'The application failed to initalise properly (0xc0000142). Click on OK to terminate the application.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: 20 sec refresh error
« Reply #2 on: January 30, 2007, 05:11:18 PM »
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-)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

JTWork

  • Guest
Re: 20 sec refresh error
« Reply #3 on: January 31, 2007, 12:51:04 AM »
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.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: 20 sec refresh error
« Reply #4 on: January 31, 2007, 06:08:10 AM »
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.
« Last Edit: January 31, 2007, 06:12:37 AM by Sidewinder »
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

JTWork

  • Guest
Re: 20 sec refresh error
« Reply #5 on: January 31, 2007, 06:57:46 AM »
thats great thank you very much. Is there anyway to stop the script without rebooting?

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: 20 sec refresh error
« Reply #6 on: January 31, 2007, 07:30:42 AM »
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-)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

JTWork

  • Guest
Re: 20 sec refresh error
« Reply #7 on: February 01, 2007, 01:08:14 AM »
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 error

JTWork

  • Guest
Re: 20 sec refresh error
« Reply #8 on: February 01, 2007, 03:20:58 AM »
This 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,

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: 20 sec refresh error
« Reply #9 on: February 01, 2007, 04:33:03 AM »
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.
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

JTWork

  • Guest
Re: 20 sec refresh error
« Reply #10 on: February 01, 2007, 04:57:10 AM »
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 pulled

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: 20 sec refresh error
« Reply #11 on: February 01, 2007, 05:22:10 AM »
Normally 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-)
« Last Edit: February 01, 2007, 08:18:00 AM by Sidewinder »
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein