473,395 Members | 1,584 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.

Launching a batch program from a form

84
We have several batch programs that users need to run each day to move data around our system. The batch files require the user to enter criteria when launching the program. To help simplify this I have created a form that contains several list boxes and a button to launch the batch file. This way the user does not need to type the information in. They will be able to select it from a list box.
Is there a way to get the information contained in the list boxes into the command line for the batch file?

Currently the user will launch the batch file from a dos prompt like so

movefiles system1 system2 system3

The system 1, 2, 3 are passed into the batch as variables %1, %2, %3. The steps below take the information and move the files about accordingly.
Mar 15 '07 #1
9 2151
dima69
181 Expert 100+
We have several batch programs that users need to run each day to move data around our system. The batch files require the user to enter criteria when launching the program. To help simplify this I have created a form that contains several list boxes and a button to launch the batch file. This way the user does not need to type the information in. They will be able to select it from a list box.
Is there a way to get the information contained in the list boxes into the command line for the batch file?

Currently the user will launch the batch file from a dos prompt like so

movefiles system1 system2 system3

The system 1, 2, 3 are passed into the batch as variables %1, %2, %3. The steps below take the information and move the files about accordingly.
Just put it all together in one command line and run it, like this:
Shell """" & thePath & "\movefiles"" " & me![system1] & " " & me![system2] & " " & me![system3]
Mar 15 '07 #2
sesling
84
Just put it all together in one command line and run it, like this:
Shell """" & thePath & "\movefiles"" " & me![system1] & " " & me![system2] & " " & me![system3]
On the form, list0 contains the value for System1, list1 contains the value for System2 and list2 contains the value for System3

Just so I understand the command would look like this when the user makes the selection in the list boxes on the form

Shell """" & C: & "\movefiles"" " & me!list0 &" "& me!list1 &" "& me!list2"

also I am not that familar with me! what is that?
Mar 15 '07 #3
dima69
181 Expert 100+
On the form, list0 contains the value for System1, list1 contains the value for System2 and list2 contains the value for System3

Just so I understand the command would look like this when the user makes the selection in the list boxes on the form

Shell """" & C: & "\movefiles"" " & me!list0 &" "& me!list1 &" "& me!list2"

also I am not that familar with me! what is that?
You are not familiar with you ? :)
"Me" is a pointer to the form/report object running the code.
The command will look like this:
Expand|Select|Wrap|Line Numbers
  1. Shell "C:\movefiles" & Me![list0] &" "& Me![list1] &" "& Me![list2]
Mar 15 '07 #4
dima69
181 Expert 100+
Sorry, I missed the space after the file name. It should be:
Expand|Select|Wrap|Line Numbers
  1. Shell "C:\movefiles " & Me![list0] &" "& Me![list1] &" "& Me![list2]
Mar 15 '07 #5
sesling
84
Sorry, I missed the space after the file name. It should be:
Expand|Select|Wrap|Line Numbers
  1. Shell "C:\movefiles " & Me![list0] &" "& Me![list1] &" "& Me![list2]
Thx for the jab. I know me :)

I created a form called TEST and batch file called STEVE. I used the command line you provided but I am getting an error saying the object required. Is there something I am missing in the command line? I have listed the code I am running below

Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

Dim stAppName As String

stAppName = "C:\steve.bat " & TEST![List102] & " " & TEST![List106] & " " & TEST![list108]
Call Shell(stAppName, 1)

Exit_Command108_Click:
Exit Sub

Err_Command108_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command108_Click

End Sub
Mar 15 '07 #6
dima69
181 Expert 100+
Thx for the jab. I know me :)

I created a form called TEST and batch file called STEVE. I used the command line you provided but I am getting an error saying the object required. Is there something I am missing in the command line? I have listed the code I am running below

Private Sub Command108_Click()
On Error GoTo Err_Command108_Click

Dim stAppName As String

