bruno88 Posted February 7, 2006 Posted February 7, 2006 helloneed 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 boutonsSub VALID_OnClickready=1 End SubSub ANNUL_OnClickready=2 End Sub' InitialisationSub Window_OnLoad()ready=0 End Sub' Fonction utilisable de l'extérieur pour tester l'envoiPublic Function CheckVal()CheckVal=readyEnd 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, oIESet 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 codestrListeApps=oie.Document.APpsForm.AppsList.ValueEnd IFif strListeApps = "Excel" ThenCall FncShell()ElseEnd IF CloseIE loop'------------------------------------------------------------' Fonction de récupération du répertoire courantFunction GetPath()Dim pathpath = WScript.ScriptFullNameGetPath = Left(path, InStrRev(path, "\"))End Function'------------------------------------------------------------' Fermeture d'Internet ExplorerSub CloseIEoIE.Quit Set oIE = NothingEnd Sub'------------------------------------------------------------Function FncShell()Set wshShel=Wscript.CreateObject("Wscript.Shell")WshShell.Run _ """C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE""", 1, TrueEnd Function'------------------------------------------------------------feel free to comment my code....thank you
bruno88 Posted February 9, 2006 Author Posted February 9, 2006 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:debutecho. Utilisation de choiceecho.Echo A- Appuyer sur la touche clavier A pour lancer le tutoriel Autoformation sur Acrobatecho B- Appuyer sur la touche clavier B pour lanceR le tutoriel Autoformation sur Excelecho C- Appuyer sur la Touche clavier C pour lancer le tutoriel Autoformation sur Powerpointecho D- Appuyer sur la touche clavier D pour lancer le tutoriel Autoformation sur FileMaker pro 7echo E- Appuyer sur la touchr clavier E pour lancer le tutoriel Autoformation sur Windows Office XPecho F- Appuyer sur la touche clavier F pour lancer le tutoriel AutoFormation sur DreamWeaver 4echo G- Appuyer sur la touche clavier G pour lancer le tutoriel AutoFormation sur Flash 5echo H- Appuyer sur la touche clavier H pour lancer le tutoriel AutoFormation sur Ilustrator 10echo I- Appuyer sur la touche clavier I pour lancer le tutoriel AutoFormation sur Ilustrator v1echo L- Appuyer sur la touche clavier L pour lancer le tutoriel AutoFormation sur Ilustrator v2echo M- Appuyer sur la touche clavier M pour lancer le tutoriel AutoFormation sur InDesignCsecho N- Appuyer sur la touche clavier N pour lancer le tutoriel AutoFormation sur IReady Photo 5.5echo O- Appuyer sur la touche clavier O pour lancer le tutoriel AutoFormation sur PhotoShop Csecho.Choice /c:onmlihgfedcba /n /t:a,90 Choisissez le programme de autoformation a executer.If errorlevel 13 goto lancer_acrobatif errorlevel 12 goto lancer_excelif errorlevel 11 goto lancer_wordif errorlevel 10 goto lancer_Filemaker if Errorlevel 9 goto lancer_officexpif errorlevel 8 goto lancer_Dreamweaver if errorlevel 7 goto lancer_flashif errorlevel 6 goto lancer_ilustrator10if errorlevel 5 goto lancer_ilustratorv1if errorlevel 4 goto lancer_ilustratorv2if errorlevel 3 goto lancer_InDesignCsif errorlevel 2 goto lancer_IreadyPhotoif 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:finrem si on metrem goto debutrem 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now