Sign in to follow this  
Followers 0
Skrip

Open File Issues

7 posts in this topic

Scroll down!!

#NoTrayIcon
#include <GUIConstants.au3>

;;;Password;;;
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
; They clicked OK, but did they type the right thing?
        If $text <> "12579" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"Password", "Password Accepted")

; Finished!

$w = 400
$h = 400
$l = 1
$t = 1
$win = "ABC Encryption"

$gui = GUICreate($win, $w, $h, $l, $t, $WS_MINIMIZEBOX + $WS_SYSMENU)
$edit = GUICtrlCreateEdit("", 0, 0, $w - 5, $h - 70, $ES_WANTRETURN + $ES_MULTILINE + $WS_TABSTOP + $ES_AUTOVSCROLL + $ES_AUTOHSCROLL + $WS_VSCROLL + $WS_HSCROLL)
$encrypt = GUICtrlCreateButton("E n c r y p t", 0, $h - 51, ($w / 3) - 2, 20)
$decrypt = GUICtrlCreateButton("D e c r y p t", ($w / 3) - 2, $h - 51, ($w / 3) - 2, 20)
$clipboard = GUICtrlCreateButton("C o p y / S a v e", ($w / 3 * 2) - 4, $h - 51, ($w / 3) - 2, 20)
$openf = GUICtrlCreateButton("O p e n", 0, $h - 70, ($w), 20)

GUISetState()

GUISetBkColor("0xFFFFFF", $gui)

GUICtrlSetState($edit, $GUI_FOCUS)

WinSetOnTop($win, "", 1)

While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      Exit
    Case $msg = $decrypt
      $sz_enc = GUICtrlRead($edit)
      GUICtrlSetData($edit, "")
      GUICtrlSetData($edit, "Decrypting...")
      $sz_enc = _Scramble($sz_enc)
      $sz_tmptxt = ""
      For $i = 1 to StringLen($sz_enc)
        $sz_tmptxt = $sz_tmptxt & abcdef(StringMid($sz_enc, $i, 1))
      Next
      $sz_tmptxt = _Scramble($sz_tmptxt)
      GUICtrlSetData($edit, "")
      GUICtrlSetData($edit, $sz_tmptxt)
    Case $msg = $encrypt
      $sz_dec = GUICtrlRead($edit)
      GUICtrlSetData($edit, "")
      GUICtrlSetData($edit, "Encrypting...")
      $sz_dec = _Unscramble($sz_dec)
      $sz_tmptxt = ""
      For $i = 1 to StringLen($sz_dec)
        $sz_tmptxt = $sz_tmptxt & abcdef(StringMid($sz_dec, $i, 1))
      Next
      $sz_tmptxt = _Unscramble($sz_tmptxt)
      GUICtrlSetData($edit, "")
      GUICtrlSetData($edit, $sz_tmptxt)
  Case $msg = $clipboard
      $data = GUICtrlRead($edit, 1)
      ClipPut($data[0])
      _save()
  EndSelect
  Sleep(1)
Wend

