Iznogoud Posted March 21, 2006 Author Share Posted March 21, 2006 Well a good practice is to close the file when your function is done with it... wouldn't you agree... then once it is closed, then you can proceed with whatever it is that your going to do. Thats the problem, after every fileopen wich is followed by something to do with that file , i have put a fileclose. But that wouldn't help either. But i am trying to re-order my code and to get a good view where and when etc. Maybe you know a solution to a question wich i asked before. $Klanten = $Klanten & "|" & $nieuweklant ; Only write the new data, not all the choices, to the control GUICtrlSetData($klantnaam, $nieuweklant) So if i add a new customer the name of the customer sometime it is automatically selected in the Combo box field. But sometimes it doesn't. Why is that? Am i not seeing something ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 21, 2006 Moderators Share Posted March 21, 2006 (edited) Well by the looks of it: 1. $Klanten = (creating an array I'm assuming) 2. $niewuweklant (is the new value I'm assuming) 3. $klantnaam (is the control id I'm assuming) Try this?$Klanten = $Klanten & $nieuweklant & '|' GUICtrlSetData($klantnaam, StringTrimRight($Klanten, 1))The snipplet you provided only really brings more questions, but maybe the above will work. Edit: Blah, you got me to type the $nieuweklant in the GUICtrlSetData() Edited March 21, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Iznogoud Posted March 21, 2006 Author Share Posted March 21, 2006 (edited) Well by the looks of it: 1. $Klanten = (creating an array I'm assuming) 2. $niewuweklant (is the new value I'm assuming) 3. $klantnaam (is the control id I'm assuming) Try this?$Klanten = $Klanten & $nieuweklant & '|' GUICtrlSetData($klantnaam, StringTrimRight($Klanten, 1))The snipplet you provided only really brings more questions, but maybe the above will work. Edit: Blah, you got me to type the $nieuweklant in the GUICtrlSetData() Hahahaha, after all this you maybe a little dutch But the solution doesn't work I have adjusted the code in parts and hopefully it gives a better view what the code is doing and you can easily find the parts you are looking for. My code: expandcollapse popup; ************************************************************************************* ; INCLUDING SCRIPTS ; ************************************************************************************* #include <GuiConstants.au3> #include <Array.au3> #include <file.au3> ; ************************************************************************************* ; CHECKING FILES IF THEY EXCIST ; ************************************************************************************* $path = IniRead("Settings.ini", "section1", "filepath", "Key(Path) not found") ; ************************************************************************************* ; CHECKING FILES IF THEY EXCIST ; ************************************************************************************* If FileExists($path & "Settings.ini" ) Then ;Do nothing Else MsgBox(0, "Error - (Settings bestand)", "Kan het bestand niet openen.") Exit EndIf ; ************************************************************************************* ; CREATING GUI ; ************************************************************************************* GuiCreate("Netviewer", 499, 508) ; ************************************************************************************* ; SETTING BACKGROUND COLOR ; ************************************************************************************* GUISetBkColor (0xFFFFFF) ; ************************************************************************************* ; DECLARING VARIABLES ; ************************************************************************************* $kantlijn = "70" $Datum = (@MDAY & "-" & @MON & "-" & @YEAR) $Gebruiktetijdinmin=0 $Klanten="" $Medewerkers="" $nieuweklanttoegevoegd="" $lfile=($path & "Log.csv") $kfile=($path & "Klanten.txt") $mfile=($path & "Medewerkers.txt") ; ************************************************************************************* ; CHECKING FILES ; ************************************************************************************* $logfile = FileOpen($path & "Log.csv", 1) If $logfile = -1 Then MsgBox(0, "Error - (Log bestand)", "Kan het bestand niet openen.") Exit EndIf $klantfile = FileOpen($path & "Klanten.txt", 0) If $klantfile = -1 Then MsgBox(0, "Error - (Klanten bestand)", "Kan het bestand niet openen.") Exit EndIf $medewerkersfile = FileOpen($path & "Medewerkers.txt", 0) If $medewerkersfile = -1 Then MsgBox(0, "Error - (Medewerkers bestand)", "Kan het bestand niet openen.") Exit EndIf ; ************************************************************************************* ; INPUT LOGOS ; ************************************************************************************* GUICtrlCreatePic($path & "logo1.jpg",0,0, 499,160) GUICtrlCreatePic($path & "logo2.jpg",0,420, 499,88) ; ************************************************************************************* ; CREATING LABELS ; ************************************************************************************* $labelmedewerker=GUICtrlCreateLabel ("Medewerker :",$kantlijn ,202 ,65 ,20) $labelklantnaam=GUICtrlCreateLabel ("Klantnaam :",$kantlijn ,242 ,65 ,20) $labelopmerking1=GUICtrlCreateLabel ("Opmerking 1 :",$kantlijn ,282 ,66 ,20) $labelopmerking2=GUICtrlCreateLabel ("Opmerking 2 :",$kantlijn ,322 ,66 ,20) ; ************************************************************************************* ; CREATING COMBO BOXES ; ************************************************************************************* $medewerker=GuiCtrlCreatecombo("<medewerker>",$kantlijn+100 , 200, 250, 100) While 1 $Wline = FileReadLine($Medewerkersfile) If @error = -1 Then ExitLoop $Medewerkers = $Medewerkers & "|" & $Wline WEnd GUICtrlSetData(-1, $Medewerkers) $klantnaam=GuiCtrlCreatecombo("<klantnaam>",$kantlijn+100, 240, 250, 20) While 1 $Kline = FileReadLine($klantfile) If @error = -1 Then ExitLoop $Klanten = $Klanten & "|" & $Kline WEnd GUICtrlSetData(-1, $Klanten) ; ************************************************************************************* ; CREATING INPUT FIELDS ; ************************************************************************************* $opmerking1=GuiCtrlCreateInput("<opmerking>",$kantlijn+100, 280, 250, 20) $opmerking2=GuiCtrlCreateInput("<opmerking>",$kantlijn+100, 320, 250, 20) ; ************************************************************************************* ; CREATE BUTTONS ; ************************************************************************************* $startbutton = GUICtrlCreateButton ("Start Netviewer",$kantlijn+125,380,150,20) $nieuweklantbutton = GUICtrlCreateButton ("Nieuw", $kantlijn+360,240,20,20,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",21, 0) ; ************************************************************************************* ; GUI MESSAGE LOOP ; ************************************************************************************* GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $nieuweklantbutton $nieuweklant = InputBox("Nieuwe klant toevoegen", "Klantnaam", " bijv.: Company (City) ", "", 300, 125) $klantfile = FileOpen($path & "Klanten.txt", 1) FileWriteLine($klantfile, $nieuweklant) $Klanten = $Klanten & "|" & $nieuweklant GUICtrlSetData($klantnaam, $nieuweklant) $nieuweklanttoegevoegd=1 Case $msg = $GUI_EVENT_CLOSE FileClose($logfile) FileClose($klantfile) FileClose($medewerkersfile) Exit Case $msg = $startbutton ; ************************************************************************* ; SETTING USED TIME ; ************************************************************************* $BegintijdUur=(@HOUR) $BegintijdMin=(@MIN) $Begintijd=($BegintijdUur & ":" & $BegintijdMin) ExitLoop EndSelect Wend ; ************************************************************************************* ; DISABLE BUTTONS ; ************************************************************************************* GUICtrlSetState($startbutton, $GUI_HIDE) GUICtrlSetState($nieuweklantbutton, $GUI_DISABLE) GUICtrlSetState($medewerker, $GUI_DISABLE) GUICtrlSetState($klantnaam, $GUI_DISABLE) GUICtrlSetState($opmerking1, $GUI_DISABLE) GUICtrlSetState($labelmedewerker, $GUI_DISABLE) GUICtrlSetState($labelklantnaam, $GUI_DISABLE) GUICtrlSetState($labelopmerking1, $GUI_DISABLE) ; ************************************************************************************* ; START THE APPLICATION ; ************************************************************************************* Run("notepad.exe") ProcessWaitClose("notepad.exe") ; ************************************************************************************* ; SETTING END TIME ; ************************************************************************************* $EindtijdUur=(@HOUR) $EindtijdMin=(@MIN) $Eindtijd=($EindtijdUur & ":" & $EindtijdMin) ; ************************************************************************************* ; SETTING USED TIME ; ************************************************************************************* $Gebruiktetijd=(($EindtijdUur-$BegintijdUur) & " uur en " & ($EindtijdMin-$BegintijdMin) & " minuten" ) ; ************************************************************************************* ; SETTING USED TIME IN MINUTES ; ************************************************************************************* $Gebruiktetijdinmin=(($EindtijdUur-$BegintijdUur)*60+($EindtijdMin-$BegintijdMin)) ; ************************************************************************************* ; CREATING EXIT BUTTON ; ************************************************************************************* $afsluiten = GUICtrlCreateButton ("Afsluiten",$kantlijn+125,380,150,20) ; ************************************************************************************* ; GUI MESSAGE LOOP ; ************************************************************************************* While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $afsluiten ExitLoop EndSelect Wend ; ************************************************************************************* ; CREATING LOG EVENT ; ************************************************************************************* FileWriteLine($logfile, $Datum & ";" & $Begintijd & ";" & $Eindtijd & ";" & $Gebruiktetijdinmin & ";" & $Gebruiktetijd & ";" & GUICtrlRead($medewerker) & ";" & GUICtrlRead($klantnaam) & ";" & GUICtrlRead($opmerking1) & ";" & GUICtrlRead($opmerking2)) ; ************************************************************************************* ; CLOSING FILES ; ************************************************************************************* FileClose($logfile) FileClose($klantfile) FileClose($medewerkersfile) ; ************************************************************************************* ; SORTING CUSTOMER FILE ; ************************************************************************************* If $nieuweklanttoegevoegd=1 Then Run($path & "SortingCustomers.exe") Else Exit EndIf Don't forget i am a n00b at programming, but i am trying my best. This is the part of the code where it all is happening: Case $msg = $nieuweklantbutton $nieuweklant = InputBox("Nieuwe klant toevoegen", "Klantnaam", " bijv.: Mareco Automatisering (Dedemsvaart) ", "", 300, 125) $klantfile = FileOpen($path & "Klanten.txt", 1) FileWriteLine($klantfile, $nieuweklant) $Klanten = $Klanten & "|" & $nieuweklant GUICtrlSetData($klantnaam, $nieuweklant) $nieuweklanttoegevoegd=1 With this its at least added to the bottom of the list, but i would like to auto select so you don't have to scroll down and select it. Edited March 21, 2006 by Iznogoud Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 21, 2006 Moderators Share Posted March 21, 2006 Wow, your really all over the place there.... Tell you what... I have a few things to do, if someone doesn't beat me to it late this evening I'll have a peak at the whole thing. From what I can see off hand without digging into it, I see a few errors other than what you've pointed out. I'll make an ini and file to read... unless you would be so kind as to attatch a demo. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 21, 2006 Developers Share Posted March 21, 2006 :With this its at least added to the bottom of the list, but i would like to auto select so you don't have to scroll down and select it.Try: GUICtrlSetData($klantnaam, $nieuweklant, $nieuweklant)This should set it as default... SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Iznogoud Posted March 21, 2006 Author Share Posted March 21, 2006 Wow, your really all over the place there.... Tell you what... I have a few things to do, if someone doesn't beat me to it late this evening I'll have a peak at the whole thing. From what I can see off hand without digging into it, I see a few errors other than what you've pointed out. I'll make an ini and file to read... unless you would be so kind as to attatch a demo. Sure, i will do almost anything to help you. But don't forget it is not my point to let all the work be done by you and don't forget i appreciate all the help i get. This is what i got in the ini. [section1] filepath=C:\company\ [section2] filepath=C:\company\ I will try GUICtrlSetData($klantnaam, $nieuweklant, $nieuweklant) right now Thx guys. Link to comment Share on other sites More sharing options...
Iznogoud Posted March 21, 2006 Author Share Posted March 21, 2006 Try: GUICtrlSetData($klantnaam, $nieuweklant, $nieuweklant)This should set it as default...You are right, this solves the point i had to set the new variable as default. GREAT thank you.I am looking forward to see my errors wich i made (stupid thing to say, but maybe i learn from it ) Link to comment Share on other sites More sharing options...
Developers Jos Posted March 21, 2006 Developers Share Posted March 21, 2006 (edited) You are right, this solves the point i had to set the new variable as default. GREAT thank you.I am looking forward to see my errors wich i made (stupid thing to say, but maybe i learn from it )Hij herschrijft het nog wel even voor je vandaag ... Edited March 21, 2006 by JdeB SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Iznogoud Posted March 21, 2006 Author Share Posted March 21, 2006 (edited) Hij herschrijft het nog wel even voor je vandaag ... Whahaha, valt me nu pas op dat er een nederlandse moderator is Hij hoeft het niet te herschijven, ik moet het nog wel blijven snappen Trying to translate it to english He will rewrite it for you today ... Whahaha, i just noticed there is a dutch moderator He does not have to rewrite it, i still need to understand it Edited March 21, 2006 by Iznogoud Link to comment Share on other sites More sharing options...
Iznogoud Posted March 29, 2006 Author Share Posted March 29, 2006 Wow, your really all over the place there....Tell you what... I have a few things to do, if someone doesn't beat me to it late this evening I'll have a peak at the whole thing. From what I can see off hand without digging into it, I see a few errors other than what you've pointed out.I'll make an ini and file to read... unless you would be so kind as to attatch a demo.Did you had time to look at my code for the errors you have seen?Because i encountered some problems in my log, sometimes it isnt counting the values right.But i can't find it. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 29, 2006 Moderators Share Posted March 29, 2006 Did you had time to look at my code for the errors you have seen?Because i encountered some problems in my log, sometimes it isnt counting the values right.But i can't find it.No... When you said you had gotten to it, and fixed it, I figured you had done that... Sorry... If I can find time, I'll have a look again. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Iznogoud Posted March 30, 2006 Author Share Posted March 30, 2006 I got it working, but you said there where a few erros in the quick vieuw you had. The best way to learn is to see your own errors i think. So i hope you got some time somewhere Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 30, 2006 Moderators Share Posted March 30, 2006 (edited) With not having the files to debug... this was I think the thing that stood out to me:Run("notepad.exe") ProcessWaitClose("notepad.exe"); <<< THIS WILL NOT DO ANYTHING UNTIL THE PROCESS CLOSES (IT WON'T GO PAST THIS POINT)... IS THAT WHAT YOU WANT? The code is hard to read because you have everything bunched together... So it wasn't much fun trying to debug it to be honest... If you have problems with it, send it over via pm, with the files I would need to run it properly, and I'll give it a once over (but clean it up a bit first ) Edited March 30, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Iznogoud Posted March 31, 2006 Author Share Posted March 31, 2006 With not having the files to debug... this was I think the thing that stood out to me:Run("notepad.exe") ProcessWaitClose("notepad.exe"); <<< THIS WILL NOT DO ANYTHING UNTIL THE PROCESS CLOSES (IT WON'T GO PAST THIS POINT)... IS THAT WHAT YOU WANT? The code is hard to read because you have everything bunched together... So it wasn't much fun trying to debug it to be honest... If you have problems with it, send it over via pm, with the files I would need to run it properly, and I'll give it a once over (but clean it up a bit first ) I will explain why i would make this program. We are using a remote support tool wich can take over pc's of customers. The only problem we didn't get a good idea of the time wich is used for support the customers. So i have made this program, at least i am trying. The programma creates a GUI where you can fill in some fields like wich employee is starting the remote support session. Then you can select the customer name from the list. The next you can give a reason like "Removing Virusses" for an example. Then you click the start button and the real application for Remote Support starts en you can help the customer. Thats why i usa a ProcessWaitClose. When the process is closed the program wich i created must go on with the rest of the code. Like setting time and give you an option to give another reason for the things what you did for the customer. After all this writing to a log file. Must i post the problem wich i encounter or should i send you the files you need so you can run this program? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 31, 2006 Moderators Share Posted March 31, 2006 Yes, feel free to send it over via PM. I am on my own mission at the moment (finally)... Outlook automation is kicking my back side... wish I knew COM like these guys do. I've got it about 30% finished though, and I can automate EVERYTHING via the road , and the wife can't (she will anyway) complain about my time anymore... cuz she'll get all of it (ut oh... that might mean divorce! ) Anyway, I'll be happy to take a peak... but please whatever you do... go into as much detail (even comment everything) as you can if you don't mind. I know it's tough with the language barrier, I just wish I knew another language as well as alot of you that speak multiple ones. Take Care... Me Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Iznogoud Posted March 31, 2006 Author Share Posted March 31, 2006 Yes, feel free to send it over via PM.I am on my own mission at the moment (finally)... Outlook automation is kicking my back side... wish I knew COM like these guys do. I've got it about 30% finished though, and I can automate EVERYTHING via the road , and the wife can't (she will anyway) complain about my time anymore... cuz she'll get all of it (ut oh... that might mean divorce! )Anyway, I'll be happy to take a peak... but please whatever you do... go into as much detail (even comment everything) as you can if you don't mind. I know it's tough with the language barrier, I just wish I knew another language as well as alot of you that speak multiple ones.Take Care... MeNo problem, i will do my best to comment all the things and change the variables to english.You will get a PM if i am ready. Thx for the help so far, i appreciate it alot. 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