473,395 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Waiting for Shell to Finish

5
I have a batch file that runs a perl script needed to refresh certain table in my Access database. Due to the data and software I am working with, each time I want to run a report (from a single form w/ 3 parameters) I need to delete the tables contents (to avoid redundant data) and run the batch file. I would like to have this occur in the the opening of the form, so that the user will always have the most up to date data. At this point everything works fine, but the user can click ok and proceed to the report before the batch file is finished. The dos window on the screen is the only way to tell the batch has not finished yet (which is not ideal). I am concerned that the user could click OK on the form before the batch file has completed filling the Access table. How should I go about this? I had the idea of either hiding the form or making the button inactive until the batch file is finished, but I am not sure how to execute this. Any other ideas would be great.

Geoff
Mar 4 '08 #1
5 6844
FishVal
2,653 Expert 2GB
Hi, Geoff.

Take a look at TheScripts Tip of the Week #47 - Windows Script Host Object library.
As soon as it is a batch file you may put "echo" command at the and of the batch file and get the message in access code via WshExec.Stdout property.

Regards,
Fish
Mar 4 '08 #2
ggarz1
5
Thanks FishVal.

I had created the batch file in windows, just to automate the perl script I was running. The batch file is static and only calls perl and the script to run. Can I use the wsh echo command from a batch file/command prompt? Am I better of creating a wsh script instead of a batch file to execute the perl? Or should I execute the code in my vb script via shell instead? I would like to keep everything very basic for now.
Mar 5 '08 #3
FishVal
2,653 Expert 2GB
Frankly speaking, I don't see much differences between running the application directly or through batch file.

Best regards,
Fish
Mar 6 '08 #4
NeoPa
32,556 Expert Mod 16PB
Check out ShellWait() Function.
Sep 29 '08 #5
ADezii
8,834 Expert 8TB
  1. Place the code to DELETE your Tables and Run the Batch File as Normal in the Form's Open() Event. Place Code Line Numbers 1 and 2 as the 'first' items in the Open() Event. We will set the Timer Interval for the Form before we do anything. For demo purposes, I set it to 1 second:
    Expand|Select|Wrap|Line Numbers
    1. 'Set the Form's Timer Interval for 1 Second
    2. Me.TimerInterval = 1000        'in milliseconds
    3.  
    4. Dim lngCounter As Long
    5.  
    6. 'Simulate Table Deletions and Batch File Run
    7. For lngCounter = 1 To 10000
    8.   Debug.Print lngCounter
    9. Next
  2. Open your Form in 'Hidden' Mode via an AutoExec Macro.
  3. What will now happen is that the Form will be Open but Hidden from view, its Timer Interval will be set to 1 second, Tables will be Deleted, your Batch File will be Run, all the while the Form is not visible to the User.
  4. Place code in the Form's Timer Interval, which will now be executed every 1 second (you can change this value). At the end of 6 seconds, the Form will now become Visible, and the Timer will be disabled. All your code will have been executed while your Form was Invisible, with no possible intervention from the User.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Timer()
    2. Static intTimerCount As Integer
    3.  
    4. intTimerCount = intTimerCount + 1000
    5.  
    6. If intTimerCount Mod 6000 = 0 Then      'at 6 Seconds
    7.   Me.Visible = True
    8.   Me.TimerInterval = 0
    9. End If
    10. End Sub
    11.  
  5. In case you are wondering, I have tried this logic and it works quite well. You circumstances are different, but I feel it may be worth a try.
Sep 30 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rob Lemieux | last post by:
In my code... Dim intFNum As Integer Dim ID As Integer intFNum = FreeFile Open "runme.bat" For Output As #intFNum Print #intFNum, "dir > log.txt" Close #intFNum ID = Shell(fileName,...
12
by: Raymond Lewallen | last post by:
How to wait for a process to stop completion is my goal. Obviously, the looping while waiting for the HasExited property is not a solution.. but thats the best I can come up off the top of my...
6
by: Hugh Janus | last post by:
Hi group, I am executing a shell command that calls a .BAT file. I have to wait for this batch file to finish so I use the wait = true parameter in the shell command. However, this means that...
5
by: Chris | last post by:
What would be the simplest way to make an app wait for one process to finish before starting the next process? Example /// FileCopy(strPath & "test.mdb", strPath & "live.mdb") Wait(Until...
5
by: Jim | last post by:
I have a form in an Access 2003 db that calls (using shell - thanks to this newsgroup) a Vb.net program I wrote to parse a text file. The call works fine. The VB parses the file correctly. How...
25
by: dennijr | last post by:
ok, shell always used to be easy for me, now its starting to get annoying cause i dont know wats wrong heres the simplist code possible: Private Sub IExplorer_Click() a = Shell("C:\Program...
3
by: telduivel | last post by:
Can someone please help me with this: I have a python script, that at some point calls a linux bash script (.sh). Starting the shell script is the last thing my python script needs to do, so I...
8
by: Bill H | last post by:
In a php script I am using I need to call an external program and have it start running, but I don't want the php script to wait for it to finish. Looking at exec() and system() these would all...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
0
by: ndedhia1 | last post by:
Hi, I am writing an application that has to cattail a log file, and every time the log gets written to, I have to do some processing with that data, which could take a few seconds. The problem that...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.