Jump to content

subscript used with non-array variable


Recommended Posts

I don't understand the problem :

This script run on my computer (I am administrator....)

(( Same if we are not administrator the program must run ))

But same in administrator on an other computer, i have this error message ==>> "subscript used with non-array variable".

And I see where is this problem in the code, but I don't understand.

In fact the problem is here :

Func Ecris_differences_Fichier ( $NomFichierDifferences, $Differences )
    Local $fichier
    Local $WriteToFile_3

    $fichier = FileOpen ( $NomFichierDifferences, 1 ); Ecriture à la fin du fichier
    If $fichier = -1 Then; (erreur)
        Return 0
    EndIf
    MsgBox ( 0, "8", $Differences ) 
    $Ouv_Fichier1 = FileOpen ( $fichier, 1 )
    If $Ouv_Fichier1 = -1 Then
        MsgBox ( 0, "", "impossible d'ouvrir le fichier " & $fichier )
    EndIf
    $WriteToFile_3 = FileWriteLine ( $fichier, $Differences )
    If $WriteToFile_3 = -1 Then
        Return 0
    EndIf
    FileClose ( $fichier )
    $Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & $Differences )
    RunWait ( $Raccourci[0] & " " & $Raccourci[2] , "", @SW_MAXIMIZE )
    Return 1
EndFunc

At the line :

RunWait ( $Raccourci[0] & " " & $Raccourci[2] , "", @SW_MAXIMIZE )

My complete code is:

#include <Process.au3>
#include <File.au3>
#Include <Date.au3>
#include <Array.au3>

#comments-start

Ce programme sert à déployer des installations de programmes de façon silencieuse et automatique sur chaque poste client.
Il met à jour chaque poste client à partir de la liste de programmes silencieux situés dans le dossier "\\ppc-erp\produits$\Soft\Silent\".

Programme réalisé avec la version 3.2.10.0 de AutoIt.

#comments-end


Opt ( "WinWaitDelay", 280 )
Opt ( "MouseClickDelay", 10 )
Opt ( "MouseClickDragDelay", 250 )

; Masque l'icône du programme dans la zone de notification :
;Opt ( "TrayIconHide", 1 )

Dim $drive, $drive2

; ########################################################################################
; Montage du lecteur réseau " \\ppc-erp\produits$" :
$dg1    = DriveMapGet ( "a:" )
$dg2    = DriveMapGet ( "b:" )
$dg3    = DriveMapGet ( "c:" )
$dg4    = DriveMapGet ( "d:" )
$dg5    = DriveMapGet ( "e:" )
$dg6    = DriveMapGet ( "f:" )
$dg7    = DriveMapGet ( "g:" )
$dg8    = DriveMapGet ( "h:" )
$dg9    = DriveMapGet ( "i:" )
$dg10   = DriveMapGet ( "j:" )
$dg11   = DriveMapGet ( "k:" )
$dg12   = DriveMapGet ( "l:" )
$dg13   = DriveMapGet ( "m:" )
$dg14   = DriveMapGet ( "n:" )
$dg15   = DriveMapGet ( "o:" )
$dg16   = DriveMapGet ( "p:" )
$dg17   = DriveMapGet ( "q:" )
$dg18   = DriveMapGet ( "r:" )
$dg19   = DriveMapGet ( "s:" )
$dg20   = DriveMapGet ( "t:" )
$dg21   = DriveMapGet ( "u:" )
$dg22   = DriveMapGet ( "v:" )
$dg23   = DriveMapGet ( "w:" )
$dg24   = DriveMapGet ( "x:" )
$dg25   = DriveMapGet ( "y:" )
$dg26   = DriveMapGet ( "z:" )

If $dg1 = "\\ppc-erp\produits$" Then
    $drive = "a:"
ElseIf $dg2 = "\\ppc-erp\produits$" Then
    $drive = "b:"
ElseIf $dg3 = "\\ppc-erp\produits$" Then
    $drive = "c:"
ElseIf $dg4 = "\\ppc-erp\produits$" Then
    $drive = "d:"
ElseIf $dg5 = "\\ppc-erp\produits$" Then
    $drive = "e:"
ElseIf $dg6 = "\\ppc-erp\produits$" Then
    $drive = "f:"
ElseIf $dg7 = "\\ppc-erp\produits$" Then
    $drive = "g:"
