Sign in to follow this  
Followers 0
Kendall

Persistante Gui\ notepad

9 posts in this topic

#1 ·  Posted (edited)

I am making a persistant not taker. The input fields and combo box's need to be saved as they are modified (persistant)

I am having a hard time trying to find a command that will allow this.

Basically i need to have it save the information to a file like XML txt, whatever so that if the program crashes the information can be re-pulled, Also so that certain lines\ information in that file can be pulled to the clipboard in the same format.

I do use the readline functions and writeline functions. Anyone have any ideas?

Edited by Kendall

Share this post


Link to post
Share on other sites



I am making a persistant not taker. The input fields and combo box's need to be saved as they are modified (persistant)

I am having a hard time trying to find a command that will allow this.

Basically i need to have it save the information to a file like XML txt, whatever so that if the program crashes the information can be re-pulled, Also so that certain lines\ information in that file can be pulled to the clipboard in the same format.

I do use the readline functions and writeline functions. Anyone have any ideas?

Figured it out with a infinate loop. the $nsmg needs to be there on a infinate loop, if its not there your gui will not close.

Note: this is writing to a .txt file but im sure you can use the While and Wend in a infinate loop for saving to XML Excel ect.

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

;Start write to file.

_FileWriteToLine( $temp1, 1, "St:" & GUICtrlRead ( $Combo1, 1 ) , 1 )

_FileWriteToLine( $temp1, 2, "C::" & GUICtrlRead ( $Input1, 1 ) , 1 )

_FileWriteToLine( $temp1, 3, ":" & GUICtrlRead ( $Input2, 1 ) , 1 )

_FileWriteToLine( $temp1, 4, ":" & GUICtrlRead ( $Input3, 1 ) , 1 )

WEnd

Share this post


Link to post
Share on other sites

Search for IniRead() and IniWrite() functions. Your code seems to be too much CPU Invasive.

Try something like this:

;GUI HERE
;IniRead() Section of your script

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Input1 ;If user types in $Input1, it will save to a file of your choice.
IniWrite("Your file","A section","A key","What to write")
; Case other thing, I think you got it :)
EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Search for IniRead() and IniWrite() functions. Your code seems to be too much CPU Invasive.

Try something like this:

;GUI HERE
;IniRead() Section of your script

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Input1 ;If user types in $Input1, it will save to a file of your choice.
IniWrite("Your file","A section","A key","What to write")
; Case other thing, I think you got it :)
EndSwitch
WEnd

Hey thanks for the Reply, Looks like the INI Write function works great for Single line Text.

I have one Edit Field in my Gui that needs the data Copied from it with the returns so that the format is saved correctly, Like when you copy the text from here or anywhere. I Noticed when i write the edit 1 field to a ini it just bleeds the text down like so

like so

like s

likesss

ssssss

sss

Any ideas thoughts ect, I was looking at saving the data into a Excel book but i think there are some issues with Office 2010 and the Excel.au3 I have just tried a simple one and it is not working. Kinda sad.

Share this post


Link to post
Share on other sites

So INI's are not multiline.

I found a example of a way to change the format but it is not explaned and makes absolutly no sense to me.

Found

Posted 03 October 2007 - 09:24 PM

INI doesn't work with multiline data.

So you have to parse your multiline strings into single line before writing to INI, and change back to multiline after you read from INI.

Something like this...

$StrToINI = StringReplace($str, @CRLF, "\r\n") and $str = StringReplace($StrFromIni, "\r\n", @CRLF)

I have 1 Edit field that needs to save the data to more than 1 line.

I do not mind saving it to another file txt ect as long as that file can show and update it realtime without a CPU usage issue.

Can somone help me with this?

Share this post


Link to post
Share on other sites

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

;Start write to file.

_FileWriteToLine( $temp1, 1, "St:" & GUICtrlRead ( $Combo1, 1 ) , 1 )

_FileWriteToLine( $temp1, 2, "C::" & GUICtrlRead ( $Input1, 1 ) , 1 )

_FileWriteToLine( $temp1, 3, ":" & GUICtrlRead ( $Input2, 1 ) , 1 )

_FileWriteToLine( $temp1, 4, ":" & GUICtrlRead ( $Input3, 1 ) , 1 )

WEnd

Posted Image

That code makes me sad.

James

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

[ autoIt ]    ( Popup )
;GUI HERE

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
;Button click case code 
;-------------------------------Start Autosave to INI File
    IniWrite( $temp3, "section1", "key1", "" & GUICtrlRead ( $Combo1, 1 )  )    
    IniWrite( $temp3, "section1", "key2", "" & GUICtrlRead ( $Input1, 1 ) ) 
    IniWrite( $temp3, "section1", "key3", "" & GUICtrlRead ( $Input2, 1 ) )
    IniWrite( $temp3, "section1", "key4", "" & GUICtrlRead ( $Input3, 1 ) )
    IniWrite( $temp3, "section1", "key5", "" & GUICtrlRead ( $Date1, 1 ) )
    IniWrite( $temp3, "section1", "key6", "" & GUICtrlRead ( $Input4, 1 ) )
    IniWrite( $temp3, "section1", "key7", "" & GUICtrlRead ( $Input5, 1 ) )
    IniWrite( $temp3, "section1", "key8", "" & GUICtrlRead ( $checkbox1, 1 ) ) ;  Checkbox
    IniWrite( $temp3, "section1", "key9", "" & GUICtrlRead ( $Input6, 1 ) ) 
    IniWrite( $temp3, "section1", "key10", "" & GUICtrlRead ( $Input7, 1 ) )
    
    
    IniWrite( $temp4, "section1", "", "" & GUICtrlRead ( $edit1, 1 ) );  function Must be written to save data multi line.
;-------------------------------End Auto Save to INI File
endswitch
wend

So this works to save data realtime but it has to be in the same section and the While1 for the button click Case section.

I tried it with the CASE and it does not work. Im not really worried about the case issue. I more would like to resolve the Multiline save issue with the last ini write in this.

Anyone help

Edited by Kendall

Share this post


Link to post
Share on other sites

$StrToINI = StringReplace($str, @CRLF, "\r\n") and $str = StringReplace($StrFromIni, "\r\n", @CRLF)

I found this Code and it looks like it should do the trick but i really dont understand it.

Can somone please help me with this so that i can get this working. Since the INI cannot send multiline information it needs to be converted to single lines i guess??

Share this post


Link to post
Share on other sites

$Input_Split = StringSplit(GUICtrlRead($Edit1), @CRLF) ;Splits and skips a String but does not cause INI Bleading.
    For $i = 1 To $Input_Split[0]
    IniWrite( $temp2, "Troubleshooting", $i, $Input_Split[$i] )    ; line 11 Timeline
    Next

$StrToINI = StringReplace($str, @CRLF, "\r\n") and $str = StringReplace($StrFromIni, "\r\n", @CRLF)

I found this Code and it looks like it should do the trick but i really dont understand it.

Can somone please help me with this so that i can get this working. Since the INI cannot send multiline information it needs to be converted to single lines i guess??

Here is the one that works.

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