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

Scripts/Batch Discussion :

Script avec Interfance Graphique


Sujet :

Scripts/Batch

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Chef de projet MOA
    Inscrit en
    Janvier 2018
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Chef de projet MOA
    Secteur : Boutique - Magasin

    Informations forums :
    Inscription : Janvier 2018
    Messages : 2
    Points : 1
    Points
    1
    Par défaut Script avec Interfance Graphique
    Bonjour a tous,
    Je suis en train de créer un script en powershell pour créer une signature automatique a partir des informations recueillies sur l'active directory (annuaire).
    Pour le script j'aurais besoin de créer des fenêtres ( interfaces) pour demander l'approbation a l’utilisateur et pour que l'utilisateur puissent modifier certaines informations.
    Le script sera lancé sur les poste a l'ouverture de leur session la première fois qu'il seront connecté au domaine de l'entreprise.

    La ou j'ai du mal c'est pour créer les différentes fenêtres car les fenêtres devront être aux couleurs de l'entreprise, la police devra être paramétrable, possibilité de rajouter des images.
    Apres avoir cherche j'ai vu que il y avait trois façon de faire :
    XAML
    FORM
    WPF
    Je ne sais pas laquelle des " solutions et la plus simple mais surtout qui réponds a mes besoins, surtout que le script devra être compatibles avec tous les postes de Windows 7 a 10, et je n'ai pas la possibilité d'installer quoi que soit d'autre sur le poste.

    Merci de m'aider dans mon choix et de m'apporter des solutions (liens, tutoriel ou logiciel qui pourrait m'aider.

    Ps : Je voulais savoir si mon script que je vais creer fonctionnera sur des postes Mac (apple);
    Ps 2 : en pièces jointes la première version de mon scirpe que j'avais créer en vbs mais que j'ai du arrêter car les fenêtres n'étaient pas paramétrables.
    Code vbscript : 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
    'Affiche une fenetre pour demander l'approbation de l'utilisateur Si il reponds Non fin du script 
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Lancer = MsgBox("Voulez vous avoir la signature xxxxx?",vbYesNo,"Signature xxxx") 
    If Lancer = vbNo Then 
    Wscript.Quit
    End If
    
    
    'Prends les informations sur l'active Directory
    Set objSysInfo 	= CreateObject("ADSystemInfo")
    sUtente 		= objSysInfo.UserName
    Set objUser 	= GetObject("LDAP://" & sUtente)
    
    'Déclaration de la variable 
    uTitle 			= objUser.Title
    uTelephone 		= objUser.TelephoneNumber
    uMobile			= objuser.Mobile
    
    'Demande à l'utilisateur de confirmer sa fonction ou de la modifier 
    uDepartement = InputBox("Merci de modifier l'intitule de votre poste, si necessaire ? ","Signature xxxxx", uTitle)
    
    'Faire valider le numéro par l'utilisateur 
    uTelephone = InputBox("Merci de confirmer ou modifier le numéro de telephone", "Signature xxxxxx", uTelephone)
    umobile = InputBox("Merci de confirmer ou modifier le numéro de telephone", "Signature xxxxxx", umobile)
    
    'uStreet = InputBox("Indiquez l'emplacement de votre site",vb"Exemple: rue de provence" )
    WshShell.Popup "Merci de bien vouloir redemarrer Outlook " 
    
    On Error Resume Next
    
    ' Function to send emails via SMTP server
    Function SendMail(sFrom, sTo, sSubject, sHtmlBody)
                    Dim objMail,objConfig,objFields
                    Set objMail = CreateObject("CDO.Message")
                    Set objConfig = CreateObject("CDO.configuration")
                    Set objFields = objConfig.Fields
                    With objFields
                    .Item("http://schemas.microsoft.com/cdo/configuration/SendUsing")= 2
                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "smtp.sfrbusinessteam.fr"
                    .Item("http://schemas.microsoft.com/cdo/configuration/SMTPServerPort")= 25
                    .Update
                    End With
                    With objMail
                    Set .Configuration = objConfig
                    .From = sFrom
                    .To = sTo
                    .Cc = sCc
                    .Bcc = sBcc
                    .Subject = sSubject
                    .HTMLBody = sHtmlBody
                    .Send
                    End With
    End Function
    
    ' # Prends les informations des users sur l'active Directory
    Set objSysInfo 	= CreateObject("ADSystemInfo")
    sUtente 		= objSysInfo.UserName
    Set objUser 	= GetObject("LDAP://" & sUtente)
    uFirstName 		= objUser.givenName
    uName 			= objUser.sn
    'uTitle 			= objUser.Title
    
    if Len(umobile)>0 Then
    		uMobile 		= "Mob: " & umobile
    	else
    		uMobile 		= ""
    	end if
    uMail			= objUser.mail
    uStreet 		= objUser.StreetAddress
    uPostal 		= objUser.PostalCode
    uCity 			= objUser.l
    
    uDepartement     'Pour afficher le departement des users ex: Direction informatique Production Systemes
    
    ' # Send email to administrator
    sHtmlBody	=	sUtente & "<br/>FirstName: " & uFirstName & "<br/>Name: " & uName & "<br/>Title: " &  uTitle & "<br/>Telephone: " & uTelephone & "<br/>Mobile: " & uMobile & "<br/>Street: " & uStreet & "<br/>Postal code: " & uPostal & "<br/>City: " & uCity
    sSubject	=	"Signature automatique pour [" & uFirstName & " " & uName & "]"
    Call SendMail("Automatic script <xxx@>", "Admin <xxxx@>", sSubject, sHtmlBody)
    
    ' # Log to file
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Set myLog  = objFSO.OpenTextFile("t:\my.log", 8, True)
    Set myLog  = objFSO.OpenTextFile(Wscript.ScriptFullName & ".log", 8, True)
    'curDate =  Year(Date) & "." & Month(Date) & "." & Day(Date) & " " & Time
    curDate =  Date & " " & Time
    myLog.Write curDate & " * " & sSubject & vbCrlf
    myLog.Close
    
    ' # Create the Word document using COM objects Back2Line  =	chr(11)
    vBack2Line	 =	chr(11)
    vColorBlack	 =	RGB(0,0,0) '6299648
    'vColorGray	 =	RGB(128,128,128) '8418944
    'vCompanyName =	"xxxxx"
    'vCompanyUrl  =	"www.xxxx.com"
    'vCompanyLink =	"http://www.xxxxx.com"
    If uStreet = "98 rue de la xxxx"	Then
    	vLogoImage = "https://xxx.jpg"
    	End If 
    Set objWord = CreateObject("Word.Application")
    Set objDoc = objWord.Documents.Add()
    Set objSelection = objWord.Selection
    Set objEmailOptions = objWord.EmailOptions
    Set objSignatureObject = objEmailOptions.EmailSignature
    Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
    objSelection.Font.Name = "xxxxx Sans"
    objSelection.Font.Size = 10
    objSelection.TypeParagraph()
    objSelection.Font.Color = vColorBlack
    'objSelection.TypeText "Cordialement,"
    objSelection.TypeText vBack2Line
    objSelection.Font.Bold = True 'youssef
    objSelection.TypeText uFirstName & " "
    'objSelection.Font.Bold = True
    objSelection.TypeText uName
    objSelection.Font.Bold = False
    objSelection.Font.Name = "xxxxx Sans Light"
    objSelection.Font.Size = 10
    objSelection.TypeText vBack2Line
    'objSelection.TypeText uTitle
    'objSelection.TypeText vBack2Line    
    objSelection.TypeText uDepartement 'Youssef 
    objSelection.TypeText vBack2Line
    objSelection.Font.Color = vcolorBlack 'vColorGray
    objSelection.TypeText "Tel:" & uTelephone 
    If  Len(umobile)>0 Then	
    		objSelection.TypeText vBack2Line
    		objSelection.Typetext uMobile
    	else
    		uMobile 		= "" 
    	End if 
    objSelection.Font.Color = vColorBlack'vColorGray
    objSelection.TypeText vBack2Line
    objSelection.TypeText uMail'youssef
    'objSelection.TypeText vBack2Line
    'objSelection.TypeText uStreet & " - " & uPostal & " " & uCity
    'objSelection.TypeText vBack2Line
    'objSelection.TypeText vBack2Line
    'Set objLink = objSelection.Hyperlinks.Add(objSelection.Range, vCompanyLink,,, vCompanyUrl)
    'objLink.Range.Font.Color = vColorBlue
    'objLink.Range.Font.Name = "xxxx Sans Light" readhost
    'objLink.Range.Font.Size = 10 
    'ObjLink.Range.Font.Bold = true
    objSelection.TypeText vBack2Line
    objSelection.InlineShapes.AddPicture(vLogoImage)
    Set objSelection = objDoc.Range()
    
    ' # Set the signature for new mail
    TitleNew=vCompanyName & " Signature xxxxx Envoie "        
    objSignatureEntries.Add TitleNew, objSelection      
    objSignatureObject.NewMessageSignature = TitleNew   
    
    ' # Set the signature for reply
    TitleReply=vCompanyName & " Signature xxxxx Reponse"    
    objSignatureEntries.Add TitleReply, objSelection     
    objSignatureObject.ReplyMessageSignature = TitleReply
    
    ' # Save the document
    objDoc.Saved = True
    objWord.Quit
    
    Dim WshShell
    Set WshShell 	= CreateObject("WScript.Shell")
    WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Office\14.0\Common\MailSettings\NewSignature", TitleNew, "REG_EXPAND_SZ" 
    WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Office\14.0\Common\MailSettings\ReplySignature", TitleReply, "REG_EXPAND_SZ" 
    'WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Office\14.0\Common\General\Signatures", "Signatures", "REG_SZ"
    'WshShell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrrentVersion\Explorer\TypedPaths\url3", "%userprofile%\Application Data\Microsoft\Signatures", "REG_SZ"
    'Set objSysInfo = nothing

  2. #2
    Nouveau Candidat au Club
    Homme Profil pro
    Chef de projet MOA
    Inscrit en
    Janvier 2018
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 28
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Chef de projet MOA
    Secteur : Boutique - Magasin

    Informations forums :
    Inscription : Janvier 2018
    Messages : 2
    Points : 1
    Points
    1
    Par défaut
    UP ??

Discussions similaires

  1. Problème avec accelerateur graphique
    Par Info-Rital dans le forum Applications et environnements graphiques
    Réponses: 8
    Dernier message: 05/06/2007, 01h13
  2. Réponses: 2
    Dernier message: 12/06/2005, 15h46
  3. Réponses: 4
    Dernier message: 02/11/2004, 15h18
  4. Script avec JOINTURE et CASE
    Par Labienus dans le forum Langage SQL
    Réponses: 6
    Dernier message: 27/02/2004, 09h40
  5. Application multiplateforme avec interface graphique
    Par TNorth dans le forum Choisir un environnement de développement
    Réponses: 2
    Dernier message: 31/01/2004, 18h55

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