Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass an argument to an application(windows) from an asp page 1

Status
Not open for further replies.

neelawathura

Programmer
Joined
Jun 18, 2003
Messages
7
Location
LK
Cah some one help this.
How to pass an argument to an application(windows) from an asp page.

I have an application that can be run from command prompt and i should pass some arguments. How do that thru a asp
 
if u can get the code in VB then i think that can be done in ASP also...

Known is handfull, Unknown is worldfull
 
windows application = client side
ASP = server side

cant be done with ASP itself, with the use of some VBS a client component or some JS, you might be able to accomplish this.

[thumbsup2]DreX
aKa - Robert
 
forgot to mention in the other direction , no problem , windows app to asp page will work because it's the program acting like you requesting something vs trying to let a remote server take over your computer.

[thumbsup2]DreX
aKa - Robert
 
Hello Thanks for trying to help me

My asp code calling the vb application is like this

a href="VBAPP/vb.exe?id=02"
(Actually i am reading the values from the asp and sending them to the vb code)

And in the vb code i am calling the command line argument by calling 'Command' .

Private Sub Form_Load()

Dim comm As String
comm = Command
' After that i write value of this comm variable to some text file.That's what i am really doing.


End Sub


But the the problem is when i call the exe from the browser there is an error saying can't find the path.

When i run the vb app from command prompt i called it like this :

VBAPP\vb 125

But when we call the app from the asp it calls the app it doesnot work.T
hanks for your comments

 
maybe u need to specify the path of the exe...

Known is handfull, Unknown is worldfull
 
exe's are bad for your server, it has to run the exe for each user, it would be better to use a dll

www.sitesd.com
ASP WEB DEVELOPMENT
 
snow. i think you missed something.. he has exe's on the client side, he's trying to pass values from in web page to application


neel - have you tried using window name to fetch the asp window and then "scrape" it for values? just like in JS you can find a named window then retrieve values from in the form etc.. make hidden output on the page, then scrape it out externally. *shrugs* just an idea is all :)

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Thanks all of u for valuable comments.Sorry for delay in replying to u'r comments.

can some one tell me how to use a dll for this task(As Snowboaderhas said)

The path to the exe is correct.When i call it without url parameters the browser asks me if u want to download it or save. But when i include the parameters it says can't find the page. Thanks.........
 
Hmm whith out knowing more about your program.. have you looked at WMI? Here is a code that if you copy and paste as a vbs you can choose to uninstall remotly.

My point is you can put this vbs in asp and manage programs remotely.....

Dim objWshNet
Set objWshNet = CreateObject("Wscript.Network")
strServer = objWshNet.ComputerName

remote_machine_name = InputBox("Enter the name of the machine on which the" + _
Chr(13) + "product is to be installed. Press enter for this machine.", "Machine Name", strServer)

If remote_machine_name <> strServer Then
admin_user = InputBox("Enter the user name. " + Chr(13) + _
"(User must have Administrative privileges.)")
admin_user_password = InputBox("Enter the users password. ")
End If

Set Locator = CreateObject("WbemScripting.SWbemLocator")

If remote_machine_name = strServer Then
Set Service = Locator.ConnectServer(, "root\cimv2")
Else
Set Service = Locator.ConnectServer(remote_machine_name, "root\cimv2", _
admin_user, admin_user_password)
End If

message = message & vbNewLine & vbNewLine & "Find the Name of the Product you wish to uninstall" _
& vbNewLine & "and write the name down for the next prompt." & vbNewLine & vbNewLine

for each Product in GetObject("winmgmts:{impersonationLevel=impersonate,(Debug)}").InstancesOf ("win32_product")
'WScript.Echo Product.Name, Product.InstallDate, Product.Vendor, Product.Version, Product.PackageCache
message = message & vbNewLine & Product.Name & " [" & strFormatMOFTime(Product.InstallDate) & "]"
next
message = message & vbNewLine & vbNewLine & "Find the Name of the Product you wish to" _
& vbNewLine & "uninstall and write the name down for the next prompt."

WScript.Echo message

package_location = InputBox("Enter the name of the package to be uninstalled.", "Package Name", "Dana")


for each Product in GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("Select * from Win32_Product where Name='" & package_location & "'")

'WScript.Echo Product.Path_

Set InstallSink = WScript.CreateObject("WbemScripting.SWbemSink", _
"INSTALLSINK_")

Service.Security_.ImpersonationLevel=3

Set Path = Product.Path_

Set Method = Product.Methods_.Item("Uninstall")
'Set InParams = Method.InParameters
'Set MyIns = InParams.SpawnInstance_
Set MyIns = nothing


'MyIns.PackageLocation = package_location
'MyIns.AllUsers = "TRUE"
'MyIns.Options = ""

Service.ExecMethodAsync InstallSink, Path, "Uninstall", MyIns, wbemFlagSendStatus
'Service.ExecMethodAsync InstallSink, Path, "Uninstall", wbemFlagSendStatus

WScript.Echo "Waiting for progress."

Next
Sub INSTALLSINK_OnCompleted(hResult, pErrorObject, pAsyncContext)
WScript.Echo ("Uninstallation Complete")
End Sub

Sub INSTALLSINK_OnProgress(iUpperBound, iCurrent, strMessage, objWbemAsyncContext)
if iUpperBound > 0 then
iComplete = (iCurrent * 100)/iUpperBound
'ProgBar.Value = iComplete
' WScript.Echo (CStr(objObject.ReturnValue + "% Complete"))
end if
End Sub

Sub INSTALLSINK_OnObjectReady(objObject, objAsyncContext)
if Not objObject.ReturnValue = 0 Then
WScript.Echo ("Uninstallation failed with following error: " + _
CStr(objObject.ReturnValue))
Else
WScript.Echo ("Uninstallation Succeeded")
End If
End Sub

'********************************************************************
'*
'* Function strFormatMOFTime(strDate)
'*
'********************************************************************

Private Function strFormatMOFTime(strDate)
Dim str
str = Mid(strDate,5,2) & "/" _
& Mid(strDate,7,2) & "/" _
& Mid(strDate,1,4)
strFormatMOFTime = str
End Function
 
Hi Jason

Thanks for your post.I'll try it


neel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top