Jump to content

Recommended Posts

Posted

hello

need some advices to work my script.

I'm trying to run applications from a html formular, but isn't correct....

so here goes my .htm file

<html>

<head>

<title>Test de formulaire avec IE</title>

</head>

<body bgcolor="#FFFFD2" scroll="no">

<script language="VBScript">

<!--

Dim ready

' Action sur les boutons

Sub VALID_OnClick

ready=1

End Sub

Sub ANNUL_OnClick

ready=2

End Sub

' Initialisation

Sub Window_OnLoad()

ready=0

End Sub

' Fonction utilisable de l'extérieur pour tester l'envoi

Public Function CheckVal()

CheckVal=ready

End function

'-->

</script>

<form name="AppsForm">

<h3><center>Liste d'Applications</center></h3><hr>

<select size="1" name="AppsList">

<option value="Excel">Microsoft Excel</option>

<option value="Opt2">application2</option>

<option value="Opt3">application3</option>

<option value="opt4">application4</option>

</select>

<hr>

<input type="button" value="Valider" name="VALID">

<input type="button" value="Annuler" name="ANNUL">

</form>

</body>

</html>

and the vb script who check for user input on a list and then execute a shell to start different applications...

Dim shell, oIE

Set shell = WScript.CreateObject("WScript.Shell")

Do While true

' Ouverture d'Internet Explorer

Set oIE = WScript.CreateObject("InternetExplorer.Application", "IE_")

oIE.Left = 50

oIE.Top = 10

oIE.Height = 700

oIE.Width = 550

oIE.MenuBar = 0

oIE.ToolBar = 0

oIE.StatusBar = 0

oIE.navigate GetPath() & "test44.htm"

oIE.Visible = 2

Do While (oIE.Busy)

WScript.Sleep 200

Loop

shell.AppActivate "AppsForm"

On Error Resume Next

Do

WScript.Sleep 100

Loop While (oIE.Document.Script.CheckVal() = 0)

If Err <> 0 Then

'Wscript.Echo "On a fermé IE directement"

Wscript.quit

end if

test=oIE.Document.Script.CheckVal()

If test=1 Then

' MsgBox "clicked button " & test & VBCRLF & VBCRLF _

'& "application: " & oIE.Document.Appsform.AppsList.value

'works with this code

strListeApps=oie.Document.APpsForm.AppsList.Value

End IF

if strListeApps = "Excel" Then

Call FncShell()

Else

End IF

CloseIE

loop

'------------------------------------------------------------

' Fonction de récupération du répertoire courant

Function GetPath()

Dim path

path = WScript.ScriptFullName

GetPath = Left(path, InStrRev(path, "\"))

End Function

'------------------------------------------------------------

' Fermeture d'Internet Explorer

Sub CloseIE

oIE.Quit

Set oIE = Nothing

End Sub

'------------------------------------------------------------

Function FncShell()

Set wshShel=Wscript.CreateObject("Wscript.Shell")

WshShell.Run _

"""C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE""", 1, True

End Function

'------------------------------------------------------------

feel free to comment my code....

thank you


Posted

cause the user want's his machine so i made a batch script with "choise" app but how the old dos based window looks crap...

here is my code

@echo off

:debut

echo. Utilisation de choice

echo.

Echo A- Appuyer sur la touche clavier A pour lancer le tutoriel Autoformation sur Acrobat

echo B- Appuyer sur la touche clavier B pour lanceR le tutoriel Autoformation sur Excel

echo C- Appuyer sur la Touche clavier C pour lancer le tutoriel Autoformation sur Powerpoint

echo D- Appuyer sur la touche clavier D pour lancer le tutoriel Autoformation sur FileMaker pro 7

echo E- Appuyer sur la touchr clavier E pour lancer le tutoriel Autoformation sur Windows Office XP

echo F- Appuyer sur la touche clavier F pour lancer le tutoriel AutoFormation sur DreamWeaver 4

echo G- Appuyer sur la touche clavier G pour lancer le tutoriel AutoFormation sur Flash 5

echo H- Appuyer sur la touche clavier H pour lancer le tutoriel AutoFormation sur Ilustrator 10

echo I- Appuyer sur la touche clavier I pour lancer le tutoriel AutoFormation sur Ilustrator v1

echo L- Appuyer sur la touche clavier L pour lancer le tutoriel AutoFormation sur Ilustrator v2

echo M- Appuyer sur la touche clavier M pour lancer le tutoriel AutoFormation sur InDesignCs

echo N- Appuyer sur la touche clavier N pour lancer le tutoriel AutoFormation sur IReady Photo 5.5

echo O- Appuyer sur la touche clavier O pour lancer le tutoriel AutoFormation sur PhotoShop Cs

echo.

Choice /c:onmlihgfedcba /n /t:a,90 Choisissez le programme de autoformation a executer.

If errorlevel 13 goto lancer_acrobat

if errorlevel 12 goto lancer_excel

if errorlevel 11 goto lancer_word

if errorlevel 10 goto lancer_Filemaker

if Errorlevel 9 goto lancer_officexp

if errorlevel 8 goto lancer_Dreamweaver

if errorlevel 7 goto lancer_flash

if errorlevel 6 goto lancer_ilustrator10

if errorlevel 5 goto lancer_ilustratorv1

if errorlevel 4 goto lancer_ilustratorv2

if errorlevel 3 goto lancer_InDesignCs

if errorlevel 2 goto lancer_IreadyPhoto

if errorlevel 1 goto lancer_PhotoShopCs


:lancer_PhotoShopCs
"C:\Formation Bureautique\Multimedia\PhotoshopCS\lecteur VTC.exe"
goto fin

:lancer_excel
"C:\Formation Bureautique\bureautique\Excel\lecteur VTC.exe"
goto fin
:lancer_word
"C:\Formation Bureautique\bureautique\Microsoft_Word\lecteur VTC.exe"
goto fin
:lancer_Filemaker
"C:\Formation Bureautique\bureautique\FieMaker_Pro7\lecteur VTC.exe"
goto fin
:lancer_officexp
"C:\Formation Bureautique\bureautique\Windows-Office_XP\lecteur VTC.exe"
goto fin
:lancer_Dreamweaver
"C:\Formation Bureautique\Multimedia\DreamWeaver4\lecteur VTC.exe"
goto fin
:lancer_flash
"C:\Formation Bureautique\Multimedia\Flash5\lecteur VTC.exe"
goto fin
:lancer_ilustrator10
"C:\Formation Bureautique\Multimedia\Illustrator10\lecteur VTC.exe"
goto fin
:lancer_ilustratorv1
"C:\Formation Bureautique\Multimedia\Illustratorv1\lecteur VTC.exe"
goto fin
:lancer_ilustratorv2
"C:\Formation Bureautique\Multimedia\Illustratorv2\lecteur VTC.exe"
goto fin
:lancer_InDesignCs
"C:\Formation Bureautique\Multimedia\InDesignCS\lecteur VTC.exe"
goto fin
:lancer_IreadyPhoto
"C:\Formation Bureautique\Multimedia\IReady_Photo5-5\lecteur VTC.exe"
goto fin
:lancer_Acrobat
"C:\Formation Bureautique\bureautique\Acrobat_5\Lecteur VTC.exe"
goto fin




:fin


rem si on met

rem goto debut

rem là

rem on retourne au debut du menu (dans ce cas il faut penser à ajouter une option quitter dans le menu)

but i've got a little problem...when user logs off the process continues so i have the log off message "quit all applications before turn off or blablalal. ..."

some ideas please......

thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...