VladimirTepech Posted December 16, 2022 Posted December 16, 2022 Hello everybody, I'm new to this forums, and hopefully will get better at AutoIT because it seems amazing and simple ! I'm trying to code a small tool which will help me count my number of tasks and keeping a track of it without having to write into a txt file manually, but I'm running into my first problem, I'm trying to write automatically the task name with the number of times I'm doing it, but I have no clue on how to NOT duplicate line of the similar task, and add counts on an already existing one, my code so far : expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #Region (=== GUI generated by GuiBuilderPlus 1.0.0-beta3 ===) Global $hGUI = GUICreate("Task Count Manager", 290, 104, 1080, 545) Global $Label_1 = GUICtrlCreateLabel("Task actuelle:", 30, 20, 71, 11) Global $Button_10 = GUICtrlCreateButton("10", 30, 60, 21, 21) Global $Button_20 = GUICtrlCreateButton("20", 60, 60, 21, 21) Global $Button_25 = GUICtrlCreateButton("25", 90, 60, 21, 21) Global $Button_30 = GUICtrlCreateButton("30", 120, 60, 21, 21) Global $Button_50 = GUICtrlCreateButton("50", 150, 60, 21, 21) Global $Button_70 = GUICtrlCreateButton("70", 180, 60, 21, 21) Global $Button_75 = GUICtrlCreateButton("75", 210, 60, 21, 21) Global $Button_100 = GUICtrlCreateButton("100", 240, 60, 21, 21) Global $Label_2 = GUICtrlCreateLabel("", 95, 20, 291, 25) #EndRegion (=== GUI generated by GuiBuilderPlus 1.0.0-beta3 ===) _main() ;------------------------------------------------------------------------------ ; Title...........: _main ; Description.....: run the main program loop ;------------------------------------------------------------------------------ Func _main() GUISetState(@SW_SHOWNORMAL) $MY_TITLE_REGEX = "(?:localhost)" Opt("WinTitleMatchMode", 4) $handle = WinGetHandle("[REGEXPTITLE:" & $MY_TITLE_REGEX & "]") $taskname = WinGetTitle($handle) $taskname_t = StringTrimRight($taskname, 27) GUICTRLSetData($Label_2, $taskname_t) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button_10 FileWrite("C:\Streaming\dettes.txt", $taskname_t & ":" & "10" & @CRLF) Case Else ; EndSwitch WEnd EndFunc ;==>_main Any help would be greatly appreciated, thanks !
Nine Posted December 16, 2022 Posted December 16, 2022 Maybe consider using an .ini file instead of .txt file. You can read the actual value of an entry with an .ini file, add a value and rewrite the new added value to the .ini file. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
VladimirTepech Posted December 16, 2022 Author Posted December 16, 2022 36 minutes ago, Nine said: Maybe consider using an .ini file instead of .txt file. You can read the actual value of an entry with an .ini file, add a value and rewrite the new added value to the .ini file. Thought about it, but for formatting and appealing purposes, it won't suit my needs as I'm reading the txt file through my desktop overlay.
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