Sign in to follow this  
Followers 0
nav53

Problem script Win7 x64

2 posts in this topic

Hi,

I am a noob in scripting but i likthat and i have a problem with my script which is the txt file generated by my script command "ipconfig /all" has many bad characters.

The "é" have benn replaced by a "," and there is others bug as that.

I don't understand why because my script works perfectly in Windows XP.

exemple generated file :

Configuration IP de Windows

Nom de l'h“te . . . . . . . . . . :

Suffixe DNS principal . . . . . . :

Type de noeud. . . . . . . . . . :

Routage IP activ‚ . . . . . . . . :

Proxy WINS activ‚ . . . . . . . . :

Carte Ethernet Connexion au r‚seau local :

Suffixe DNS propre … la connexion. . . :

Description. . . . . . . . . . . . . . :

Adresse physique . . . . . . . . . . . :

DHCP activ‚. . . . . . . . . . . . . . :

Configuration automatique activ‚e. . . :

Adresse IPv6 de liaison locale. . . . .:

Adresse IPv4. . . . . . . . . . . . . .:

Masque de sous-r‚seau. . . .ÿ. . . . . :

Bail obtenu. . . . . . . . .ÿ. . . . . :

Bail expirant. . . . . . . . .ÿ. . . . :

Passerelle par d‚faut. . . .ÿ. . . . . :

Serveur DHCP . . . . . . . . . . . . . :

IAID DHCPv6 . . . . . . . . . . . :

DUID de client DHCPv6. . . . . . . . :

Serveurs DNS. . . . . . . . . . . . . :

NetBIOS sur Tcpip. . . . . . . . . . . :

Look the "ÿ" !!!

