IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Récupération valeur Input.


Sujet :

VBScript

  1. #1
    Membre à l'essai
    Inscrit en
    Mai 2012
    Messages
    28
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 28
    Points : 20
    Points
    20
    Par défaut Récupération valeur Input.
    Bonsoir,

    Dans un hta, je cherche à récupérer la valeur saisie dans un champs input.
    Le msg d'err que je récupère est "Objet requis"

    Merci pour votre aide.
    Spawn974

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    Sub ChxMenu4
     
    msgbox "Kikoo"
     
     
     Set var_domaine = domaine.value 
     MsgBox var_domaine
    Le formulaire :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
                <form method="POST" action="" name="form_reponse" 
    			Onsubmit="return (checkTexte(this.domaine,'Veuillez saisir le domaine dont vous dépendez (inférieur à 255 caractères).',0,255)&&
    			checkTexte(this.utilisateur,'Veuillez saisir votre compte administrateur (inférieure à 255 caractères).',0,255) &&
    			ChxMenu4());">
    			<img src="img/pixel_trans.gif"  width="150" height="1" hspace="0" vspace="0" border="0" align="left" />
    			Domaine : <input type="text" name="domaine" id="domaine" value="Bourbon" size="15" MAXLENGTH="255">
    			&nbsp;Utilisateur : <input type="text" name="utilisateur" id="utilisateur" size="15" MAXLENGTH="255" value="mOa">
    			<input type="image" SRC="img/on/Btn_val.gif" BORDER="0" ALT="Envoyer le formulaire" value="Envoyer" name="ENVOYER" hspace="0" vspace="0">
    </form>

  2. #2
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut

    Inspirez-vous de cet exemple "Login Details.hta"
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    <title>Informations sur une machine</title>
    <HTA:APPLICATION
    APPLICATIONNAME="Login Details"
    BORDER="thin"
    SCROLL="no"
    SINGLEINSTANCE="yes"
    icon="Explorer.exe"
    WINDOWSTATE="normal"></head>
     
    <script language="VBScript">
     
    Sub Window_onLoad
    Me.ResizeTo 400,300
    Me.MoveTo ((Screen.Width / 2) - 200),((Screen.Height / 2) - 150)
    End Sub
     
    Sub Default_Buttons
    If Window.Event.KeyCode = 13 Then
    btn_logindetails.Click
    End If
    End Sub
     
    Sub Get_Login_Details
    strComputer = txt_computer.value
    if strComputer = "" Then
    msgbox "Nom de machine ou adresse IP invalide",vbOKOnly,"Saisie incorrecte"
    Exit Sub
    End If
     
    If Ping(strComputer) = False Then
    msgbox "L'ordinateur " & strComputer & " ne répond pas.",vbOkOnly, "Machine introuvable"
    Exit Sub
    End If
     
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
     
    Set colComputer = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
     
    Set colComputerIP = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration")
     
    Set colSystemInfo = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem",,48)
     
    For Each objComputer in colComputer
    UsrNom = "Aucune session en cours"
    If Not IsNull(objComputer.UserName) Then UsrNom = objComputer.UserName
    strUserName = "Utilisateur : " & UsrNom
    strHostName = "Nom machine : " & objComputer.Name
    Next
     
    For Each IPConfig in colComputerIP
    If Not IsNull(IPConfig.IPAddress) Then
    For intIPCount = LBound(IPConfig.IPAddress) _
    to UBound(IPConfig.IPAddress)
    strIPAddress = strIPAddress & "Adresse IP : " & IPConfig.IPAddress(intIPCount) & "~"
    next
    end if
    Next
     
    If Right(strIPAddress, 1) = "~" Then
    strIPAddress = Left(strIPAddress, Len(strIPAddress) - 1)
    End If
    strIPAddress = Replace(strIPAddress, "~", vbCrLf)
     
    For Each objItem in colSystemInfo
    strOS_Caption = "Système : " & objItem.Caption
    strOS_SPVersion = "Version SP : " & objItem.CSDVersion
    strOS_VerNumber = "N° Version : " & objItem.Version
    Next
     
    MsgBox strUserName & vbcrlf & strHostName & vbcrlf & _
    strIPAddress & vbcrlf & strOS_Caption & vbcrlf & _
    strOS_SPVersion & vbcrlf & strOS_VerNumber, vbOKOnly, "Informations"
    End Sub
     
    Function Ping(strComputer)
    Dim objShell, boolCode
    Set objShell = CreateObject("WScript.Shell")
    boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
    If boolCode = 0 Then
    Ping = True
    Else
    Ping = False
    End If
    End Function
    </script>
     
    <body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
    (GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
    <table width='80%' height = '100%' align='center' border='0'><tr height='20%'><td></td></tr>
    <tr height='10%'><td align='center'>Nom machine ou adresse IP :</td></tr
    <tr height='20%'><td align='center'>
    <input type="text" value="127.0.0.1" name="txt_computer" maxlength='255' size='15'>
    </td></tr><tr height='30%'><td align='center'>
    <input type="Button" value="Lancer le test" name="btn_logindetails"  onClick="Get_Login_Details">
    </td></tr><tr height='20%'><td></td></tr></table></body>

  3. #3
    Membre à l'essai
    Inscrit en
    Mai 2012
    Messages
    28
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 28
    Points : 20
    Points
    20
    Par défaut
    Bonsoir,

    J'ai résolu mon problème.
    J'étais trop accès sur le html.
    J'ai enlevé le form et mis mes actions Js sur les inputs etc.

    Depuis cela fonctionne.

    Merci pour tout.

  4. #4
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 840
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 840
    Points : 9 225
    Points
    9 225
    Par défaut

    On est tous intéressé par votre solution, si vous ne trouviez pas aucun inconvénient de nous la partager car ça peut apporter de l'aide à d'autres membres

  5. #5
    Membre à l'essai
    Inscrit en
    Mai 2012
    Messages
    28
    Détails du profil
    Informations forums :
    Inscription : Mai 2012
    Messages : 28
    Points : 20
    Points
    20
    Par défaut Code...
    Bonsoir à tous,
    Voici enfin le code finalisé comme demandé.

    @+

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    	<script language="JavaScript" src="/js/rollover.js"></script>
    	<script language="JavaScript" src="/js/checkForm.js"></script>
    	<title>Sauvegarde EndUser avant migration 1.5 (GUI)</title>
    <HTA:APPLICATION
      APPLICATIONNAME="SafeMigr"
      ID="AppSauvegardeEndUser"
      VERSION="1.5"
      ICON="img/favicon.ico"
      SCROLL="no"
      SCROLLFLAT="yes"
      CONTEXTMENU="no"
      NAVIGABLE="yes"
      SINGLEINSTANCE="NO"
      SELECTION="no"/>
    		<script language="VBScript">
    			Sub Window_onLoad
    				' msgbox "Msg de test vbs ""Bonjour le monde""",vbExclamation ,"Msg de Test"
    				window.moveTo 150,150
    				window.resizeTo 729,500
    			End Sub
    		' -------------------------------------------------------------
    		' 1.Assignation lettre Q ࡬a cl顕SB
    		' J'aurais pu faire une boucle pour le menu ;)
    		' -------------------------------------------------------------
    			Sub ChxMenu1
    				Set WshShell = CreateObject("WScript.Shell")
    				Lettre = WshShell.CurrentDirectory
    				Dim Com,Result,Reponse
    				Reponse=MsgBox("Merci ré-ouvrir l'application ""SafeMigr"" après ce batch.", vbYesNo, "Message...")
    				if Reponse = vbYes then
    					'Msgbox Lettre	
    					Com="cmd /k "& Lettre &"\code\AssiLectQUsb.bat"
    					Result=WshShell.Run(Com,0,False) 'Option 1 Console Visible.Option 0 Console Invisible
    					WshShell.Run "taskkill /f /im mshta.exe", ,True
    					Set WshShell = Nothing
    				else
    					Set WshShell = Nothing
    				End If
    			End Sub
     
    		' -------------------------------------------------------------
    		' 2.Rꤵp곡tion documents Pack Office, Multimꥩas, Cao Dao...
    		' -------------------------------------------------------------
    			Sub ChxMenu2
    				Set WshShell = CreateObject("WScript.Shell")
    				Lettre = WshShell.CurrentDirectory
    				Dim Com,Result
    					'Msgbox Lettre	
    				Com="cmd.exe /c "& Lettre &"\code\Docs.bat"
    					'Msgbox Com
    				Result=WshShell.Run(Com,1,True)
    			Set WshShell = Nothing 
    			End Sub
     
    		' -------------------------------------------------------------
    		' 3.Sauvegarde profil (Outlook, Lotus, Mozilla...)
    		' -------------------------------------------------------------
    			Sub ChxMenu3
    				Set WshShell = CreateObject("WScript.Shell")
    				Lettre = WshShell.CurrentDirectory
    				Dim Com,Result
    					'Msgbox Lettre	
    				Com="cmd /c "& Lettre &"\code\Profil.bat"
    				Result=WshShell.Run(Com,1,True)
    			Set WshShell = Nothing 
    			End Sub
     
    		' -------------------------------------------------------------
    		' 4.Rꤵp곥r la configuration mat곩el, logiciel du PC 
    		' -------------------------------------------------------------
     
    			Sub ChxMenu4
    			' MsgBox "Sub en action... :"
    				var_domaine = document.getElementsByName("domaine")
    			' MsgBox "Le domaine est : " & var_domaine.value
     
    				var_utilisateur = document.getElementsByName("utilisateur")
    			' MsgBox "L'ID est : " & var_utilisateur.value
     
    				Set WshShell = CreateObject("WScript.Shell")
    				Lettre = WshShell.CurrentDirectory
    				Dim Com,Result
    			' Msgbox Lettre	
    				'Com="cmd /c "& Lettre &"\Pre-config.bat" 
    				Com="cmd /c runas /user:"& var_domaine.value &"\"& var_utilisateur.value &" "& Lettre &"code\Config.bat"
    			' Msgbox Com
    				Result=WshShell.Run(Com,1,True)
    				Set WshShell = Nothing 
    			End Sub
     
    		' -------------------------------------------------------------
    		' .Acc鳠aide
    		' -------------------------------------------------------------
    			Sub Aide
    				Set WshShell = CreateObject("WScript.Shell")
    				Lettre = WshShell.CurrentDirectory
    				Dim Com,Result
    					'Msgbox Lettre	
    				Com=""& Lettre &"\code\HowTo.chm"
    				Result=WshShell.Run(Com,1,True)
    			Set WshShell = Nothing 
    			End Sub
    		</script>
    </head>
     
    <body marginwidth="0" marginheight="0" >
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    	<tr>
    		<td valign="top" align="center">
    		<table border="0" cellpadding="0" cellspacing="0">
    			<tr>
    				<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td colspan="2"><img src="img/Titre.gif" alt="Gestion automatis&eacute;e de la sauvegarde avant migration" width="665" height="57" /</td>
                        </tr>
                        <tr>
                          <td colspan="2" align="justify"><h5>Cet utilitaire permet de sauvegarder les documents Office, multimedias, Cao/Dao<br>
    						De plus il r&eacute;cup&egrave;re toutes les informations li&eacute;es au profil (Outlook, Mozilla, Lotus)<br>
    						et enfin liste la configuration materiel et logiciel de la machine.<br>
    						Toutes les actions sont en mode silencieux ces derni&egrave;res sont stock&eacute;es dans les<br>
    						fichiers de log du type &quot;UsernameProfil.log&quot;, &quot;COMPUTERNAMEConfig.log&quot;, &quot;UsernameDocs.log&quot;<br></h5>
    					</td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
    							<td colspan="2"><img src="img/pixel_trans.gif"  width="150" height="1" hspace="0" vspace="0" border="0" align="left" />
    								<button type="button" name="Choix1"  class="Bouton"
    									onclick="ChxMenu1();"
    									onMouseOver="return rollover_on(Choix1, 'img/on/Btn_val_on.gif');"
    									onMouseOut="return rollover_off(Choix1);">
    									<img src="img/off/Btn_val_off.gif" alt="Choix 1 - Assigne si necessaire la lettre Q:\ &agrave; la cl&eacute; USB" name="Choix1" hspace="0" vspace="0" border="0" align="absmiddle" />Assigne la lettre Q:\ &agrave; la cl&eacute; USB
    								</button>
    							</td>
                            </tr>
                            <tr>
    							<td colspan="2"><img src="img/pixel_trans.gif"  width="150" height="1" hspace="0" vspace="0" border="0" align="left" />
    								<button type="button" name="Choix2"  class="Bouton"
    									onclick="ChxMenu2();"
    									onMouseOver="return rollover_on(Choix2, 'img/on/Btn_val_on.gif');"
    									onMouseOut="return rollover_off(Choix2);">
    									<img src="img/off/Btn_val_off.gif" alt="Choix 2 - R&eacute;cup鳥 fichiers avec extensions Pack Office, Cao/Dao, Multim&eacute;dias" name="Choix2" hspace="0" vspace="0" border="0" align="absmiddle" />R&eacute;cup&eacute;ration documents PO, Multim&eacute;dias, Cao/Dao...
    								</button>
    							</td>
                            </tr>
                            <tr>
    							<td colspan="2"><img src="img/pixel_trans.gif"  width="150" height="1" hspace="0" vspace="0" border="0" align="left" />
    								<button type="button" name="Choix3"  class="Bouton"
    									onclick="ChxMenu3();"
    									onMouseOver="return rollover_on(Choix3, 'img/on/Btn_val_on.gif');"
    									onMouseOut="return rollover_off(Choix3);">
    									<img src="img/off/Btn_val_off.gif" alt="Choix 3 - Sauvegarde le profil Complet de l'utilisateur concern&eacute;" name="Choix3" hspace="0" vspace="0" border="0" align="absmiddle" />Sauvegarde le profil Complet de l'utilisateur concern&eacute;.
    								</button>
    							</td>
                            </tr>
                            <tr>
    							<td colspan="2" align="left"><img src="img/pixel_trans.gif" width="150" height="1" hspace="0" vspace="0" border="0" align="left" />
    								<a href="#"   
    									OnClick="document.getElementById('Aff_form').style.display='block';return false;"
    									OnmouseOver="return rollover_on(Choix4bis, 'img/on/Btn_val_on.gif');"
    									OnmouseOut="return rollover_off(Choix4bis);">
    									<img src="img/off/Btn_val_off.gif" alt="R&eacute;cup&eacute;rer configuration mat&eacute;riel, logiciel du PC" name="Choix4bis" hspace="0" vspace="0" border="0" align="absmiddle" /><b>R&eacute;cup&eacute;rer configuration mat&eacute;riel, logiciel du PC</b>
    								</a>
    							</td>
                            </tr>
                            <tr>
                            <td>
    							<div id="Aff_form" style="display:none;" align="right">	
    								<form action="" 
    									OnSubmit="return checkTexte(this.domaine, 'Domaine S.V.P') &&
    									checkTexte(this.utilisateur, 'Saisissez votre ID admin.') && ChxMenu4();"
    									onMouseOver="return rollover_on(Choix4, 'img/pixel_trans.gif');"
    									onMouseOut="return rollover_off(Choix4);">
    										Domaine : <input type="text" name="domaine">
    										Utilisateur : <input type="text" name="utilisateur">
    										<input type="image" SRC="img/off/Btn_val2_off.gif" BORDER="0" ALT="Valider vos informations" value="Valider" name="Valider">
    										<img src="img/pixel_trans.gif" name="Choix4" hspace="0" vspace="0" border="0" align="absmiddle" />
    								</form>
    							</div>
    						</td>
    						<td align="right">
    							<button type="button" name="Quitter" class="BoutonNav"
    									onclick="opener=self;self.close()"
    									onMouseOver="return rollover_on(Quitter, 'img/on/Btn_fer_on.gif');"
    									onMouseOut="return rollover_off(Quitter);">
    									<img src="img/off/Btn_fer_off.gif" alt="Quitter l'utilitaire..." name="Quitter" hspace="0" vspace="0" border="0" align="right" />
    							</button>
    						</td>
                            </tr>
                          </table>
    					 </td>
                        </tr>
                       <tr>
    						<td>&nbsp;<!-- <a href="#" onClick="document.getElementById('Aff_form').style.display='none';return false;">Cacher</a> --></td>
    						<td align="right">
    							<button type="button" name="Howto" class="BoutonNav"
    									onclick="Aide();"
    									onMouseOver="return rollover_on(Howto, 'img/on/Btn_Aide_on.gif');"
    									onMouseOut="return rollover_off(Howto);">
    									<img src="img/off/Btn_Aide_off.gif" alt="Comment cela fonctionne..." name="Howto" hspace="0" vspace="0" border="0" align="right" />
    							</button>
    						</td>
                        </tr>
                        <tr>
                          <td colspan="2" align="right"><img src="img/Footer.gif" alt="Pied de page" width="666" height="34" /></td>
                        </tr>
                      </table>
    				</td>
    			</tr>
    		</table>
    		</td>
    	</tr>
    </table>
    </body>
    </html>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Récupération valeur input
    Par Belokanfr dans le forum Général JavaScript
    Réponses: 8
    Dernier message: 04/07/2011, 14h38
  2. [MySQL] récupération valeur input
    Par kOrt3x dans le forum PHP & Base de données
    Réponses: 11
    Dernier message: 12/08/2010, 14h59
  3. Récupération valeur Input dans une URL
    Par kilian dans le forum Général JavaScript
    Réponses: 9
    Dernier message: 01/07/2009, 18h18
  4. Récupération de valeur input et enregistrement auto quand deselectionné
    Par Lexarino dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 25/09/2008, 11h17
  5. Réponses: 9
    Dernier message: 14/08/2007, 09h05

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo