up vote 0 down vote favorite

i need to call two function on a single click event. and also the functions shud get executed sequentially. i tried click me . but its not working.its not calling any of the functions. here is the complete code. sorry for formatting.

<html>
<head>
<script type="text/vbscript">

function copy()
Dim WshShell, oExec,g,h
h="D:\d"

g="xcopy " & h & " " & "D:\y\ /E"
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec(g)

Do While oExec.Status = 0
     WScript.Sleep 100
Loop

WScript.Echo oExec.Status
end function

function zip()
Dim WshShel, oExe
Set WshShel = CreateObject("WScript.Shell")

Set oExe = WshShel.Exec("cmd /c cd D:\d & D: & winzip32.exe -min -a D:\a")

Do While oExe.Status = 0
     WScript.Sleep 100
Loop

WScript.Echo oExe.Status
end function

</script>
</head>


<body>
<button onclick="copy();zip();"> click me </button>
</body>

</html>

any help is appreciated.

flag

66% accept rate

1 Answer

up vote 0 down vote

Write a single function which calls copy and then zip. Wire that up to the onclick event.

link|flag
function both() call copy() call zip() end function it only calls copy() – sushant Mar 24 at 9:56
can u please tell the mistake i am making? – sushant Mar 24 at 10:03
Are you sure copy() isn't erroring somewhere? – David M Mar 24 at 10:31
yes copying is erroring. but copy is giving the output. for the line:wscript.sleep=100 it says- object required:'wscript' – sushant Mar 24 at 10:52
can u plz help me out – sushant Mar 24 at 11:22
show 2 more comments

Your Answer

get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.