This is my script code :

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\scripts\Form1.kxf
Global $Form1 = GUICreate("IPView v1.0", 633, 438, -1, -1)
Global $Fichiermenu = GUICtrlCreateMenu("Fichier")
Global $Quitteritem = GUICtrlCreateMenuItem("Quitter  Alt+F4", $Fichiermenu)
Global $Editionmenu = GUICtrlCreateMenu("Edition")
Global $Couperitem = GUICtrlCreateMenuItem("Couper   Ctrl+X", $Editionmenu)
Global $Copieritem = GUICtrlCreateMenuItem("Copier    Ctrl+C", $Editionmenu)
Global $Colleritem = GUICtrlCreateMenuItem("Coller     Ctrl+V", $Editionmenu)
Global $Effaceritem = GUICtrlCreateMenuItem("Effacer  Suppr", $Editionmenu)
Global $Aidemenu = GUICtrlCreateMenu("Aide")
Global $Apropositem = GUICtrlCreateMenuItem("A Propos ...", $Aidemenu)
Global $Button1 = GUICtrlCreateButton("Lancer", 276, 376, 81, 33, $WS_GROUP)
Global $Pic1 = GUICtrlCreatePic("C:\scripts\testimg.bmp", 0, 0, 633, 65, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
Global $Text = GUICtrlCreateEdit("", 104, 80, 433, 281)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$fichier = @WindowsDir
$fichierread = FileRead ( $fichier & " \ipconfig.txt " )

While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Fin()
    Case $Button1
        RunWait(@ComSpec & " /c ipconfig /all > " & "c:\WINDOWS\ipconfig.txt", "", @SW_HIDE)
        GUICtrlSetData($Text, FileRead($fichier & "\ipconfig.txt"))
    Case $Quitteritem
        Fin()
    Case $Apropositem
        MsgBox(64, "A Propos", "IPView v1.0" & @CRLF & "Développé par : Antoine Martin" & @CRLF & "Companie : TonioSoftware ©" & @CRLF & @CRLF & "Uniquement compatible Windows XP")
    Case $Couperitem
        Send("{CTRLDOWN}")
        Send("x")
        Send("{CTRLUP}")
    Case $Copieritem
        Send("{CTRLDOWN}")
        Send("c")
        Send("{CTRLUP}")
    Case $Colleritem
        Send("{CTRLDOWN}")
        Send("v")
        Send("{CTRLUP}")
    Case $Effaceritem
        Send("{DELETE}")

 EndSwitch
WEnd

Func Fin()

    SplashTextOn("", "Fermeture du programme en cours,  Veuillez patienter ...", 450, 70, -1, -1, 0 + 1 + 16 + 32, "Times New Roman", 12, 800)
    Sleep(2000)
    SplashOff()
    Exit
EndFunc

thanks to help me .

Share this post


Link to post
Share on other sites



I don't understand why because my script works perfectly in Windows XP.

As far as I understood your script, you just wanted to have the IPCONFIG output in a text filed. And then the content of this filed could be copied, removed or cutted (including just delete).

So I changed your script a little.

You wrote that the script only works in XP, so I guess Vista or WIn7 is the problme. Maybe this is related to "c:\WINDOWS\ipconfig.txt"

Normaly you are not allowed to write to windows dir in Win7/Vista without Adminrights. So the file IPCONFIG.TXT will not be created. But on the other hand you wrote it looks very strange. Please add the file as a download or paste it in the code section so I may see the real file .

Maybe you want to try my version? I also removed the strange Key Send sequence.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\scripts\Form1.kxf
Global $Form1 = GUICreate("IPView v1.0", 633, 438, -1, -1)
Global $Fichiermenu = GUICtrlCreateMenu("Fichier")
Global $Quitteritem = GUICtrlCreateMenuItem("Quitter  Alt+F4", $Fichiermenu)
Global $Editionmenu = GUICtrlCreateMenu("Edition")
Global $Couperitem = GUICtrlCreateMenuItem("Couper   Ctrl+X", $Editionmenu)
Global $Copieritem = GUICtrlCreateMenuItem("Copier    Ctrl+C", $Editionmenu)
Global $Colleritem = GUICtrlCreateMenuItem("Coller     Ctrl+V", $Editionmenu)
Global $Effaceritem = GUICtrlCreateMenuItem("Effacer  Suppr", $Editionmenu)
Global $Aidemenu = GUICtrlCreateMenu("Aide")
Global $Apropositem = GUICtrlCreateMenuItem("A Propos ...", $Aidemenu)
Global $Button1 = GUICtrlCreateButton("Lancer", 276, 376, 81, 33, $WS_GROUP)
Global $Pic1 = GUICtrlCreatePic("C:\scripts\testimg.bmp", 0, 0, 633, 65, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
Global $Text = GUICtrlCreateEdit("", 104, 80, 433, 281)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$fichier = @WindowsDir
$fichierread = FileRead($fichier & " \ipconfig.txt ")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Fin()
        Case $Button1

            $ShellCommand = "ipconfig /all"
            $Workdir = @ScriptDir
            $foo = Run(@ComSpec & " /c " & $ShellCommand, $Workdir, @SW_HIDE, 2 + 4)
            Sleep(1000)
            Local $line
            While 1
                $line = StdoutRead($foo)
                If @error Then ExitLoop
                GUICtrlSetData($Text, $line)
            WEnd

            While 1
                $line = StderrRead($foo)
                If @error Then ExitLoop
                GUICtrlSetData($Text, $line)
            WEnd

        Case $Quitteritem
            Fin()
        Case $Apropositem
            MsgBox(64, "A Propos", "IPView v1.0" & @CRLF & "Développé par : Antoine Martin" & @CRLF & "Companie : TonioSoftware ©" & @CRLF & @CRLF & "Uniquement compatible Windows XP")
        Case $Couperitem
            ClipPut(guictrlread($Text))
            guictrlsetdata($Text,"")
        Case $Copieritem
            ClipPut(guictrlread($Text))
        Case $Colleritem
            guictrlsetdata($Text,clipget())
        Case $Effaceritem
            guictrlsetdata($Text,"")

    EndSwitch
WEnd

Func Fin()

    SplashTextOn("", "Fermeture du programme en cours,  Veuillez patienter ...", 450, 70, -1, -1, 0 + 1 + 16 + 32, "Times New Roman", 12, 800)
    Sleep(2000)
    SplashOff()
    Exit
EndFunc   ;==>Fin

Share this post


Link to post
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
Sign in to follow this  
Followers 0