stAppName = "C:\steve.bat " & TEST![List102] & " " & TEST![List106] & " " & TEST![list108]
Call Shell(stAppName, 1)

Exit_Command108_Click:
Exit Sub

Err_Command108_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command108_Click

End Sub
Maybe I was not clear. You should use the word "Me" instead of "TEST"
Mar 15 '07 #7
sesling
84
Maybe I was not clear. You should use the word "Me" instead of "TEST"
Duh!. I miss read your statement. The command works great.
Thanks :)
Mar 15 '07 #8
sesling
84
Maybe I was not clear. You should use the word "Me" instead of "TEST"
I ran into a new issue with a different program. I am trying to launch SQLPLUS from the form. I can do this and have it call an SQL batch file and run it. I need to pass in a variable in the command line but I cannot get the command line to accept a value from the form.

I can run it with the variable BST if I manually place it in the command line.
stAppName = "c:\oracle\ora92\bin\sqlplus.exe " & "/nolog @c:\research BST"

But I need the BST to be a variable that comes from a pick list. This way i can have one program run with many different variables I have tried the following but no luck. The SQL batch is asking for me to enter the value of variable 1.

stAppName = "c:\oracle\ora92\bin\sqlplus.exe " & "/nolog @c:\anf_research Me![List12]

Any idea's on this one?
Mar 15 '07 #9
sesling
84
I ran into a new issue with a different program. I am trying to launch SQLPLUS from the form. I can do this and have it call an SQL batch file and run it. I need to pass in a variable in the command line but I cannot get the command line to accept a value from the form.

I can run it with the variable BST if I manually place it in the command line.
stAppName = "c:\oracle\ora92\bin\sqlplus.exe " & "/nolog @c:\research BST"

But I need the BST to be a variable that comes from a pick list. This way i can have one program run with many different variables I have tried the following but no luck. The SQL batch is asking for me to enter the value of variable 1.

stAppName = "c:\oracle\ora92\bin\sqlplus.exe " & "/nolog @c:\anf_research Me![List12]

Any idea's on this one?

Nevermind on this one. I figured it out. Same solution as the batch file. Just need to place my variables differently
Mar 16 '07 #10

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

Similar topics

2
by: Bob | last post by:
Hi, I'm trying to build a PHP page which launches another php script to be run in the background. The web page should return immediately, while the background script may run for 10 minutes or...
2
by: Richard | last post by:
Good morning all I need a way in visual basic 6, to start a console process, like ping -A xxx.xxx.xxx.xxx > outputfile.txt and make vb hold its own execution till this process finishes....
1
by: Rob | last post by:
Using a button control...Why does this only launch the command interpreter but not the batch file? The batch file portion of the string is being ignored when run. strAppName = "Cmd.exe...
8
by: Keith French | last post by:
I am trying to launch an external program within Visual Basic 2005 Express. If it is a simple program it works well with:- myProg = "C:\MyFolder\MyApp.exe"...
8
by: VA | last post by:
I have a report that is accessible by a URL. How would I go about automating the launching of this URL using, say, a batch file? I can put start iexplore.exe "http://my.url" in the .bat...
7
by: dhussong | last post by:
I have created a Setup and Deployment project in Visual Studio.NET 2003. After my installation has completed running I'd like to launch the EXE that I just installed. I've found how to launch the...
3
by: emman_54 | last post by:
Hi every one, I am trying to run a batch file using my asp.net application. I am using the Process class to run the batch file. When I run my web application, In the task manager, i could see...
0
by: ee_stevek | last post by:
hi guys, here is my problem: i have to maintain a web vb.net application developped some times ago. The application was developped on Windows2000 SP3 with Visual Studio 2003 (7.1). and the...
1
by: =?Utf-8?B?S3Jpc2huYWthbnRo?= | last post by:
I have got a requirement as follows. I am having a table RCBL_ERROR in a database in DB2. I need to create a batch file, which has to extract the rows from this table and write those extracted...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.