irgendwie wird außeracht gelassen das er meine Funktionen einfach benutzen kann.
Es funktioniert.
Grad mal aus POST #18 deinen Code kopiert meine funktionen reingesetzt und das script leicht verändert.
sieh :
C
; Script Start - Add your code below here
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include "Services.au3"
#include <GDIPlus.au3>
#include <GuiCtrlSetOnHover_UDF.au3>
#include <StaticConstants.au3>
#include <String.au3>
#include <WinApi.au3>
#include <MsgBoxConstants.au3>
#include <ButtonConstants.au3>
#include <StringConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <date.au3>
#include <EditConstants.au3>
Global $ROUNDES = 20, $LastHwnd = 0
Global $LastHwnd
Global $GUIBKCOLOR = 0x738599
Global $SubBack = 0xEAF0E2
Global $nMSG
;MAINLOGIC
global $Form1 = GUICreate("TEST GUI", 173, 126, 192, 124)
global $Button1 = GUICtrlCreateButton("Button1", 16, 24, 75, 25)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_form3()
EndSwitch
WEnd
;Form3 Config1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func _Form3()
Local $file = "C:\Program Files\Mozilla Firefox\confs\firefox_ext.cfg" ; für dich reaktiviert die Variable kannst du auch Global setzten wenn es dein einziges $file ist aber dann außerhalb der funktion _Form3
local $Form3 = GUICreate("Subform", 450, 425, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME)) ;Creates the GUI window
local $iEdit = GUICtrlCreateEdit('' & @CRLF & "Another Line", 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
local $hButton = GUICtrlCreateButton("Speichern", 160, 400, 107, 25, $WS_GROUP)
fileToedit($file, $iEdit); 1. öffnet datei 2. liest die datei, 3. füllt das Edit fenster 4. schließt die datei.
GUICtrlSetBkColor(-1, $SubBack)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetLimit(-1, 0xFFFFFF)
ControlClick($Form3, "", $iEdit)
GUISetState(@SW_SHOW) ;Shows the GUI window
While 2
local $mMsg = GUIGetMsg()
Switch $mMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form3)
GUISetState(@SW_ENABLE, $Form3)
Return
Case $hButton
savefile($file, $iEdit);1. list das Edit feld aus, 2.öffnet das file im Overridemode(2) 3. überschreibt den Dateiinhalt mit dem ausgelesenen edit feld, bestätigt das mit einer msgbox. und schließt die Datei wieder.
EndSwitch
WEnd
EndFunc
Func savefile($file_, $edit_)
Local $read, $ofile
If FileExists($file_) = 1 Then
$read = GUICtrlRead($edit_, 1)
$ofile = FileOpen($file_, 2); öffne das File aber in den Overidemode
If FileWrite($ofile, $read) = 1 Then
MsgBox(0,"Fertig!",$file_ & " |.. wurde gespeichert!");msgbox mit in die funkiton gesetzt auser du magst die auserhalb dann klammer die zeile aus.
FileClose($ofile)
ElseIf 0 Then
ConsoleWrite('Fehler beim beschreiben der Datei.' & @CRLF)
EndIf
Else
ConsoleWrite('Datei exsistiert nicht.' & @CRLF)
EndIf
EndFunc
Func fileToedit($file_, $edit_)
Local $fopen, $read
If FileExists($file_) = 1 Then
$fopen = FileOpen($file_)
$read = FileRead($file_)
GUICtrlSetData($edit_, $read)
FileClose($fopen)
Return 1
ElseIf 0 Then
ConsoleWrite($file_ & '<-> ' & 'konnte nicht gefunden werden!' & @CRLF)
Return -1
EndIf
EndFunc ;==>fileToedit
Alles anzeigen
Edit habs nochmal auf dich angepasst.
die unnötigen stellen weggemacht und die Änderung kommentiert.
Du solltest mit copie pase direkt loslegen können.