Jump to content
Sign in to follow this  
wafuh

Saving to a file - need reply asap

Recommended Posts

wafuh

Hi,

I need a little help. I just cant simply dunno how to start. ideas are running around inside my head but cant catch them to start and finish a simple saving.. Here's my prob.. I want to save changes i made. I input text and click a radio button and select from the dropdwon list. Now my problem is how will i ever get them together and log it into a file. I have an existing file (test.csv) I want to put it all there.

Text in the column Notes, Radio in the column radio lets say then save it there. Im so confused in making logics and variable declaration.. can somebody help me please...

Thanks in advance

heres my sample script:

#include <GUIConstants.au3>

GUICreate("Saving")

$radio1 = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)

$radio2 = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)

$Label1= GUICtrlCreateLabel("STATUS ",10,60, 120, 20)

$Text = GUICtrlCreateInput ( " ", 10, 100, 160, 80)

$Btn_Save = GUICtrlCreateButton ("Save", 40,190, 90,20)

GUICtrlSetOnEvent( $Btn_Save, "Save")

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

$msg = $GUI_CHECKED

Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED

$Label1=GUICtrlCreateLabel("Pending",10,80, 120, 20)

Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$Label1 = GUICtrlCreateLabel("Completed",10,80, 120, 20)

EndSelect

Wend

Func Save()

Dim $Add_Text, $Click, $Get_Idx = 0, $File, $Updated_Item

GUISetState(@SW_DISABLE)

$Add_Text = GUICtrlRead($Text)

$Click = GuiCtrlRead($GUI_CHECKED)

$ItemToAssigned = _GUICtrlGetItemText($Text,$GU $idx)

If ($ItemToAssigned <> $LV_ERR) Then

$F_idx = $F_idx + 1

_FileWriteToLine("test.txt", $F_idx, $ItemToAssigned, 1)

EndIf

Share this post


Link to post
Share on other sites
smashly

Hi

Please explain what your trying to do a bit better/clearer and I could probably help.

You mention a dropdown list , where is it?

Your explanation of your problem is baffling to say the least..

I understand the part of wanting to put the text from the input box into the test.csv.

But how should the text be laid out..

A sample of the test.csv layout may help a little.

I don't understand what you mean with the Radio buttons and dropdown list part.

Cheers

Share this post


Link to post
Share on other sites
wafuh

Hi

Please explain what your trying to do a bit better/clearer and I could probably help.

You mention a dropdown list , where is it?

Your explanation of your problem is baffling to say the least..

I understand the part of wanting to put the text from the input box into the test.csv.

But how should the text be laid out..

A sample of the test.csv layout may help a little.

I don't understand what you mean with the Radio buttons and dropdown list part.

Cheers

Thank u for the immediate reply..

heres an attachement of my csv file. i want to save all changes i made on the screen and put in on the list

Hope u could help asap.ty

heres my new code:

#include <GUIConstants.au3>

Opt("GUIDataSeparatorChar",",")

#include <file.au3>

GUICreate("Saving")

$radio1 = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)

$radio2 = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)

$Label1= GUICtrlCreateLabel("STATUS ",10,60, 120, 20)

$Text = GUICtrlCreateInput ( " ", 10, 100, 160, 80)

$C_Branch = GUICtrlCreateCombo ("Select Branch", 10,190, 200,55)

GUICtrlSetData($C_Branch , "RockTown,Central Ice,Mountaineer Peepz,Pacific Village,Summer Fields")

$C_Dept = GUICtrlCreateCombo ("Contact Person", 10,230, 140,25)

GUICtrlSetData($C_Dept, "Acct Person,IT Person, Payroll Staff, Secretaty")

$ListView1 = GUICtrlCreateListView("Ribbon,Delivery,Branch,Transfer,Deliver To,Status,Notes", 10,250,250,100)

;$Can= GUICtrlCreateListViewItem($ListView1,"RockTown,Acct Person,Deliver To,Status,2 boxes receiving")

$Btn_Save = GUICtrlCreateButton ("Save", 40,300, 90,20)

;GUICtrlSetOnEvent( $Btn_Save, "Save")

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

$msg = $GUI_CHECKED

Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED

$Label1=GUICtrlCreateLabel("Pending",10,80, 120, 20)

Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$Label1 = GUICtrlCreateLabel("Completed",10,80, 120, 20)

EndSelect

Wend

;~ Func Save()

;~ Dim $Add_Text, $Click, $Get_Idx = 0, $File, $Updated_Item

;~ GUISetState(@SW_DISABLE)

;~

;~ $Add_Text = GUICtrlRead($Text)

;~ $Click = GuiCtrlRead($GUI_CHECKED)

see attachments:

script and csv

Share this post


Link to post
Share on other sites
wafuh

Hi to all,

please help me to save all these updates and put it on the list under my csv file. I also put a list view so i could see all the updated data in the right place. The file should be loaded and all are there saved. I revised my gui design.. Hope you could help me scripting this.

thanks

saving.au3

Share this post


Link to post
Share on other sites
wafuh

im not sure if i really attached the csv file.. thats why i will re attached it but this time the screen shot of the csv file ext.. im not allowed to attached it. see pic

post-30142-1201177034_thumb.gif

Share this post


Link to post
Share on other sites
martin

im not sure if i really attached the csv file.. thats why i will re attached it but this time the screen shot of the csv file ext.. im not allowed to attached it. see pic

You say that maybe put the radio button in the Radio column but there isn't such a heading.

Is the csv file going to be loaded into Excel, or will it only be used by your script?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
wafuh

the csv will be loaded into excel which will serve as the main file or records for tracking for admin and user profile. and at the same time it will be posted on the list view grid for viewing purposes and updating it..

Share this post


Link to post
Share on other sites
wafuh

does any1 of you has a sample script that may apply to my problem? pls send me.. Its all about saving! then writing it to csv to update records..

thanks! thanks! :D

Share this post


Link to post
Share on other sites
Tomb

here is an idea i had

what if say checkbox 1 is checked, then iniwrite 1, and if its not checked, iniwrite 0. and when the application starts next time, it can reference the ini, and load it based on that.

Share this post


Link to post
Share on other sites
wafuh

i got the solution already on this question of mine!

i used guicrtlread, then update the list (_guictrllistviewsetitemtext) and use some conditional statements!!

thanks for all who had the effort to reply on this...

more power to you all!!! :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.