Welcome to Dream.In.Code
Become an Expert!

Join 149,523 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,409 people online right now. Registration is fast and FREE... Join Now!




batch files at logoff

 
Reply to this topicStart new topic

batch files at logoff, Creating a .bat file to 'save as html', open with Excl, save f

tonymorton
27 May, 2007 - 03:10 AM
Post #1

New D.I.C Head
*

Joined: 27 May, 2007
Posts: 3


My Contributions
I am a complete beginner to batch files altough I have a little knowledge of Visual Basic. Having successfully used AutoIT, which is a GUI based program to achieve what I have set out below, I have found it will not work 24/7 because of Novell autlogoff - I cannot get this disabled for security reasons.

I want to be able to write a .bat file to work when the computer is logged off via Novell security to:

open a real time database program called 'Pulse'
save this as an html file
open this file with Excel
save the Excel file every hour between 0900 until 22:00 Monday through Sunday.

Assuming the program was in C:\programs as 'Pulse.exe and the destination path was Y:\reports\Mon etc

How would I save the file there as '0900Mon'?

Many thanks.
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Batch Files At Logoff
27 May, 2007 - 01:07 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,868



Thanked: 53 times
Dream Kudos: 550
My Contributions
It sounds as though you will want to use a scripting language like VBS or JS rather than a Batch program. The reasons I say this are:
* unless Pulse.exe has a command line option for "Save as HTML" you will need to use "Sendkeys" or Automation to have the program save as HTML.
* IT is not easy to get a batch file to run "every hour..." (though I suppose you could use a task scheduler.

There is something curious... "when the computer is logged off..." "...save the Excel file every hour..." This is a little curious. You want the process to start at a logoff, and then continue to run until someone logs back on?

Another thing: Why would you save the Excel file every hour -- it would not change. Do you mean that it should load the database, save as HTML, import that into excel and save as an excel file once every hour?

Anyway, To use a Script that uses SendKeys you need to write out all of the keystrokes needed from the moment that Pulse.exe is loaded to open the database and save the database as an html file.
User is online!Profile CardPM
+Quote Post

tonymorton
RE: Batch Files At Logoff
28 May, 2007 - 09:22 AM
Post #3

New D.I.C Head
*

Joined: 27 May, 2007
Posts: 3


My Contributions
QUOTE(tonymorton @ 28 May, 2007 - 10:13 AM) *

QUOTE(NickDMax @ 27 May, 2007 - 02:07 PM) *

It sounds as though you will want to use a scripting language like VBS or JS rather than a Batch program. The reasons I say this are:
* unless Pulse.exe has a command line option for "Save as HTML" you will need to use "Sendkeys" or Automation to have the program save as HTML.
* IT is not easy to get a batch file to run "every hour..." (though I suppose you could use a task scheduler.

There is something curious... "when the computer is logged off..." "...save the Excel file every hour..." This is a little curious. You want the process to start at a logoff, and then continue to run until someone logs back on?

Another thing: Why would you save the Excel file every hour -- it would not change. Do you mean that it should load the database, save as HTML, import that into excel and save as an excel file once every hour?

Anyway, To use a Script that uses SendKeys you need to write out all of the keystrokes needed from the moment that Pulse.exe is loaded to open the database and save the database as an html file.



I think (I will need to check when bck at work) that Pulse does have an option to save as HTML.

No, I could (and have) start it running when the computer is logged on, problem is after 5 min or so of inactivity it logs itsef off for security reasons. Therefore I could not get it to run in the evenings, say between 19:00 and 22:00 when I'm not at work. Also, saving every hour is needed because the data in Pulse (a real-time database) changes and therefore each hourly Excel report will contain different data.

I do use sendkeys in some programs that I write but:

cannot use sendkeys for right clicks (eg. 'open with' Excel for the (saved) html file)

Also, I thought a batch file could run when the computer was logged off, the visualbasic script would run through Excel and I would not have access to program resources when the computer was logged off.





User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:35PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month