meekaah Posted August 31, 2007 Posted August 31, 2007 (edited) Hi, Im trying to replace a bunch of strings from a text file, here's my code but i cant get it to work correctly, any advice is greatly appreciated expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("Form1", 128, 256, 338, 275, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) $Label_ID = GUICtrlCreateLabel("Votre N° téléphone SIP :", 4, 13, 120, 17) $ID = GUICtrlCreateInput("mon id", 4, 30, 121, 21) $Label_MDP = GUICtrlCreateLabel("Votre mot de passe :", 4, 61, 101, 17) $MDP = GUICtrlCreateInput("mon mot de passe", 4, 78, 121, 21) $Label_Proxy = GUICtrlCreateLabel("Proxy SIP:", 4, 109, 53, 17) $PROXY = GUICtrlCreateInput("mon proxy", 4, 126, 121, 21) $Label_Domaine = GUICtrlCreateLabel("Domaine SIP:", 4, 157, 69, 17) $DOMAINE = GUICtrlCreateInput("mon domaine", 4, 174, 121, 21) $GO = GUICtrlCreateButton("GO", 4, 224, 121, 25) GUISetState(@SW_SHOW) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $GO go() EndSelect WEnd Func go() $save = FileSaveDialog( "Enregistrez le profil!", @DesktopCommonDir, "UpdateProfile (*.conf)", 2, "updateProfile.conf") If @error Then MsgBox(4096,"","Enregistrement annulé!") EndIf $file = FileOpen("updateprofile.conf", 0) If $file = -1 Then MsgBox(0, "Erreur", "Le fichier ne peut etre ouvert!") Exit EndIf FileRead($file) $a = StringReplace($file,"<ID>",GUICtrlRead($ID)) $b = StringReplace($a,"<MDP>",GUICtrlRead($MDP)) $c = StringReplace($b,"<PROXY>",GUICtrlRead($PROXY)) $fini = StringReplace($c,"<DOMAINE>",GUICtrlRead($DOMAINE)) FileOpen ( $save, 2 ) FileWriteLine($save, $fini) FileClose($save) EndFunc Edited August 31, 2007 by meekaah
rbhkamal Posted August 31, 2007 Posted August 31, 2007 Use fileRead($file) after fileOpen(). "When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix
meekaah Posted August 31, 2007 Author Posted August 31, 2007 (edited) Use fileRead($file) after fileOpen().thanks i added it but still doesnt work.. Well it actually writes a "1" to the file selected in the fileopen dialog Edited August 31, 2007 by meekaah
meekaah Posted August 31, 2007 Author Posted August 31, 2007 Ok well i got it working, thanks it was it
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now