ElseIf $dg8 = "\\ppc-erp\produits$" Then
    $drive = "h:"
ElseIf $dg9 = "\\ppc-erp\produits$" Then
    $drive = "i:"
ElseIf $dg10 = "\\ppc-erp\produits$" Then
    $drive = "j:"
ElseIf $dg11 = "\\ppc-erp\produits$" Then
    $drive = "k:"
ElseIf $dg12 = "\\ppc-erp\produits$" Then
    $drive = "l:"
ElseIf $dg13 = "\\ppc-erp\produits$" Then
    $drive = "m:"
ElseIf $dg14 = "\\ppc-erp\produits$" Then
    $drive = "n:"
ElseIf $dg15 = "\\ppc-erp\produits$" Then
    $drive = "o:"
ElseIf $dg16 = "\\ppc-erp\produits$" Then
    $drive = "p:"
ElseIf $dg17 = "\\ppc-erp\produits$" Then
    $drive = "q:"
ElseIf $dg18 = "\\ppc-erp\produits$" Then
    $drive = "r:"
ElseIf $dg19 = "\\ppc-erp\produits$" Then
    $drive = "s:"
ElseIf $dg20 = "\\ppc-erp\produits$" Then
    $drive = "t:"
ElseIf $dg21 = "\\ppc-erp\produits$" Then
    $drive = "u:"
ElseIf $dg22 = "\\ppc-erp\produits$" Then
    $drive = "v:"
ElseIf $dg23 = "\\ppc-erp\produits$" Then
    $drive = "w:"
ElseIf $dg24 = "\\ppc-erp\produits$" Then
    $drive = "x:"
ElseIf $dg25 = "\\ppc-erp\produits$" Then
    $drive = "y:"
ElseIf $dg26 = "\\ppc-erp\produits$" Then
    $drive = "z:"