Func abcdef($sz_t)
  If StringIsUpper($sz_t) Then
    If $sz_t = "A" Then Return "C"
    If $sz_t = "C" Then Return "A"
    If $sz_t = "B" Then Return "D"
    If $sz_t = "D" Then Return "B"
    If $sz_t = "E" Then Return "G"
    If $sz_t = "G" Then Return "E"
    If $sz_t = "F" Then Return "H"
    If $sz_t = "H" Then Return "F"
    If $sz_t = "I" Then Return "K"
    If $sz_t = "K" Then Return "I"
    If $sz_t = "J" Then Return "L"
    If $sz_t = "L" Then Return "J"
    If $sz_t = "M" Then Return "O"
    If $sz_t = "O" Then Return "M"
    If $sz_t = "N" Then Return "P"
    If $sz_t = "P" Then Return "N"
    If $sz_t = "Q" Then Return "S"
    If $sz_t = "S" Then Return "Q"
    If $sz_t = "R" Then Return "T"
    If $sz_t = "T" Then Return "R"
    If $sz_t = "U" Then Return "W"
    If $sz_t = "W" Then Return "U"
    If $sz_t = "V" Then Return "X"
    If $sz_t = "X" Then Return "V"
    If $sz_t = "Y" Then Return "Z"
    If $sz_t = "Z" Then Return "Y"
  EndIf
  If $sz_t = "a" Then Return "c"
  If $sz_t = "c" Then Return "a"
  If $sz_t = "b" Then Return "d"
  If $sz_t = "d" Then Return "b"
  If $sz_t = "e" Then Return "g"
  If $sz_t = "g" Then Return "e"
  If $sz_t = "f" Then Return "h"
  If $sz_t = "h" Then Return "f"
  If $sz_t = "i" Then Return "k"
  If $sz_t = "k" Then Return "i"
  If $sz_t = "j" Then Return "l"
  If $sz_t = "l" Then Return "j"
  If $sz_t = "m" Then Return "o"
  If $sz_t = "o" Then Return "m"
  If $sz_t = "n" Then Return "p"
  If $sz_t = "p" Then Return "n"
  If $sz_t = "q" Then Return "s"
  If $sz_t = "s" Then Return "q"
  If $sz_t = "r" Then Return "t"
  If $sz_t = "t" Then Return "r"
  If $sz_t = "u" Then Return "w"
  If $sz_t = "w" Then Return "u"
  If $sz_t = "v" Then Return "x"
  If $sz_t = "x" Then Return "v"
  If $sz_t = "y" Then Return "z"
  If $sz_t = "z" Then Return "y"
      
  If $sz_t = "0" Then Return "2"
  If $sz_t = "2" Then Return "0"
  If $sz_t = "1" Then Return "3"
  If $sz_t = "3" Then Return "1"
  If $sz_t = "4" Then Return "6"
  If $sz_t = "6" Then Return "4"
  If $sz_t = "5" Then Return "7"
  If $sz_t = "7" Then Return "5"
  If $sz_t = "8" Then Return "9"
  If $sz_t = "9" Then Return "8"
      
  If $sz_t = ")" Then Return "@"
  If $sz_t = "@" Then Return ")"
  If $sz_t = "!" Then Return "#"
  If $sz_t = "#" Then Return "!"
  If $sz_t = "$" Then Return "^"
  If $sz_t = "^" Then Return "$"
  If $sz_t = "%" Then Return "&"
  If $sz_t = "&" Then Return "%"
  If $sz_t = "*" Then Return "("
  If $sz_t = "(" Then Return "*"
  If $sz_t = "<" Then Return ">"
  If $sz_t = ">" Then Return "<"
  If $sz_t = "12579" Then Return "765894gh;'"
      
  If $sz_t = "?" Then Return "+"  
  If $sz_t = "+" Then Return "?"
      
  If $sz_t = " " Then Return ":"  
  If $sz_t = ":" Then Return " "
      
  If $sz_t = @CR Then Return ""
  If $sz_t = @LF Then Return "¤"
  If $sz_t = "" Then Return @CR
  If $sz_t = "¤" Then Return @LF

  Return $sz_t
EndFunc

Func _Scramble($sText)
;; Scramble a text string.
   $iLen = StringLen($sText)
   $Scrambled = ""
   For $i1 = 1 To Int($iLen / 2)
      $Scrambled = $Scrambled & StringMid($sText, $iLen - $i1 + 1, 1) & StringMid($sText, $i1, 1)
   Next; $i1
; Pick up the odd character.
   If Mod($iLen, 2) Then
      $Scrambled = $Scrambled & StringMid($sText, $i1, 1)
   EndIf
   Return $Scrambled
EndFunc;==>_Scramble
Func _Unscramble($sText)
;; De-Scramble a Scrambled text that was scrambled by _Scramble.
   Local $iLen = StringLen($sText)
   Local  $i, $Unscrambled1, $Unscrambled2
   $Unscrambled1 = ""
   $Unscrambled2 = ""
   For $i1 = 1 To $iLen step 2
      $Unscrambled1 = StringMid($sText, $i1, 1) & $Unscrambled1
      $Unscrambled2 = $Unscrambled2 & StringMid($sText, $i1 + 1, 1)
   Next; $i1
; Pick up the odd character.
   If Mod($iLen, 2) Then
      $Unscrambled1 = StringMid($sText, $i1, 1) & $Unscrambled1
   EndIf
   $sText = $Unscrambled2 & $Unscrambled1
   Return $Unscrambled2 & $Unscrambled1
EndFunc;==>_Unscramble

Func _Save()
        $save_con = 1
    $answer = MsgBox(4, "Save", "Would you like to SAVE the text file also?")
        If $answer = 7 Then
            $save_con = 0
        EndIf
        If $save_con = 1 Then
            $name = InputBox("Name", "What would you like to name this file?")
            $save_con = 2
        EndIf
        If $save_con = 2 Then
            $file = FileOpen($name, 1)
        EndIf
        If $file = -1 Then
          Exit
      EndIf
      $text1 = clipget()
        FileWrite($file, $text1)
        sleep (100)
        FileClose($file)
    EndFunc                                                                 
