satanttin Posted April 14, 2015 Share Posted April 14, 2015 Hello, First things first. I'm making a little program for work so i can keep track of the problems people report to me or when someone lends a specific item. However i encountered a problem(well problem i'm just a newb). The thing i want to do is that i can report multiple subjects to an accdom id(accdom id is the username) so i can look it up and not just 1 subject a person like it works now.(see .ini file to see what i am going for) [User 1] Subject=Problem 1 Uitgaven=4 Teruggaven=4 [User 1] Subject=Problem 2 Uitgaven=1 Teruggaven=4 Altho i don't know if there is a better way to do this. The code i have so far is: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $IAccdomID, $sSubject, $ISubject, $sAccdomID, $CBUit, $sBUit, $CBTerug, $sBTerug Opt("GUIOnEventMode", 1) Menu() Func Menu() $GMenu = GUICreate("Menu", 221, 251, 222, 691) $BNew = GUICtrlCreateButton("New", 50, 5, 121, 41) GUICtrlSetOnEvent($BNew, "new") $BSearch = GUICtrlCreateButton("Search", 50, 50, 121, 41) GUICtrlSetOnEvent($BSearch, "search") $BExit = GUICtrlCreateButton("Exit", 50, 195, 121, 51) GUICtrlSetOnEvent($BExit, "Close") GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") EndFunc Func new() $GNew = GUICreate("New", 613, 438, 714, 253) $IAccdomID = GUICtrlCreateInput("Accdom ID", 5, 5, 171, 21) $ISubject = GUICtrlCreateInput("Subject", 5, 35, 171, 21) $ENew = GUICtrlCreateEdit("", 0, 65, 611, 371) $BSend = GUICtrlCreateButton("Send", 520, 20, 76, 31) GUICtrlSetOnEvent($BSend, "SendNew") $CBUit = GUICtrlCreateCheckbox("Uitgaven", 310, 5, 85, 21) $CBTerug = GUICtrlCreateCheckbox("Teruggaven", 310, 35, 85, 21) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "closenew") EndFunc Func SendNew() $sSubject = GUICtrlRead($ISubject) $sAccdomID = GUICtrlRead($IAccdomID) $sBUit = GUICtrlRead($CBUit) $sBTerug = GUICtrlRead($CBTerug) IniWrite(@ScriptDir & "\data.ini", $sAccdomID, "Subject", $sSubject) IniWrite(@ScriptDir & "\data.ini", $sAccdomID, "Uitgaven", $sBUit) IniWrite(@ScriptDir & "\data.ini", $sAccdomID, "Teruggaven", $sBTerug) EndFunc Func search() EndFunc Func Close() Exit EndFunc Func closenew() GUISetState(@SW_HIDE) EndFunc While 1 Sleep(50) WEnd I hope this is thread is clear and that someone is able to help me. Greetings and have a nice day ^^ Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 14, 2015 Moderators Share Posted April 14, 2015 (edited) If you want to be able to link multiple "tickets" to a single person, the easiest thing to do is a small db. I would highly suggest looking into the _SQLite_ functions in the help file. Edit: Or, don't reinvent the wheel and download one of the many open source ticketing systems, such as Request Tracker, OTRS, Triage, etc. Edited April 14, 2015 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
satanttin Posted April 14, 2015 Author Share Posted April 14, 2015 Thanks for the reply and i shall look that up ^^ Link to comment Share on other sites More sharing options...
vikasgoyals Posted April 14, 2015 Share Posted April 14, 2015 sir anyone can help me to fix my program please i am new here i dont know much about it i made all the program but just 1-2 bugs in this pls help me to fix it by coming on team viewer thanks in advance Link to comment Share on other sites More sharing options...
JohnOne Posted April 14, 2015 Share Posted April 14, 2015 sir anyone can help me to fix my program please i am new here i dont know much about it i made all the program but just 1-2 bugs in this pls help me to fix it by coming on team viewer thanks in advance Not how it works here. Create a new topic and ask your question. Stop hijacking other members threads. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 14, 2015 Moderators Share Posted April 14, 2015 satanttin,I would change the ini entries to have all the info on a single line - like this:[User 1] Subject 1=A problem|4|1 Subject 2=Another problem|4|1 Subject 3=And another problem|1|1 Subject 4=And here is No 4|4|4 [User 2] Subject 1=Problem|4|4You can get this working by changing the SendNew function as follows:Func SendNew() $sSubject = GUICtrlRead($ISubject) $sAccdomID = GUICtrlRead($IAccdomID) $sBUit = GUICtrlRead($CBUit) $sBTerug = GUICtrlRead($CBTerug) ; Set initial entry value $iNewEntry = 0 ; Now read exisiting entries $aListing = IniReadSection(@ScriptDir & "\data.ini", $sAccdomID) If Not @error Then ; Sort to get in order _ArraySort($aListing) ; Now extract the index of the last entry $iNewEntry = StringReplace($aListing[$aListing[0][0]][0], "Subject ", "") EndIf ; Increase for the next entry $iNewEntry += 1 ; Now write all data for this entry as a new line in the ini - you can easily separate the Uit/Terug values when needed IniWrite(@ScriptDir & "\data.ini", $sAccdomID, "Subject " & $iNewEntry, $sSubject & "|" & $sBUit & "|" & $sBTerug) GUIDelete($GNew) EndFunc ;==>SendNewYou will also need to make $GNew Global in scope, and include the Array library. Please ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jchd Posted April 14, 2015 Share Posted April 14, 2015 The INI file format and accompanying conventions are not a suitable container for this use case. I second Jlogan3o13 on switching to custom SQLite or to select a full-fledged ticket-processing software. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
vikasgoyals Posted April 14, 2015 Share Posted April 14, 2015 sorry sir i did not know about it Not how it works here. Create a new topic and ask your question. Stop hijacking other members threads. Link to comment Share on other sites More sharing options...
satanttin Posted April 14, 2015 Author Share Posted April 14, 2015 satanttin, I would change the ini entries to have all the info on a single line - like this: [User 1] Subject 1=A problem|4|1 Subject 2=Another problem|4|1 Subject 3=And another problem|1|1 Subject 4=And here is No 4|4|4 [User 2] Subject 1=Problem|4|4 You can get this working by changing the SendNew function as follows:Func SendNew() $sSubject = GUICtrlRead($ISubject) $sAccdomID = GUICtrlRead($IAccdomID) $sBUit = GUICtrlRead($CBUit) $sBTerug = GUICtrlRead($CBTerug) ; Set initial entry value $iNewEntry = 0 ; Now read exisiting entries $aListing = IniReadSection(@ScriptDir & "\data.ini", $sAccdomID) If Not @error Then ; Sort to get in order _ArraySort($aListing) ; Now extract the index of the last entry $iNewEntry = StringReplace($aListing[$aListing[0][0]][0], "Subject ", "") EndIf ; Increase for the next entry $iNewEntry += 1 ; Now write all data for this entry as a new line in the ini - you can easily separate the Uit/Terug values when needed IniWrite(@ScriptDir & "\data.ini", $sAccdomID, "Subject " & $iNewEntry, $sSubject & "|" & $sBUit & "|" & $sBTerug) GUIDelete($GNew) EndFunc ;==>SendNew You will also need to make $GNew Global in scope, and include the Array library. Please ask if you have any questions. M23 Thanks for your reply, i'm kinda busy with work atm but i will test this asp and let u know if it works^^ (looks easier than the first reply that made my head hurt xD) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 14, 2015 Moderators Share Posted April 14, 2015 vikasgoyals, first we don't appreciate hijacking of someone else's thread. If you have a question: create your own post, explain in detail what you're trying to do, be prepared to show what you have tried on your own. As J1 is trying to explain, this is not a forum where you put in a request and someone else does the work for you. We're happy to help you learn, but you need to be willing to do so. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 14, 2015 Moderators Share Posted April 14, 2015 @OP, for the SQLite route, you might try something like this, just to give you an idea of what it would look like: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Local $aResult, $iRows, $iColumns, $iRval _SQLite_Startup() $hMyDB = _SQLite_Open(@DesktopDir & "\my.db") _SQLite_Exec($hMyDB, "CREATE TABLE Incidents (Name, Phone Number, Ticket Number, Problem);") _SQLite_Exec($hMyDB, "INSERT INTO Incidents VALUES ('Bill Jones','517.222.5555', 'SRC_108907', 'User locked out of network');") _SQLite_Exec($hMyDB, "INSERT INTO Incidents VALUES ('Tammy Coleman','517.222.5554', 'SRC_108910', 'User cannot print from Excel');") _SQLite_Exec($hMyDB, "INSERT INTO Incidents VALUES ('Bill Jones','517.222.5555', 'SRC_108912', 'User locked out of network - AGAIN');") _SQLite_Exec($hMyDB, "INSERT INTO Incidents VALUES ('Bill Jones','517.222.5555', 'SRC_108914', 'User fired');") $iRval = _SQLite_GetTable2d(-1, "SELECT * FROM Incidents;", $aResult, $iRows, $iColumns) If $iRval = $SQLITE_OK Then GUICreate("Show my SQLite Data", 500, 300) $sListView = GUICtrlCreateListView("Name|Phone Number|Ticket Number|Problem", 10, 10, 480, 280) For $i = 1 To UBound($aResult) - 1 GUICtrlCreateListViewItem($aResult[$i][0] & "|" & $aResult[$i][1] & "|" & $aResult[$i][2] & "|" & $aResult[$i][3], $sListView) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() Else MsgBox($MB_SYSTEMMODAL, "SQLite Error: " & $iRval, _SQLite_ErrMsg()) EndIf _SQLite_Close() _SQLite_Shutdown() "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 14, 2015 Moderators Share Posted April 14, 2015 satanttin,An afterthought was that you may need to use StringFormat to pad the number with leading 0's so the sorting works properly- let me know if you need a hand with that. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
satanttin Posted April 14, 2015 Author Share Posted April 14, 2015 @JLogan3o13 Thanks i have no clue on how to implent this inside my onevent script but thanks for replaying anyways ^^ @Melba23 i've tried puting your Function in my script but it gives me an error when i try to enter a second entry to a user with just the first entry it works: "C:\Users\tti007\Desktop\testy.au3" (46) : ==> Unknown function name.: _ArraySort($aListing) And tbh i can use a little help with StringFormat since i have no clue on what to do with that :$ Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted April 14, 2015 Moderators Solution Share Posted April 14, 2015 satanttin,Did you include the Array library as I mentioned in my post? Put#include <Array.au3>at the top of your script and all should be well. I will look into how we might use StringFormat this afternoon. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
satanttin Posted April 14, 2015 Author Share Posted April 14, 2015 satanttin, Did you include the Array library as I mentioned in my post? Put #include <Array.au3> at the top of your script and all should be well. I will look into how we might use StringFormat this afternoon. M23 omg guess i missed that haha. but it works now so thank you sir ^^ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 14, 2015 Moderators Share Posted April 14, 2015 satanttin,It was trivial so I did it immediately: Func SendNew() $sSubject = GUICtrlRead($ISubject) $sAccdomID = GUICtrlRead($IAccdomID) $sBUit = GUICtrlRead($CBUit) $sBTerug = GUICtrlRead($CBTerug) ; Set initial entry value $iNewEntry = 0 ; Now read exisiting entries $aListing = IniReadSection(@ScriptDir & "\data.ini", $sAccdomID) If Not @error Then ; Sort to get in order _ArraySort($aListing) ; Now extract the index of the last entry - use Number to strip the leading 0's $iNewEntry = Number(StringReplace($aListing[$aListing[0][0]][0], "Subject ", "")) EndIf ; Increase for the next entry $iNewEntry += 1 ; Now write all data for this entry as a new line in the ini - you can easily separate the Uit/Terug values when needed ; Note StringFormat used to pad the number with leading 0's so the sort will work properly IniWrite(@ScriptDir & "\data.ini", $sAccdomID, "Subject " & StringFormat("%05s", $iNewEntry), $sSubject & "|" & $sBUit & "|" & $sBTerug) GUIDelete($GNew) EndFunc ;==>SendNewM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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