flagg777 Posted January 1, 2016 Share Posted January 1, 2016 Thank you all in advance for your time. I consider myself fair with AutoIT however I have taken on a lengthy project.I have built most of the script however lack the logic to put all the moving parts in motion.The project:I work for a 911 call center. We randomly pull recorded calls and evaluate the dispatcher. We pull 100 calls a day and need a simply method to record and organize each point of the call.I have set out to build a survey form that will have several radio buttons. The surveyor will answer yes or no questions. I need each answer to be captured and placed in an Excel CSV file. The Output can be Boolean. The CSV file will store each output, I need each output individual for monthly/yearly reports.I also want to store non Boolean items such as dispatcher name, unit number, time of call, etc. I want the same CSV file to store this information.This is my next hurtle. After this hurtle I will tackle what to do with a 100 character notes field.Any examples that could be provided or advice would be greatly appreciated. Thanks again alphav012.au3 Link to comment Share on other sites More sharing options...
InunoTaishou Posted January 1, 2016 Share Posted January 1, 2016 (edited) If you're just storing it in a simple .csv file then the file can be plain text. Just know that each cell of the csv file is actually comma separated in the file.Example, if you create a text file and use thishello,world,how,are,you,?i,am,doing,fine,today,!Then rename it to Whatever.csv then a1 = "hello", b1="world", c1="how", d1="are", e1="you", f1="?" a2="i", b2="am", c2="doing", d2="fine", e2="today", f2="!"That's the easy part, the harder part (which isn't hard at all) is just going through each Control and doing GUICtrlRead to get the value (I.e., radio checked, not checked, text from the edit, etc). This would get you started on getting the information and saving to a csv file. As for the note field, are you wanting to limit the note field to 100 characters? If so you can use GUICtrlSetLimit(controlID, max, min = 0) to set the maximum and minimum number of characters.It'll be up to you how you want to organize the information in the CSV file, just remember each , (comma) is a new column, each @CRLF is a new row (in the csv file)expandcollapse popupWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ExportInformation() EndSwitch WEnd Func ExportInformation() Local $sString = "" Local $hWnd_file If (GUICtrlRead($Radio1pos) = $GUI_CHECKED) Then $sString &= "Tone Alert Used,Yes" & @CRLF ElseIf (GUICtrlRead($Radio1neg) = $GUI_CHECKED) Then $sString &= "Tone Alert Used,No" & @CRLF Else $sString &= "Tone Alert Used,Unanswered" & @CRLF EndIf If (GUICtrlRead($Radio2pos) = $GUI_CHECKED) Then $sString &= "Sunstar 3 Digit Unit#,Yes" & @CRLF ElseIf (GUICtrlRead($Radio2neg) = $GUI_CHECKED) Then $sString &= "Sunstar 3 Digit Unit#,No" & @CRLF Else $sString &= "Sunstar 3 Digit Unit#,Unanswered" & @CRLF EndIf If (GUICtrlRead($Radio3pos) = $GUI_CHECKED) Then $sString &= "Repeat 3 Didit Unit#,Yes" & @CRLF ElseIf (GUICtrlRead($Radio3neg) = $GUI_CHECKED) Then $sString &= "Repeat 3 Didit Unit#,No" & @CRLF Else $sString &= "Repeat 3 Didit Unit#,Unanswered" & @CRLF EndIf If (GUICtrlRead($Radio4pos) = $GUI_CHECKED) Then $sString &= "Location,Yes" & @CRLF ElseIf (GUICtrlRead($Radio4neg) = $GUI_CHECKED) Then $sString &= "Location,No" & @CRLF Else $sString &= "Location,Unanswered" & @CRLF EndIf If (GUICtrlRead($Radio5pos) = $GUI_CHECKED) Then $sString &= "Cross Street,Yes" & @CRLF ElseIf (GUICtrlRead($Radio5neg) = $GUI_CHECKED) Then $sString &= "Cross Street,No" & @CRLF Else $sString &= "Cross Street,Unanswered" & @CRLF EndIf If (GUICtrlRead($Radio6pos) = $GUI_CHECKED) Then $sString &= "Map Grid,Yes" & @CRLF ElseIf (GUICtrlRead($Radio6neg) = $GUI_CHECKED) Then $sString &= "Map Grid,No" & @CRLF Else $sString &= "Map Grid,Unanswered" & @CRLF EndIf If (GUICtrlRead($Radio6pos) = $GUI_CHECKED) Then $sString &= "SS Tac Channel,Yes" & @CRLF ElseIf (GUICtrlRead($Radio6neg) = $GUI_CHECKED) Then $sString &= "SS Tac Channel,No" & @CRLF Else $sString &= "SS Tac Channel,Unanswered" & @CRLF EndIf If (GUICtrlRead($Radio6pos) = $GUI_CHECKED) Then $sString &= "Info out of Order,Yes" & @CRLF ElseIf (GUICtrlRead($Radio6neg) = $GUI_CHECKED) Then $sString &= "Info out of Order,No" & @CRLF Else $sString &= "Info out of Order,Unanswered" & @CRLF EndIf $hWnd_file = FileOpen(@ScriptDir & "\Test.csv", $FO_OVERWRITE) FileWrite($hWnd_file, $sString) FileClose($hWnd_file) MsgBox($IDOK, "Submitted", "Your survey has been submitted!") EndFuncIt might help, if you want to make it (maybe) a little easier on yourself, if you knew that Controls are created in sequential order (I.e., if you created a $btnStart, $btnCancel, $btnStop, etc then $btnStart = 1, $btnCancel = 2, $btnStop = 3, etc). If you wanted to you could create the radio controls grouped and go through each one with a for loop.Here's what I meanexpandcollapse popup#include <GUIConstants.au3> Global $frmExample = GUICreate("Example", 95, 435) Global $lblExample1 = GUICtrlCreateLabel(Random(0, 1000), 10, 10, 75, 20) Global $lblExample2 = GUICtrlCreateLabel(Random(0, 1000), 10, 35, 75, 20) Global $lblExample3 = GUICtrlCreateLabel(Random(0, 1000), 10, 60, 75, 20) Global $lblExample4 = GUICtrlCreateLabel(Random(0, 1000), 10, 85, 75, 20) Global $lblExample5 = GUICtrlCreateLabel(Random(0, 1000), 10, 110, 75, 20) Global $lblExample6 = GUICtrlCreateLabel(Random(0, 1000), 10, 135, 75, 20) Global $lblExample7 = GUICtrlCreateLabel(Random(0, 1000), 10, 160, 75, 20) Global $lblExample8 = GUICtrlCreateLabel(Random(0, 1000), 10, 185, 75, 20) Global $lblExample9 = GUICtrlCreateLabel(Random(0, 1000), 10, 210, 75, 20) Global $lblExample10 = GUICtrlCreateLabel(Random(0, 1000), 10, 235, 75, 20) Global $lblExample11 = GUICtrlCreateLabel(Random(0, 1000), 10, 260, 75, 20) Global $lblExample12 = GUICtrlCreateLabel(Random(0, 1000), 10, 285, 75, 20) Global $lblExample13 = GUICtrlCreateLabel(Random(0, 1000), 10, 310, 75, 20) Global $lblExample14 = GUICtrlCreateLabel(Random(0, 1000), 10, 335, 75, 20) Global $lblExample15 = GUICtrlCreateLabel(Random(0, 1000), 10, 360, 75, 20) Global $lblExample16 = GUICtrlCreateLabel(Random(0, 1000), 10, 385, 75, 20) Global $btnExample = GUICtrlCreateButton("Get Data", 10, 410, 75, 20) GUISetState(@SW_SHOW, $frmExample) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btnExample ExportInformation() EndSwitch WEnd Func ExportInformation() Local $sString = "" For $i = $lblExample1 To $lblExample16 $sString &= "Label " & $i & " has value " & GUICtrlRead($i) & @CRLF Next MsgBox("", "", $sString) EndFuncThe string printed in the message box will actually say "Label 3 has value ... Label 18 has value..." even though the labels are numbered Example 1 to 16. Hopefully that's understandable. If it helps then great, if not then go through each one of your controls however you wish. Good Luck Edited January 1, 2016 by InunoTaishou Link to comment Share on other sites More sharing options...
mikell Posted January 1, 2016 Share Posted January 1, 2016 If I understood correctly you need to store data (about 20 items by call) for 100 calls a day, meaning about 36000 calls a yearFor such a storage I strongly suggest a SQLite database which is extremely powerful - no problem with 100 chars items - and fast and allows all kinds of reports computergroove 1 Link to comment Share on other sites More sharing options...
flagg777 Posted January 1, 2016 Author Share Posted January 1, 2016 OMG THANK YOU!This is exactly what I needed, some direction.Many thanks. Link to comment Share on other sites More sharing options...
flagg777 Posted January 3, 2016 Author Share Posted January 3, 2016 With the help provided I have finished the first hurtle. Thanks! I could not have been where I am now without help. For your evaluation: I am proud of it so far!Any ideas on how to refine this would be awesome! alphav019.au3 Link to comment Share on other sites More sharing options...
flagg777 Posted January 3, 2016 Author Share Posted January 3, 2016 My next hurtle is the Email function. (If you run the script above and fill in the radio buttons you will see the email function)This is clearly out of my realm and I have no clue even where to start.I have an internal SMTP POP server I can relay the mail off of, I was thinmking this would be a inline task with several lines for my "subject" and "body" fields.Here is an example of an email script I was trying to Frankenstein however it is complex and I am sure it could be much easier.My goal is to make a simple email that said "Here is your test score" & "XX%" Thanks in advance! emailExample.au3 Link to comment Share on other sites More sharing options...
InunoTaishou Posted January 4, 2016 Share Posted January 4, 2016 This topic might lead you in the right direction of your emailing stuff. You could also try to use FTP and upload it to a server, if you have access to one. Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted January 4, 2016 Share Posted January 4, 2016 I also work for 911 (on the IT Side) I built us a Kiosk to track the location/status of our Toughpads and such. I used MySQL for that task, I like the idea of a server/client relationship and its free and easy to use just like SQLite. Just my preference.Last time I needed to gather a lot of information in a similar manner to this I used GoogleDocs and created a form that would submit everything to a spreadsheet, I then used Autoit to merge all those spreadsheets into a master data document.But with HIPPA and such I would understand if anything other than internal servers holding any data could be an issue. Link to comment Share on other sites More sharing options...
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