;ConsoleWrite('@@ Debug(229) : EndFunc = ' & EndFunc & @lf & '>Error code: ' & @error & @lf);### Debug Console

Okay thanks if you helped me get the 'save' button working, now i can't seem to get an 'open' button working. The open button is $openf can somebody make it so when you click that button you can choose what file you want to load into $edit .

Thanks


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I don't know whether that is want you want. But give it a try.

#NoTrayIcon
#include <GUIConstants.au3>
#include<file.au3>
;;;Password;;;
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...", "", "*")
    If @error = 1 Then
        Exit
    Else
; They clicked OK, but did they type the right thing?
        If $text <> "12579" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096, "Password", "Password Accepted")

; Finished!

$w = 400
$h = 400
$l = 1
$t = 1
$win = "ABC Encryption"

$gui = GUICreate($win, $w, $h, $l, $t, $WS_MINIMIZEBOX + $WS_SYSMENU)
$edit = GUICtrlCreateEdit("", 0, 0, $w - 5, $h - 70, $ES_WANTRETURN + $ES_MULTILINE + $WS_TABSTOP + $ES_AUTOVSCROLL + $ES_AUTOHSCROLL + $WS_VSCROLL + $WS_HSCROLL)
$encrypt = GUICtrlCreateButton("E n c r y p t", 0, $h - 51, ($w / 3) - 2, 20)
$decrypt = GUICtrlCreateButton("D e c r y p t", ($w / 3) - 2, $h - 51, ($w / 3) - 2, 20)
$save = GUICtrlCreateButton("C o p y / S a v e", ($w / 3 * 2) - 4, $h - 51, ($w / 3) - 2, 20)
$openf = GUICtrlCreateButton("O p e n", 0, $h - 70, ($w), 20)

GUISetState()
GUISetBkColor("0xFFFFFF", $gui)
GUICtrlSetState($edit, $GUI_FOCUS)
WinSetOnTop($win, "", 1)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $decrypt
            $sz_enc = GUICtrlRead($edit)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Decrypting...")
            Sleep(1000)
            $sz_enc = _Scramble($sz_enc)
            $sz_tmptxt = ""
            For $i = 1 To StringLen($sz_enc)
                $sz_tmptxt = $sz_tmptxt & abcdef(StringMid($sz_enc, $i, 1))
            Next
            $sz_tmptxt = _Scramble($sz_tmptxt)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, $sz_tmptxt)
        Case $msg = $encrypt
            $sz_dec = GUICtrlRead($edit, 0)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Encrypting...")
            Sleep(1000)
            $sz_dec = _Unscramble($sz_dec)
            $sz_tmptxt = ""
            For $i = 1 To StringLen($sz_dec)
                $sz_tmptxt = $sz_tmptxt & abcdef(StringMid($sz_dec, $i, 1))
            Next
            $sz_tmptxt = _Unscramble($sz_tmptxt)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, $sz_tmptxt)
        Case $msg = $save
            _Save()
        Case $msg = $openf
            Dim $path = FileOpenDialog("Load your file", @ScriptDir, "All (*.*)", 1 + 2)
            _PutFileIntoEdit()
    EndSelect
    Sleep(1)
WEnd

