PcExpert Posted March 24, 2009 Posted March 24, 2009 Hi all, I'm having some iniwrite problems with the following script: If Not FileExists("docenten") Then DirCreate("Docenten") EndIf For $h = 1 To 30 If Eval("new_docent" & $h) = "" Then ContinueLoop IniWrite("docenten\" & Eval("new_docent" & $h) & ".ini", "Algemeen", "Wachtwoord", "Cn5rVdt#s") Next MsgBox(64, "Cijfer Registratie Systeem | Melding", "Docent(en) toegevoegd")oÝ÷ ØZ½íôznµº1zÌ"¶¯j¸nW«b²·vë".Ëk·vØ^Ó~§{hqéí½ªâi¹^N©®åzh¬¶¶P-®ZÞi×îËb¢x¬jÊǦ¦Ü°éî±çbÈzØ^~å¢VéȦëZÈ£î²ÖÞ~Þ¶¢¹h¢ zÛaz¸ ÛÚ笶·÷Múì¡Ç§´ÕDG7öö«¦åzÆ«y×w)¶¬jëh×6$new_docent30 = GUICtrlRead($docent30) The weird thing is that the return value is always 0 when used INSIDE the loop. Does somebody know why this happens?
Overlord Posted March 24, 2009 Posted March 24, 2009 (edited) shouldn't it be If Eval("$new_docent" & $h) = "" Then ContinueLoopIniWrite("docenten\" & Eval("$new_docent" & $h) & ".ini", "Algemeen", "Wachtwoord", "Cn5rVdt#s")Just added $ before new_docent.that's where I think the error is since you say that the value for $new_docent30 = GUICtrlRead($docent30) Edited March 24, 2009 by Overlord
Monamo Posted March 24, 2009 Posted March 24, 2009 shouldn't it be Just added $ before new_docent.that's where I think the error is since you say that the value for $new_docent30 = GUICtrlRead($docent30)Not in this case. You wouldn't insert the $ manually as Eval() will, well, evaluate the data and interpret it as a variable after processing the string data.i.e.,Eval("firststring" & "secondstring")would be interpreted as $firststringsecondstring - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]
Overlord Posted March 24, 2009 Posted March 24, 2009 then I have no idea... I tried to help but have to limited scripting abilities...
99ojo Posted March 24, 2009 Posted March 24, 2009 (edited) Hi, you are sure that If Not FileExists("docenten") Then DirCreate("Docenten") EndIf MsgBox (0,"", $new_docent30) ; this msgbox shows another value then...... For $h = 1 To 30 If $h = 30 Then MsgBox (0,"",Eval("new_docent" & $h)) ; this one??? If Eval("new_docent" & $h) = "" Then ContinueLoop IniWrite("docenten\" & Eval("new_docent" & $h) & ".ini", "Algemeen", "Wachtwoord", "Cn5rVdt#s") Next MsgBox(64, "Cijfer Registratie Systeem | Melding", "Docent(en) toegevoegd" If yes, sorry, i can't help further. ;-(( Stefan Edited March 24, 2009 by 99ojo
Moderators Melba23 Posted March 24, 2009 Moderators Posted March 24, 2009 PcExpert,The following works for me:GUICreate("Test", 300, 300) $docent1 = GUICtrlCreateInput("", 10, 10, 200, 20) $docent2 = GUICtrlCreateInput("test", 10, 40, 200, 20) $new_docent1 = GUICtrlRead($docent1) $new_docent2 = GUICtrlRead($docent2) GUISetState() For $h = 1 To 2 ConsoleWrite("Before: docent" & $h & " : " & GUICtrlRead(Eval("docent" & $h)) & " - $new_Docent" & $h & " : " & Eval("new_docent" & $h) & @CRLF) If GUICtrlRead(Eval("docent" & $h)) = "" Then ContinueLoop ConsoleWrite("After : docent" & $h & " : " & GUICtrlRead(Eval("docent" & $h)) & " - $new_Docent" & $h & " : " & Eval("new_docent" & $h) & @CRLF) Next ExitIt reads the docent1/2 input values into the new_docent1/2 variables. It then runs the For...Next loop and shows the values of the relevant input box and the $new_docent variable. If there is something in the input it then rewrites the values. I get the correct values regardless of the input values and from both the GUICtrlRead and direct from the previously set variable.I hope this helps - if not let me have the full script. I have plenty of vakken space left on my drive (private joke)!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
PsaltyDS Posted March 24, 2009 Posted March 24, 2009 Hi all, I'm having some iniwrite problems with the following script: If Not FileExists("docenten") Then DirCreate("Docenten") EndIf For $h = 1 To 30 If Eval("new_docent" & $h) = "" Then ContinueLoop IniWrite("docenten\" & Eval("new_docent" & $h) & ".ini", "Algemeen", "Wachtwoord", "Cn5rVdt#s") Next MsgBox(64, "Cijfer Registratie Systeem | Melding", "Docent(en) toegevoegd") I have 30 inputboxes with a variable that is read using guictrlread (the $new_docent variable). The problem is that the GUIctrlread() function is always empty when used inside the for-loop. When I put a msgbox just before the for-loop I get the right values. the '$new_docent[NUMBERHERE]' variables are defined like this: $new_docent30 = GUICtrlRead($docent30) The weird thing is that the return value is always 0 when used INSIDE the loop. Does somebody know why this happens? Dude, we've been here before. You know the control IDs and values should be in arrays, and Eval() is lazy scam to avoid learning arrays. You should be creating the controls with: $avDocent[$n] = GuiCtrlCreateInput("", $x, $y, $w, $h) Then read the values with: For $h = 1 To 30 $avNew_docent[$h] = GUICtrlRead($avDocent[$h]) Next For $h = 1 To 30 If $avNew_docent[$h] = "" Then ContinueLoop IniWrite("docenten\" & $avNew_docent[$h] & ".ini", "Algemeen", "Wachtwoord", "Cn5rVdt#s") Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
PcExpert Posted March 24, 2009 Author Posted March 24, 2009 (edited) Thanks PSaltyDS, but it worked before, so why not now? Edited March 24, 2009 by PcExpert
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