google chrome - Opening Browser Instances from different Vendors -
i know subject little bit weird, have given because got requirement client open ie instance chrome browser.
i know question has been asked many times, since it's client requirement can't ignore. have upgraded application on latest browser 1 of functionalities still supported ie browsers only. know 1 way can create hta file , open default browser still it's big pain integrate hta in javascript(please let me know if ideas). creating activexobject wscript.shell in chrome browser pain.
please guide me how can impress client it's small business.
thanks
here example of hta showing how open links ie, chrome ,firefox , default browser , how pass command line.
<html> <head> <hta:application applicationname="open links ie, chrome , firefox , how pass command line" border="thin" borderstyle="normal" icon="explorer.exe" innerborder="no" maximizebutton="no" minimizebutton="no" scroll="no" selection="no" singleinstance="yes"/> <title>open links ie, chrome , firefox , how pass command line</title> <script language="vbscript"> '************************************************************************************ option explicit function executer(strcmd,console) dim ws,mycmd,resultat set ws = createobject("wscript.shell") 'la valeur 0 pour cacher la console ms-dos if console = 0 mycmd = "cmd /c " & strcmd & " " resultat = ws.run(mycmd,console,true) if resultat = 0 'msgbox "success" else msgbox "une erreur inconnue est survenue !",16,"une erreur inconnue est survenue !" end if end if 'la valeur 1 pour montrer la console ms-dos if console = 1 mycmd = "cmd /k " & strcmd & " " resultat = ws.run(mycmd,console,false) if resultat = 0 'msgbox "success" else msgbox "une erreur inconnue est survenue !",16,"une erreur inconnue est survenue !" end if end if executer = resultat end function '************************************************************************************ sub window_onload() centerwindow 480,400 end sub '************************************************************************************ sub centerwindow(x,y) dim ileft,itop window.resizeto x,y ileft = window.screen.availwidth/2 - x/2 itop = window.screen.availheight/2 - y/2 window.moveto ileft,itop end sub '************************************************************************************ sub ip_publique() dim titre,url,ie,objfso,data,output,objregex,match,matches,ip_public titre = "adresse ip publique !" url = "http://monip.org" if online("smtp.gmail.com") = true set ie = createobject("internetexplorer.application") set objfso = createobject("scripting.filesystemobject") ie.navigate (url) ie.visible=false while ie.busy sleep 100 loop data = ie.document.documentelement.innertext set objregex = new regexp objregex.pattern = "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" objregex.global = false objregex.ignorecase = true set matches = objregex.execute(data) each match in matches msgbox "votre ip publique est : "& match.value,64,titre next ie.quit set ie = nothing else msgbox "vérifier votre connexion internet puis re-executer ce script",48,titre exit sub end if end sub '************************************************************************************** sub sleep(msecs)'fonction pour faire une pause car wscript.sleep ne marche pas dans un hta dim fso,objoutputfile set fso = createobject("scripting.filesystemobject") dim tempfolder : set tempfolder = fso.getspecialfolder(2) dim tempname : tempname = "sleeper.vbs" if fso.fileexists(tempfolder&"\"&tempname)=false set objoutputfile = fso.createtextfile(tempfolder&"\"&tempname, true) objoutputfile.write "wscript.sleep wscript.arguments(0)" objoutputfile.close end if createobject("wscript.shell").run tempfolder&"\"&tempname &" "& msecs,1,true end sub '************************************************************************************** sub ssid_names() dim objshell,fso,file,strcontents,objregex,objmatch,colmatches set objshell = createobject("wscript.shell") set fso = createobject("scripting.filesystemobject") if executer("netsh wlan show > wlan.txt",0) = 0 set file = fso.opentextfile("wlan.txt",1) strcontents = file.readall set objregex = new regexp objregex.ignorecase = true objregex.global = true objregex.multiline = true objregex.pattern = """([^""]+)""" set colmatches = objregex.execute(strcontents) each objmatch in colmatches msgbox "ssid name: " & objmatch.value,64,"ssid name" next end if end sub '*************************************************************************************** function online(strhost) dim objping,z,objretstatus,pingstatus set objping = getobject("winmgmts:{impersonationlevel=impersonate}").execquery("select * win32_pingstatus address = '" & strhost & "'") z = 0 z = z + 1 each objretstatus in objping if isnull(objretstatus.statuscode) or objretstatus.statuscode <> 0 pingstatus = false else pingstatus = true end if next sleep 200 if z = 4 exit loop until pingstatus = true if pingstatus = true online = true else online = false end if end function '*************************************************************************************** sub wlan_networks() if executer("netsh wlan show profiles > wlan_tmp.txt & netsh wlan show networks >> wlan_tmp.txt & netsh wlan show interfaces >> wlan_tmp.txt & cmd /u /c type wlan_tmp.txt > wlan_networks.txt",0) = 0 call executer("start wlan_networks.txt & del wlan_tmp.txt",0) end if end sub </script> </head> <p>links list (examples) :</p> <ol> <li><a href="#" onclick="call executer('start iexplore.exe www.google.com',0)">lien google avec iexplore.exe</a></li> <li><a href="#" onclick="call executer('start chrome.exe http://bbat.forumeiro.com/',0)">lien bbat avec chrome.exe</a></li> <li><a href="#" onclick="call executer('start firefox.exe www.developpez.net',0)">lien developpez.net avec firefox.exe</a></li> <li><a href="#" onclick="call executer('start chrome.exe www.yahoo.fr',0)">lien yahoo avec chrome.exe</a></li> <li><a href="#" onclick="call executer('start chrome.exe www.autoitscript.fr',0)">lien autoitscript.fr (français) avec chrome.exe</a></li> <li><a href="#" onclick="call executer('start chrome.exe www.autoitscript.com',0)">lien autoitscript.com (anglais) avec chrome.exe</a></li> <li><a href="#" onclick="call executer('start www.sfr.fr',0)">lien sfr avec votre navigateur default</a></li> </ol> <body text=white bgcolor="darkorange" topmargin="1" leftmargin="1"> <center><button onclick="call executer('mode con cols=90 lines=15 & color 0a & title ping sur www.stackoverflow.com hackoo & ping www.stackoverflow.com',1)">ping on www.stackoverflow.com</button><hr> <center><button onclick="call executer('findstr /? > helpfindstrtmp.txt & cmd /u /c type helpfindstrtmp.txt > helpfindstr.txt & start helpfindstr.txt',0)">help sur findstr</button> <button onclick="call executer('ipconfig /all > configtmp.txt & cmd /u /c type configtmp.txt > myipconfig.txt & del configtmp.txt & start myipconfig.txt',0)">ipconfig</button> <button onclick="call executer('mode con cols=80 lines=50 & color 9b & title hackoo & netstat -a',1)">netstat</button> <button onclick="call executer('mode con cols=60 lines=10 & color 0a & title hackoo & arp -a',1)">arp</button><hr> <button onclick="call executer('mode con cols=80 lines=30 & color 9b & title tracert vers www.stackoverflow.com hackoo & tracert www.stackoverflow.com',1)">tracert stackoverflow</button><br><hr> <center><button onclick="call ip_publique">ip publique</button> <button onclick="call ssid_names()">ssid wlan</button> <button onclick="call wlan_networks()">wlan network</button> </center> </center> </body> </html>
Comments
Post a Comment