Func abcdef($sz_t)
    If StringIsUpper($sz_t) Then
        If $sz_t = "A" Then Return "C"
        If $sz_t = "C" Then Return "A"
        If $sz_t = "B" Then Return "D"
        If $sz_t = "D" Then Return "B"
        If $sz_t = "E" Then Return "G"
        If $sz_t = "G" Then Return "E"
        If $sz_t = "F" Then Return "H"
        If $sz_t = "H" Then Return "F"
        If $sz_t = "I" Then Return "K"
        If $sz_t = "K" Then Return "I"
        If $sz_t = "J" Then Return "L"
        If $sz_t = "L" Then Return "J"
        If $sz_t = "M" Then Return "O"
        If $sz_t = "O" Then Return "M"
        If $sz_t = "N" Then Return "P"
        If $sz_t = "P" Then Return "N"
        If $sz_t = "Q" Then Return "S"
        If $sz_t = "S" Then Return "Q"
        If $sz_t = "R" Then Return "T"
        If $sz_t = "T" Then Return "R"
        If $sz_t = "U" Then Return "W"
        If $sz_t = "W" Then Return "U"
        If $sz_t = "V" Then Return "X"
        If $sz_t = "X" Then Return "V"
        If $sz_t = "Y" Then Return "Z"
        If $sz_t = "Z" Then Return "Y"
    EndIf
    If $sz_t = "a" Then Return "c"
    If $sz_t = "c" Then Return "a"
    If $sz_t = "b" Then Return "d"
    If $sz_t = "d" Then Return "b"
    If $sz_t = "e" Then Return "g"
    If $sz_t = "g" Then Return "e"
    If $sz_t = "f" Then Return "h"
    If $sz_t = "h" Then Return "f"
    If $sz_t = "i" Then Return "k"
    If $sz_t = "k" Then Return "i"
    If $sz_t = "j" Then Return "l"
    If $sz_t = "l" Then Return "j"
    If $sz_t = "m" Then Return "o"
    If $sz_t = "o" Then Return "m"
    If $sz_t = "n" Then Return "p"
    If $sz_t = "p" Then Return "n"
    If $sz_t = "q" Then Return "s"
    If $sz_t = "s" Then Return "q"
    If $sz_t = "r" Then Return "t"
    If $sz_t = "t" Then Return "r"
    If $sz_t = "u" Then Return "w"
    If $sz_t = "w" Then Return "u"
    If $sz_t = "v" Then Return "x"
    If $sz_t = "x" Then Return "v"
    If $sz_t = "y" Then Return "z"
    If $sz_t = "z" Then Return "y"
    
    If $sz_t = "0" Then Return "2"
    If $sz_t = "2" Then Return "0"
    If $sz_t = "1" Then Return "3"
    If $sz_t = "3" Then Return "1"
    If $sz_t = "4" Then Return "6"
    If $sz_t = "6" Then Return "4"
    If $sz_t = "5" Then Return "7"
    If $sz_t = "7" Then Return "5"
    If $sz_t = "8" Then Return "9"
    If $sz_t = "9" Then Return "8"
    
    If $sz_t = ")" Then Return "@"
    If $sz_t = "@" Then Return ")"
    If $sz_t = "!" Then Return "#"
    If $sz_t = "#" Then Return "!"
    If $sz_t = "$" Then Return "^"
    If $sz_t = "^" Then Return "$"
    If $sz_t = "%" Then Return "&"
    If $sz_t = "&" Then Return "%"
    If $sz_t = "*" Then Return "("
    If $sz_t = "(" Then Return "*"
    If $sz_t = "<" Then Return ">"
    If $sz_t = ">" Then Return "<"
    If $sz_t = "12579" Then Return "765894gh;'"
    
    If $sz_t = "?" Then Return "+"
    If $sz_t = "+" Then Return "?"
    
    If $sz_t = " " Then Return ":"
    If $sz_t = ":" Then Return " "
    
    If $sz_t = @CR Then Return ""
    If $sz_t = @LF Then Return "¤"
    If $sz_t = "" Then Return @CR
    If $sz_t = "¤" Then Return @LF
    
    Return $sz_t
EndFunc ;==>abcdef

Func _Scramble($sText)
;; Scramble a text string.
    $iLen = StringLen($sText)
    $Scrambled = ""
    For $i1 = 1 To Int($iLen / 2)
        $Scrambled = $Scrambled & StringMid($sText, $iLen - $i1 + 1, 1) & StringMid($sText, $i1, 1)
    Next; $i1
; Pick up the odd character.
    If Mod($iLen, 2) Then
        $Scrambled = $Scrambled & StringMid($sText, $i1, 1)
    EndIf
    Return $Scrambled
EndFunc ;==>_Scramble
Func _Unscramble($sText)
;; De-Scramble a Scrambled text that was scrambled by _Scramble.
    Local $iLen = StringLen($sText)
    Local $i, $Unscrambled1, $Unscrambled2
    $Unscrambled1 = ""
    $Unscrambled2 = ""
    For $i1 = 1 To $iLen Step 2
        $Unscrambled1 = StringMid($sText, $i1, 1) & $Unscrambled1
        $Unscrambled2 = $Unscrambled2 & StringMid($sText, $i1 + 1, 1)
    Next; $i1
; Pick up the odd character.
    If Mod($iLen, 2) Then
        $Unscrambled1 = StringMid($sText, $i1, 1) & $Unscrambled1
    EndIf
    $sText = $Unscrambled2 & $Unscrambled1
    Return $Unscrambled2 & $Unscrambled1