Else
    If $drive = "" Then
        If DriveStatus( "u:\" ) = "INVALID" Then
            DriveMapAdd ( "u:", "\\ppc-erp\produits$" )
            $drive2 = "u:"
        ElseIf DriveStatus( "v:\" ) = "INVALID" Then
            DriveMapAdd ( "v:", "\\ppc-erp\produits$" )
            $drive2 = "v:"
        ElseIf DriveStatus( "w:\" ) = "INVALID" Then
            DriveMapAdd ( "w:", "\\ppc-erp\produits$" )
            $drive2 = "w:"
        ElseIf DriveStatus( "x:\" ) = "INVALID" Then
            DriveMapAdd ( "x:", "\\ppc-erp\produits$" )
            $drive2 = "x:"
        ElseIf DriveStatus( "y:\" ) = "INVALID" Then
            DriveMapAdd ( "y:", "\\ppc-erp\produits$" )
            $drive2 = "y:"
        ElseIf DriveStatus( "z:\" ) = "INVALID" Then
            DriveMapAdd ( "y:", "\\ppc-erp\produits$" )
            $drive2 = "z:"
        EndIf
    Else
    EndIf
EndIf

If $drive = "" Then
    MsgBox ( 0, "1", "Le lecteur réseau a été créé" )
; Répertoire qui contient le fichier executable du programme.
    $Dossier_Deploiement        = $drive2 & "\Soft\__DEPLOIEMENT__\"
; Fichier texte qui contient les raccourcis des programmes silencieux.
    $chemin_serveur             = $drive2 & "\Soft\Deploy_Serveur.txt"
; Répertoire qui contient les raccourcis des programmes silencieux.
    $chemin_logiciels_serveur   = $drive2 & "\Soft\Silent\"
Else
    MsgBox ( 0, "1", "Le lecteur réseau existait déjà" )
    $Dossier_Deploiement        = $drive & "\Soft\__DEPLOIEMENT__\"
    $chemin_serveur             = $drive & "\Soft\Deploy_Serveur.txt"
    $chemin_logiciels_serveur   = $drive & "\Soft\Silent\"
EndIf

If Not FileExists ( @HomeDrive & "\Deploy" ) Then
    DirCreate ( @HomeDrive & "\Deploy" )
    If FileExists ( @HomeDrive & "\Deploy" ) Then
        MsgBox ( 0, "2", "Le répertoire " & @HomeDrive & "\Deploy a bien été créé" )
    Else
        MsgBox ( 0, "2", "Le répertoire " & @HomeDrive & "\Deploy n'a pas pu être créé" )
    EndIf
EndIf

$Chemin_Programme               = $Dossier_Deploiement & "Deploiement_Logiciels.exe"
$Chemin_Programme_Client        = @HomeDrive & "\Deploy\#Deploiement_Logiciels.exe"
$Chemin_Clients                 = @HomeDrive & "\Deploy_Client.txt"; Fichier qui se situe sur chaque poste client.
$Fichier_Difference             = @HomeDrive & "\Différences.txt"

; On vérifie si l'écécutable "#Deploiement_Logiciels.exe" existe ou pas sur le poste client, 
; auquel cas on le copie du serveur à la racine de son disqque dur. 
; Si le fichier existe déjà, on compare les dates des fichiers, entre le fichier stocké sur le serveur 
; et le fichier stocké en local sur le poste cleint (sur l'année et le mois). Si ceux ci ont une date différente,
; on refait une copie du fichier serveur sur le poste client.
If Not FileExists ( $Chemin_Programme_Client ) Then
;   MsgBox ( 0, "", $Chemin_Programme_Client & " n'existe pas" )
    FileCopy ( $Chemin_Programme, $Chemin_Programme_Client, 1 )
    
    If FileExists ( $Chemin_Programme_Client ) Then
        MsgBox ( 0, "3", $Chemin_Programme_Client & " existe bien. Il a bien été créé." )
    Else
        MsgBox ( 0, "3", $Chemin_Programme_Client & " existe pas. Il n'a pas bien été créé." )
    EndIf
    Exit
ElseIf FileExists ( $Chemin_Programme_Client ) Then
;   MsgBox ( 0, "", $Chemin_Programme_Client & " existe" )
    $Temps_Serveur = FileGetTime ( $Chemin_Programme )
    $Temps_Client = FileGetTime ( $Chemin_Programme_Client )
    If Not @error Then
        $Annee_Mois_Serveur = $Temps_Serveur[0] & $Temps_Serveur[1]
        $Annee_Mois_Client = $Temps_Client[0] & $Temps_Client[1]
    EndIf
    If $Annee_Mois_Client <> $Annee_Mois_Serveur Then
        
        MsgBox ( 0, "3_2", $Annee_Mois_Client & " est différent de " & $Annee_Mois_Serveur )

;       MsgBox ( 0, "", $Annee_Mois_Client & " est dif " & $Annee_Mois_Serveur )
        FileCopy ( $Chemin_Programme, $Chemin_Programme_Client, 1 )
        Exit
    Else
        MsgBox ( 0, "3_2", $Annee_Mois_Client & " n'est pas différent de " & $Annee_Mois_Serveur )
        If Not ProcessExists ( "#Deploiement_Logiciels.exe" ) Then
            MsgBox ( 0, "4", "#Deploiement_Logiciels.exe n'existe pas en processus" )
            Exit
        Else
            MsgBox ( 0, "4", "#Deploiement_Logiciels.exe n'existe pas en processus" )
            If ProcessExists ( "Deploiement_Logiciels.exe" ) Then
                MsgBox ( 0, "4_3", "Deploiement_Logiciels.exe existe en processus" )
                ProcessClose ( "Deploiement_Logiciels.exe" )
                If Not ProcessExists ( "Deploiement_Logiciels.exe" ) Then
                    MsgBox ( 0, "4_5", "Deploiement_Logiciels.exe n'existe pas en processus" )
                EndIf
            EndIf
        EndIf
    EndIf
EndIf

;Func Administrateur ()
If Not IsAdmin () Then
    MsgBox ( 0, "tre", "no admin" )
    RunAsSet ( "admin", "DPPC", "password" )
    RunWait ( $Chemin_Programme_Client )
    Exit
Else
    MsgBox ( 0, "", "vous êtes admin" )
EndIf
;EndFunc

Creation_Fichier_Deploy_Serveur()
Creation_Fichier_Deploy_Client()

;###################################################################################################



##################################
; Création du fichier "\\ppc-erp\produits$\Soft\Deploy_Serveur.txt" (stocké sur le serveur) :
Func Creation_Fichier_Deploy_Serveur ()
    If FileExists ( $chemin_serveur ) Then
        MsgBox ( 0, "5", $chemin_serveur & " existe" )
        FileDelete ( $chemin_serveur )
        Sleep ( 500 )
        _FileCreate ( $chemin_serveur )
        Sleep ( 500 )
    EndIf
; Définition du dossier à analyser pour la création du fichier "Deploy_Serveur.txt",
; (avec filtrage en ne sélectionnant que les fichiers de type "raccourci" [.lnk]) :
    $recherche = FileFindFirstFile ( $chemin_logiciels_serveur & "*.lnk" )
; Vérifie si la recherche a été bonne :
    If $recherche = -1 Then
;MsgBox(0, "Erreur", "Aucun fichier/dossier trouvé.")
        Exit
    EndIf

    While 1
        $Fichier_Serveur = FileFindNextFile( $recherche ) 
        If @error Then ExitLoop
        FileWriteLine ( $chemin_serveur, $Fichier_Serveur )
    WEnd
EndFunc
; FIN de la création du fichier "Deploy_Serveur.txt".
;###################################################################################################



##################################


;###################################################################################################



##################################
; Création du fichier "@HomeDrive & "\Deploy_Client.txt" (stocké sur chaque poste client) :
Func Creation_Fichier_Deploy_Client ()
    If Not FileExists ( $Chemin_Clients ) Then
        MsgBox ( 0, "6", $Chemin_Clients & " n'existe pas" )
        _FileCreate ( $Chemin_Clients )
        If @error = 1 Or @error = 2 Then Exit
    Else
        MsgBox ( 0, "6", $Chemin_Clients & " existe" )
        $Verif_Attributs = FileGetAttrib ( $Chemin_Clients )
        If @error Then
            MsgBox ( 4096, "Erreur", "Impossible d'obtenir les attributs du fichier " & $Chemin_Clients & "." )
            Exit
        Else
; Si le fichier du poste client est en attribut caché, alors :
            If StringInStr ( $Verif_Attributs, "H" ) Then
    ; Mise en attribut visible du fichier "Deploy_Client.txt" sur les postes clients :
                FileSetAttrib ( $Chemin_Clients, "-H" )
            EndIf
        EndIf
    EndIf
EndFunc
; FIN de la création du fichier "Deploy_Client.txt".
;###################################################################################################



##################################


;###################################################################################################



##################################
; Création du fichier "@HomeDrive & "\Différences.txt" (stocké sur chaque poste client) :
Func Creation_Fichier_Differences ()
    If Not FileExists ( $Fichier_Difference ) Then
        MsgBox ( 0, "7", $Fichier_Difference & " n'existe pas" )
        _FileCreate ( $Fichier_Difference )
        If @error = 1 Or @error = 2 Then Exit
    Else
        MsgBox ( 0, "7", $Fichier_Difference & " existe" )
        $Verif_Attributs = FileGetAttrib ( $Fichier_Difference )
        If @error Then
            MsgBox ( 4096, "Erreur", "Impossible d'obtenir les attributs du fichier " & $Fichier_Difference & "." )
            Exit
        Else
; Si le fichier du poste client est en attribut caché, alors :
            If StringInStr ( $Verif_Attributs, "H" ) Then
    ; Mise en attribut visible du fichier "Différences.txt" sur les postes clients :
                FileSetAttrib ( $Fichier_Difference, "-H" )
            EndIf
        EndIf
    EndIf
EndFunc
; FIN de la création du fichier "Différences.txt".
;###################################################################################################



##################################

; Cette fonction ajoute un message dans un fichier.
; Elle retourne 0 en cas d'échec.
; Elle retourne 1 en cas de succès.
Func Ecris_differences_Fichier ( $NomFichierDifferences, $Differences )
    Local $fichier
    Local $WriteToFile_3

    $fichier = FileOpen ( $NomFichierDifferences, 1 ); Ecriture à la fin du fichier
    If $fichier = -1 Then; (erreur)
        Return 0
    EndIf
    MsgBox ( 0, "8", $Differences )
    $Ouv_Fichier1 = FileOpen ( $fichier, 1 )
    If $Ouv_Fichier1 = -1 Then
        MsgBox ( 0, "", "impossible d'ouvrir le fichier " & $fichier )
    EndIf
    $WriteToFile_3 = FileWriteLine ( $fichier, $Differences )
    If $WriteToFile_3 = -1 Then
        Return 0
    EndIf
    FileClose ( $fichier )
    $Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & $Differences )
    RunWait ( $Raccourci[0] & " " & $Raccourci[2] , "", @SW_MAXIMIZE )
    Return 1
EndFunc


; Ouvre le 1er fichier (fichier du serveur "Deploy_Serveur.txt" :
$File_1 = FileOpen ( $chemin_serveur, 0 )
If $File_1 = -1 Then
    MsgBox ( 0, "Erreur", "Impossible d'ouvrir le fichier : " & $chemin_serveur )
    Exit
EndIf

; Ouvre le 2e fichier (fichier du client "Deploy_Client.txt" :
$File_2 = FileOpen ( $Chemin_Clients, 0 )
If $File_2 = -1 Then
    MsgBox ( 0, "Erreur", "Impossible d'ouvrir le fichier : " & $Chemin_Clients )
    FileClose ( $File_1 )
    Exit
EndIf

While 1
    $Line_1 = FileReadLine ( $File_1 ); Lecture du fichier serveur "Deploy_Serveur.txt" :
    If @error = -1 Then ExitLoop
; On vérifie la présence de chaque ligne du 1er fichier (fichier serveur) dans le 2e fichier (fichier poste client).
; Si une occurence exacte est trouvée, on stoppe la vérification dans le fichier "Deploy_client.txt" et lisons la prochaine ligne
; dans le fichier "Deploy_serveur.txt".
; Si on arrive à la fin du 2e fichier, cela signifie qu'il n'y a aucune occurence trouvée, donc on écris cette
; occurence non trouvée dans le fichier "Différences.txt" et continuons la lecture du 1er fichier.
    While 1
        $Line_2 = FileReadLine ( $File_2 ); Lecture fichier poste client "Deploy_Client.txt" :
        If @error = -1 Then
; La fin du 2e fichier est terminé sans avoir trouvé une occurence exacte.
            Creation_Fichier_Differences ()
            Ecris_differences_Fichier ( $Fichier_Difference, $Line_1 )
            ExitLoop
        Else
            If $Line_2 = $Line_1 then
    ; Une occurence exacte est trouvée.
    ; Il est inutile de continuer de regarder dans le 2e fichier, parce que nous l'avons déjà trouvé.
    ; Quitte la boucle et lie la prochaine ligne du 1er fichier.
                ExitLoop
            Else
    ; Cette ligne dans le second fichier n'est pas la même.
    ; Lie la prochaine ligne dans le second fichier.
            EndIf
        EndIf
    Wend
    MsgBox ( 0, "#10#", "passage" )
Wend
FileClose ( $File_2 ); Fermeture du fichier poste client
FileClose ( $File_1 ); Fermeture du fichier serveur

; Changement de l'option "Afficher les fichiers et dossiers cachés" en "non visibles" si ceux-ci le sont :
$Registre_Fichiers_Caches = RegRead ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden" )
If $Registre_Fichiers_Caches = "1" Then
    RegWrite ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2" )
EndIf

; Mise en attribut caché du fichier "Deploy_Client.txt" sur les postes clients :
FileSetAttrib ( $Chemin_Clients, "+H" )
; Mise en attribut caché du fichier "Différences.txt" sur les postes clients :
FileSetAttrib ( $Fichier_Difference, "+H" )
    
; Démontage du lecteur "\\ppc-erp\produits$" :
; Nous ne démontons pas le lecteur réseau si celui-ci existait avant le lancement de ce programme.
If $drive = "" Then
    DriveMapDel ( $drive2 )
EndIf

Exit

Func OnAutoItExit ( )
    Local $Chemin_Clients               = @HomeDrive & "\Deploy_Client.txt"
    Local $Fichier_Difference           = @HomeDrive & "\Différences.txt"
    Local $Chemin_Programme_Client      = @HomeDrive & "\Deploy\#Deploiement_Logiciels.exe"
    Dim $Memoire
;If Not IsAdmin () Then 
;   MsgBox ( 0, "", "no onautoitexit")
;   Exit
;EndIf
    If Not ProcessExists ( "#Deploiement_Logiciels.exe" ) Then
        MsgBox ( 0, "11", "#Deploiements_Logiciels.exe n'existe pas en processus (onautoit exit)" )
        If FileExists ( $Chemin_Programme_Client ) Then
            If Not IsAdmin () Then
                MsgBox ( 0, "tre", "no admin" )
                MsgBox ( 0, "njk,mdgf", @ScriptDir & "\" & @ScriptName )
                RunAsSet ( "admin", "DPPC", "password" )
                RunWait ( $Chemin_Programme_Client )
                Exit
            Else
                MsgBox ( 0, "", "vous êtes admin" )
                RunWait ( $Chemin_Programme_Client )
            EndIf
;MsgBox ( 0, "", $Chemin_Programme_Client & " existe (onauto exit)" )
;_RunDOS ( @SystemDir & "\cmd.exe" )
        EndIf
    Else
        MsgBox ( 0, "11", "#Deploiements_Logiciels.exe existe en processus (onautoit exit)" )
    EndIf
    If FileExists ( $Fichier_Difference ) Then
        MsgBox ( 0, "12", $Fichier_Difference & " existe" )
        $Jour_Diff = FileGetTime ( $Fichier_Difference )
        If Not @error Then
            If FileExists ( $Fichier_Difference ) And $Jour_Diff[2] = @MDAY Then
;               _FileReadToArray ( $Fichier_Difference, $Memoire )
;               For $x = 1 To $Memoire[0]
;                   FileWriteLine ( $Chemin_Clients, $Memoire[$x] )
;               Next
                FileCopy ( $Fichier_Difference, $Chemin_Clients, 9 )
                MsgBox ( 0, "13", $Fichier_Difference & " a bien été copié à : " & $Chemin_Clients )
            EndIf
        EndIf
    EndIf
EndFunc

Thanks in advance

Edited by jerem488

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

"subscript used with non-array variable".

use IsArray() to check if the variable is an array first

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Sorry I'm a novice...

I don't understand the response ???

Where do i put this code ?

Do I use IsArray() fonction ??

Func Ecris_differences_Fichier ( $NomFichierDifferences, $Differences )
    Local $fichier
    Local $WriteToFile_3

    $fichier = FileOpen ( $NomFichierDifferences, 1 ); Ecriture à la fin du fichier
    If $fichier = -1 Then; (erreur)
        Return 0
    EndIf
    MsgBox ( 0, "8", $Differences )
    $Ouv_Fichier1 = FileOpen ( $fichier, 1 )
    If $Ouv_Fichier1 = -1 Then
        MsgBox ( 0, "", "impossible d'ouvrir le fichier " & $fichier )
    EndIf
    $WriteToFile_3 = FileWriteLine ( $fichier, $Differences )
    If $WriteToFile_3 = -1 Then
        Return 0
    EndIf
    FileClose ( $fichier )
    $Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & $Differences )
     If IsArray($Raccourci) = 1 Then
    RunWait ( $Raccourci[0] & " " & $Raccourci[2] , "", @SW_MAXIMIZE )
    EndIf
    Return 1
EndFunc

I don't know your variables but maybe in this line you must use "\".

$Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & "\" & $Differences )
Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Func Ecris_differences_Fichier ( $NomFichierDifferences, $Differences )
    Local $fichier
    Local $WriteToFile_3

    $fichier = FileOpen ( $NomFichierDifferences, 1 ); Ecriture à la fin du fichier
    If $fichier = -1 Then; (erreur)
        Return 0
    EndIf
    MsgBox ( 0, "8", $Differences )
    $Ouv_Fichier1 = FileOpen ( $fichier, 1 )
    If $Ouv_Fichier1 = -1 Then
        MsgBox ( 0, "", "impossible d'ouvrir le fichier " & $fichier )
    EndIf
    $WriteToFile_3 = FileWriteLine ( $fichier, $Differences )
    If $WriteToFile_3 = -1 Then
        Return 0
    EndIf
    FileClose ( $fichier )
    $Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & $Differences )
     If IsArray($Raccourci) = 1 Then
    RunWait ( $Raccourci[0] & " " & $Raccourci[2] , "", @SW_MAXIMIZE )
    EndIf
    Return 1
EndFunc

I don't know your variables but maybe in this line you must use "\".

$Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & "\" & $Differences )
oh.. no,

Because my variable of is ==>> $chemin_logiciels_serveur = $drive2 & "\Soft\Silent\" He has already the "\"

and $Differences = the result of FileReadLine ( )

so if I use this

$Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & "\" & $Differences )

I ahve \Soft\Silent\\ ...

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

check the last char, here is an example

if StringRight($a)="/" then
$a=StringTrimRight($a,1)
endif

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

check the last char, here is an example

if StringRight($a)="/" then
$a=StringTrimRight($a,1)
endif

The last char is my silent parameter of my program

I don't understand the problem

But the problem isn't about user rights, because I have testing this program with an other administrator account. And this program doesn't run correctly.

Edited by jerem488

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

Just add some error checking-

Func Ecris_differences_Fichier ( $NomFichierDifferences, $Differences )
    Local $fichier
    Local $WriteToFile_3

    $fichier = FileOpen ( $NomFichierDifferences, 1 ); Ecriture à la fin du fichier
    If $fichier = -1 Then; (erreur)
        Return 0
    EndIf
    MsgBox ( 0, "8", $Differences ) 
    $Ouv_Fichier1 = FileOpen ( $fichier, 1 )
    If $Ouv_Fichier1 = -1 Then
        MsgBox ( 0, "", "impossible d'ouvrir le fichier " & $fichier )
    EndIf
    $WriteToFile_3 = FileWriteLine ( $fichier, $Differences )
    If $WriteToFile_3 = -1 Then
        Return 0
    EndIf
    FileClose ( $fichier )
    $Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & $Differences )
    if @error then
        MsgBox(0,"Error - Bad Shortcut",$chemin_logiciels_serveur & $Differences&" is not a valid shorcut")
        return 0
    EndIf
    RunWait ( $Raccourci[0] & " " & $Raccourci[2] , "", @SW_MAXIMIZE )
    Return 1
EndFunc
Link to comment
Share on other sites

I can tell you I haven't problem on this portion code.

Just add some error checking-

Func Ecris_differences_Fichier ( $NomFichierDifferences, $Differences )
    Local $fichier
    Local $WriteToFile_3

    $fichier = FileOpen ( $NomFichierDifferences, 1 ); Ecriture à la fin du fichier
    If $fichier = -1 Then; (erreur)
        Return 0
    EndIf
    MsgBox ( 0, "8", $Differences ) 
    $Ouv_Fichier1 = FileOpen ( $fichier, 1 )
    If $Ouv_Fichier1 = -1 Then
        MsgBox ( 0, "", "impossible d'ouvrir le fichier " & $fichier )
    EndIf
    $WriteToFile_3 = FileWriteLine ( $fichier, $Differences )
    If $WriteToFile_3 = -1 Then
        Return 0
    EndIf
    FileClose ( $fichier )
    $Raccourci = FileGetShortcut ( $chemin_logiciels_serveur & $Differences )
    if @error then
        MsgBox(0,"Error - Bad Shortcut",$chemin_logiciels_serveur & $Differences&" is not a valid shorcut")
        return 0
    EndIf
    RunWait ( $Raccourci[0] & " " & $Raccourci[2] , "", @SW_MAXIMIZE )
    Return 1
EndFuncoÝ÷ Ù(§qëaɨ®x§Z½êîØ^¦º ­©Ò!j÷¬yéíêk¡¹^+"Ø^¢v®¶­­~éܶ*'aë-z·ZÈZ½é÷öÛaÊk¡¹^«xhmºw^®ËZÐ-¶¥w°êÞ¶©­è+ji®²ÖÞ®éÈ«ÞiØ&zËè^±¨ªê-ºvëh{º×­ç±µêçjZk¢
Ú«¨·}÷Ý«­¢+ÙÕ¹=¹Õѽ%Ñá¥Ð ¤(%1½°ÀÌØí
¡µ¥¹}
±¥¹ÑÌ$$$$ô!½µÉ¥ÙµÀìÅÕ½ÐìÀäÈíÁ±½å}
±¥¹Ð¹ÑáÐÅÕ½Ðì(%1½°ÀÌØí¥¡¥É}¥É¹$$$ô!½µÉ¥ÙµÀìÅÕ½ÐìÀäÈí¥¥É¹Ì¹ÑáÐÅÕ½Ðì(%1½°ÀÌØí
¡µ¥¹}Aɽɵµ}
±¥¹Ð$$ô!½µÉ¥ÙµÀìÅÕ½ÐìÀäÈíÁ±½äÀäÈìÁ±½¥µ¹Ñ}1½¥¥±Ì¹áÅÕ½Ðì(%¥´ÀÌØí5µ½¥É($í%9½Ð%͵¥¸ ¤Q¡¸($ì%5Í   ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí¹¼½¹Õѽ¥Ñá¥ÐÅÕ½Ðì¤($ì%á¥Ð($í¹%(%%9½ÐAɽÍÍá¥ÍÑÌ ÅÕ½ÐìÁ±½¥µ¹Ñ}1½¥¥±Ì¹áÅÕ½Ðì¤Q¡¸($%5Í  ½à À°ÅÕ½ÐìÄÄÅÕ½Ðì°ÅÕ½ÐìÁ±½¥µ¹ÑÍ}1½¥¥±Ì¹á¸Ìäíá¥ÍÑÁ̸ÁɽÍÍÕÌ¡½¹Õѽ¥Ðá¥Ð¤ÅÕ½Ðì¤($%%¥±á¥ÍÑÌ ÀÌØí
¡µ¥¹}Aɽɵµ}
±¥¹Ð¤Q¡¸($$%%9½Ð%͵¥¸ ¤Q¡¸($$$%5Í  ½à À°ÅÕ½ÐíÑÉÅÕ½Ðì°ÅÕ½Ðí¹¼µ¥¸½¹Õѽ¥Ðá¥ÐÅÕ½Ðì¤($$$%IÕ¹ÍMÐ ÅÕ½Ðíµ¥¸ÅÕ½Ðì°ÅÕ½ÐíAAÅÕ½Ðì°ÅÕ½ÐíÁÍÍݽÉÅÕ½Ðì¤($$$%IÕ¹]¥Ð ÀÌØí
¡µ¥¹}Aɽɵµ}
±¥¹Ð¤ì±Ðì±ÐìôôÑ¡¥Ì±¥¹ÌÌìÌÌì($$$%á¥Ð($$%±Í($$$%5Í   ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíÙ½ÕÌ©Ñ̵¥¸ÅÕ½Ðì¤($$$%IÕ¹]¥Ð ÀÌØí
¡µ¥¹}Aɽɵµ}
±¥¹Ð¤($$%¹%($$$í5Í  ½à À°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí
¡µ¥¹}Aɽɵµ}
±¥¹ÐµÀìÅÕ½Ðìá¥ÍÑ¡½¹ÕѼá¥Ð¤ÅÕ½Ðì¤($$$í}IÕ¹=L MåÍѵ¥ÈµÀìÅÕ½ÐìÀäÈíµ¹áÅÕ½Ðì¤($%¹%(%±Í($%5Í    ½à À°ÅÕ½ÐìÄÄÅÕ½Ðì°ÅÕ½ÐìÁ±½¥µ¹ÑÍ}1½¥¥±Ì¹áá¥ÍѸÁɽÍÍÕÌ¡½¹Õѽ¥Ðá¥Ð¤ÅÕ½Ðì¤(%¹%(%%¥±á¥ÍÑÌ ÀÌØí¥¡¥É}¥É¹¤Q¡¸($%5Í    ½à À°ÅÕ½ÐìÄÈÅÕ½Ðì°ÀÌØí¥¡¥É}¥É¹µÀìÅÕ½Ðìá¥ÍÑÅÕ½Ðì¤($$ÀÌØí)½ÕÉ}¥ô¥±ÑQ¥µ ÀÌØí¥¡¥É}¥É¹¤($%%9½ÐÉɽÈQ¡¸($$%%¥±á¥ÍÑÌ ÀÌØí¥¡¥É}¥É¹¤¹ÀÌØí)½ÕÉ}¥lÉtô5dQ¡¸(ì$$$%}¥±IQ½ÉÉä ÀÌØí¥¡¥É}¥É¹°ÀÌØí5µ½¥É¤(ì$$$%½ÈÀÌØíàôÄQ¼ÀÌØí5µ½¥ÉlÁt(ì$$$$%¥±]É¥Ñ1¥¹ ÀÌØí
¡µ¥¹}
±¥¹ÑÌ°ÀÌØí5µ½¥ÉlÀÌØíát¤(ì$$$%9áÐ($$$%¥±
½Áä ÀÌØí¥¡¥É}¥É¹°ÀÌØí
¡µ¥¹}
±¥¹ÑÌ°ä¤($$$%5Í    ½à À°ÅÕ½ÐìÄÌÅÕ½Ðì°ÀÌØí¥¡¥É}¥É¹µÀìÅÕ½Ð쥸¥Ó¤½Á§¤èÅÕ½ÐìµÀìÀÌØí
¡µ¥¹}
±¥¹Ñ̤($$%¹%($%¹%(%¹%)¹Õ¹

I have a message dialog :

unable to execute the external program ! !

Edited by jerem488

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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