EndFunc ;==>_Unscramble

Func _Save()
    $path = FileSaveDialog("Save file", @ScriptDir, "All (*.*)", 2 + 16, "crypted.txt")
    If @error Then
        MsgBox(4096, "", "Save cancelled.")
    Else
        MsgBox(4096, "", "You chose " & $path)
    EndIf
    $file = FileOpen($path, 2)
    FileWrite($file, GUICtrlRead($edit, 0))
    MsgBox(0, "", GUICtrlRead($edit, 0))
    Sleep(100)
    FileClose($file)
EndFunc ;==>_Save

Func _PutFileIntoEdit()
    $file = FileOpen($path, 0)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    While 1
        $line = FileReadLine($file)
        If @error = -1 Then ExitLoop
        GUICtrlSetData($edit, $line)
    WEnd
    FileClose($file)
EndFunc ;==>_PutFileIntoEdit

You know, that there is _StringEncrypt included in Autoit Beta, don´t you?

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Dude this is even better than what i wanted, thank you


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Dude this is even better than what i wanted, thank you

Nice! :mellow: You want something more? Just got little time to do something. :)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

and no i did not know there was a string encrypted, i'll look it up


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

and no i did not know there was a string encrypted, i'll look it up

Hmmh, then this could be interesting for you.

#NoTrayIcon
#include <GUIConstants.au3>
#include<file.au3>
#include<string.au3>
;;;Password;;;
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...", "", "*")
    If @error = 1 Then
        Exit
    Else
    ; They clicked OK, but did they type the right thing?
        If $text <> "12579" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096, "Password", "Password Accepted")

; Finished!

$w = 400
$h = 400
$l = 1
$t = 1
$win = "ABC Encryption"

$gui = GUICreate($win, $w, $h, $l, $t, $WS_MINIMIZEBOX + $WS_SYSMENU)
$edit = GUICtrlCreateEdit("", 0, 0, $w - 5, $h - 70, $ES_WANTRETURN + $ES_MULTILINE + $WS_TABSTOP + $ES_AUTOVSCROLL + $ES_AUTOHSCROLL + $WS_VSCROLL + $WS_HSCROLL)
$encrypt = GUICtrlCreateButton("E n c r y p t", 0, $h - 51, ($w / 3) - 2, 20)
$decrypt = GUICtrlCreateButton("D e c r y p t", ($w / 3) - 2, $h - 51, ($w / 3) - 2, 20)
$save = GUICtrlCreateButton("C o p y / S a v e", ($w / 3 * 2) - 4, $h - 51, ($w / 3) - 2, 20)
$openf = GUICtrlCreateButton("O p e n", 0, $h - 70, ($w), 20)
$txt = ""
GUISetState()
GUISetBkColor("0xFFFFFF", $gui)
GUICtrlSetState($edit, $GUI_FOCUS)
WinSetOnTop($win, "", 1)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $decrypt
            $txt = _Scramble(GUICtrlRead($edit), 0)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Decrypting...")
            Sleep(1000)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, $txt)
        Case $msg = $encrypt
            $txt = _Scramble(GUICtrlRead($edit), 1)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Encrypting...")
            Sleep(1000)
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, $txt)
        Case $msg = $save
            _Save()
        Case $msg = $openf
            Dim $path = FileOpenDialog("Load your file", @ScriptDir, "All (*.*)", 1 + 2)
            Sleep(100)
            _PutFileIntoEdit()
    EndSelect
    Sleep(1)
WEnd

Func _Scramble($string, $option)
    return _StringEncrypt($option, $string, "crypt", 1)
EndFunc  ;==>_Scramble


Func _Save()
    $path = FileSaveDialog("Save file", @ScriptDir, "All (*.*)", 2 + 16, "crypted.txt")
    If @error Then
        MsgBox(4096, "", "Save cancelled.")
    Else
    ;MsgBox(4096, "", "You chose " & $path)
    EndIf
    $file = FileOpen($path, 2)
    FileWrite($file, GUICtrlRead($edit, 0))
    Sleep(100)
    FileClose($file)
EndFunc  ;==>_Save

Func _PutFileIntoEdit()
    $file = FileOpen($path, 0)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    While 1
        $line = FileReadLine($file)
        If @error = -1 Then ExitLoop
        GUICtrlSetData($edit, $line)
    WEnd
    FileClose($file)
EndFunc  ;==>_PutFileIntoEdit

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

hmm, i saved both of them. Thanks, the second one seems a bit more secure.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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