Earthquake Posted July 21, 2006 Posted July 21, 2006 Hi Snipez, I found a new problem: I need some Variables that will be created with a counter. If it would be possible, it would look like this: ; Counter has value 3 for example $i=1 for $i to $Counter $Variable [u]&[/u] $Counter = $AnyFilename next msgbox($Variable1) msgbox($Variable2) msgbox($Variable3) It would be used in a while loop, to assign different values of Filenames to the variables. The Counter isn't fixed, cause the user is allowed to run this progress maybe a million times. Hope I could express, what I meant Thanks a lot guys! Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene!
Xenobiologist Posted July 21, 2006 Posted July 21, 2006 HI, somethinglike this? Global $counter = 3 For $i = 0 To $counter Switch $i Case 1 MsgBox(0, "1", "$Variable1") Case 2 MsgBox(0, "2", "$Variable2") Case 3 MsgBox(0, "3", "$Variable3") EndSwitch Next So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Earthquake Posted July 21, 2006 Author Posted July 21, 2006 (edited) Sorry, but "Switch" doesn't work (Beta version???) And this can't work, when the $Counter is 4! It has to be dynamic... the user may click 1 time another one clicks it 100 times! Like the program would create the cases depending the number of $Counter Edited July 21, 2006 by Earthquake Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene!
Moderators SmOke_N Posted July 21, 2006 Moderators Posted July 21, 2006 (edited) Sorry, but "Switch" doesn't work (Beta version???)And this can't work, when the $Counter is 4!It has to be dynamic... the user may click 1 time another one clicks it 100 times!Like the program would create the cases depending the number of $CounterWe all use beta for the most part, there's more functionality. Your explination marks could be construed meanly the way you have placed them. For the record, the "little" effort he (th.meger) put into it was actually more than you've shown thus far for your own issue.Edit:P.S. - Why is this even in the GUI forum... Edited July 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.
Earthquake Posted July 21, 2006 Author Posted July 21, 2006 (edited) Sorry, I didn't wanted to insult th.meger... I just didn't understand the way, "switch" could be used with cases... I'll try it with the beta version of AutoIt. I wrote it in the GUI Forum, cause the problem is acutally from a GUI, if it helps you, I could post the whole code. Edited July 21, 2006 by Earthquake Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene!
Moderators SmOke_N Posted July 21, 2006 Moderators Posted July 21, 2006 Sorry, I didn't wanted to insult th.meger...I just didn't understand the way, "switch" could be used with cases...I'll try it with the beta version of AutoIt.I wrote it in the GUI Forum, cause the problem is acutally from a GUI, if it helps you, I could post the whole code.That's always better than no code, I can't stand when I try to do something for someone, and they say... "no, that's not what I want to do"... just drives me batty when they either "A" haven't explained themselves well enough or "B" if they have, a working/non-working example would have made it easier to debug. 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.
Earthquake Posted July 21, 2006 Author Posted July 21, 2006 Ok, here it goes. Sorry for driving you mad @ Smoke_N I'm just a noob, trying to learn AutoIt... expandcollapse popup#include <GUIConstants.au3> GUI() Func GUI() GUICreate(".ini Creator for Tool Launcher", 320,95, -1, -1, -1, 0x00000018) GUICtrlCreateLabel ("Displayed name", 10, 10, 100) GUICtrlCreateLabel ("Path of the program", 130, 10, 100) $Counter=1 GUIContents($Counter) EndFunc Func GUIContents($Counter) $NameProgram = GUICtrlCreateInput ("Name", 10, 30, 100, 20) ; Input Box for name $ProgramPath = GUICtrlCreateInput ("Path", 130, 30, 165, 20) ; Specify the path of the program $OkButton = GUICtrlCreateButton ("Ok", 250, 65, 60, 20) $NextButton = GUICtrlCreateButton ("Next", 180, 65, 60, 20) ; Next entry to save. Should show the same GUI to save multiple contents GUISetState () Active($OkButton, $NextButton,$Counter,$NameProgram,$ProgramPath) EndFunc Func Active(ByRef $OkButton, $NextButton,$Counter,$NameProgram,$ProgramPath) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $OkButton exitloop Case $msg = $NextButton $Counter = $Counter +1 EndSelect Wend MsgBox(4096,"Test",$Counter) MsgBox (4096, "drag drop file",GUICtrlRead($NameProgram)) MsgBox (4096, "drag drop file",GUICtrlRead($ProgramPath)) EndFunc I know its not much yet, but I'm working on it! Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene!
Moderators SmOke_N Posted July 21, 2006 Moderators Posted July 21, 2006 (edited) expandcollapse popup#include <GUIConstants.au3> GUI() Func GUI() GUICreate(".ini Creator for Tool Launcher", 320,95, -1, -1, -1, 0x00000018) GUICtrlCreateLabel("Displayed name", 10, 10, 100) GUICtrlCreateLabel("Path of the program", 130, 10, 100) $Counter=1 GUIContents($Counter) EndFunc ;==>GUI Func GUIContents($Counter) $NameProgram = GUICtrlCreateInput("Name", 10, 30, 100, 20) ; Input Box for name $ProgramPath = GUICtrlCreateInput("Path", 130, 30, 165, 20) ; Specify the path of the program $OkButton = GUICtrlCreateButton("Ok", 250, 65, 60, 20) $NextButton = GUICtrlCreateButton("Next", 180, 65, 60, 20) ; Next entry to save. Should show the same GUI to save multiple contents GUISetState() Active($OkButton, $NextButton,$Counter,$NameProgram,$ProgramPath) EndFunc ;==>GUIContents Func Active(ByRef $OkButton, $NextButton,$Counter,$NameProgram,$ProgramPath) Local $MyArray[1], $MyArray2[2] $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $OkButton ExitLoop Case $msg = $NextButton $Counter = $Counter + 1 ReDim $MyArray[$Counter] ReDim $MyArray2[$Counter] $MyArray[$Counter - 1] = GUICtrlRead($NameProgram) $MyArray2[$Counter - 1] = GUICtrlRead($ProgramPath) EndSelect WEnd MsgBox(4096,"Test",$Counter) If IsArray($MyArray) And IsArray($MyArray2) Then For $iCount = 1 To UBound($MyArray) - 1 MsgBox(4096, "drag drop file", 'Array 1 - Element ' & $iCount & ': ' & $MyArray[$iCount]) MsgBox(4096, "drag drop file", 'Array 2 - Element ' & $iCount & ': ' & $MyArray2[$iCount]) Next EndIf EndFunc ;==>Active Edited July 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.
Earthquake Posted July 21, 2006 Author Posted July 21, 2006 Yes! It works. Thanks a lot! Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene!
Neoborn Posted July 22, 2006 Posted July 22, 2006 Ok, here it goes.Sorry for driving you mad @ Smoke_N I'm just a noob, trying to learn AutoIt...LOL oh no worries, he's been there a long time without your driving :D ~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT
Moderators SmOke_N Posted July 22, 2006 Moderators Posted July 22, 2006 LOL oh no worries, he's been there a long time without your driving :DI think that was the funniest thing I've seen you post (Probably because it's soooooooo TRUE). 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.
rush4hire Posted July 22, 2006 Posted July 22, 2006 Global $counter = 4 $variable1 = "I'm" $variable2 = "not" $variable3 = "feeling" $variable4 = "well.." For $i = 1 To $counter MsgBox(0, $i, Eval("variable"&$i)) Next Or you can make it an array. Decompilable game code manager for Dark Deeds 6 for Warcraft IIIA web broadcast TiVo like thing.. (this example is for 3abn.org)Finally.. AutoIt Pac-Man Digital Hymn Player
Moderators SmOke_N Posted July 22, 2006 Moderators Posted July 22, 2006 Global $counter = 4 $variable1 = "I'm" $variable2 = "not" $variable3 = "feeling" $variable4 = "well.." For $i = 1 To $counter MsgBox(0, $i, Eval("variable"&$i)) Next Or you can make it an array.Eval is not an array... 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.
Earthquake Posted July 24, 2006 Author Posted July 24, 2006 Ok, here's my finished .ini creator. It works just perfekt, as I wanted it! expandcollapse popup#include <GUIConstants.au3> GUI() Func GUI() Local $Array1[1], $Array2[1] Local $iniFilename Local $Browse $iniFilename = ("C:\Temp\myfile.ini") $Warning=MsgBox(1,"Warning","The old .ini file will be overwritten! Continue?") Select Case $Warning=$GUI_EVENT_CLOSE Exit Case $Warning = 2 Exit EndSelect $Counter=0 GUICreate(".ini Creator for Tool Launcher", 395,165, -1, -1, -1, 0x00000018) GUICtrlCreateLabel(".ini Creator for GPSD Tool Launcher", 110, 15, 200) GUICtrlCreateLabel("Displayed name:", 10, 50, 100) GUICtrlCreateLabel("Path of the program:", 10, 85, 100) GUICtrlCreateLabel("Record Nr. " & $Counter +1, 120, 114, 100) GUICtrlCreateLabel("Note: Only saved records will appear in the .ini!", 90, 140, 250) $NameProgram = GUICtrlCreateInput("Name", 110, 48, 180, 20) $ProgramPath = GUICtrlCreateInput("Path", 110, 81, 115, 20) $NextButton = GUICtrlCreateButton("Save", 300, 43, 80, 60) $OkButton = GUICtrlCreateButton("Finish", 300, 110, 80, 20) $Browse = GUICtrlCreateButton ("Browse...", 235, 81, 55, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $OkButton If $Counter = 0 Then $Counter = $Counter + 1 ReDim $Array1[$Counter] ReDim $Array2[$Counter] $Array1[$Counter - 1] = GUICtrlRead($NameProgram) $Array2[$Counter - 1] = GUICtrlRead($ProgramPath) EndIf ExitLoop Case $msg = $NextButton $Counter = $Counter + 1 ReDim $Array1[$Counter] ReDim $Array2[$Counter] $Array1[$Counter - 1] = GUICtrlRead($NameProgram) $Array2[$Counter - 1] = GUICtrlRead($ProgramPath) GUICtrlSetData($NameProgram,"") GUICtrlSetData($ProgramPath,"") GUICtrlCreateLabel("Record Nr. " & $Counter +1, 120, 114, 100) Case $msg = $Browse $Specified = FileOpenDialog("Select the tool, you want to insert","C:\", "Executes (*.exe)") If @error Then MsgBox(4096,"Error", "No file chosen") $Specified = StringReplace($Specified, "1", "Path") Else $Specified = StringReplace($Specified, "|", @CRLF) EndIf GUICtrlSetData($ProgramPath, $Specified) EndSelect WEnd FileOpen($iniFilename,2) FileWriteLine ($iniFilename,"[START]") FileWriteLine ($iniFilename,"") FileWriteLine ($iniFilename,"Amount=" & $Counter) FileWriteLine ($iniFilename,"") FileWriteLine ($iniFilename,"[Names]") FileWriteLine ($iniFilename,"") For $iCount = 0 To UBound($Array1) - 1 FileWriteLine ($iniFilename,'Script' & $iCount + 1 & '=' & $Array1[$iCount]) FileWriteLine ($iniFilename,$Array1[$iCount] & '=' & $Array2[$iCount]) Next FileClose($iniFilename) MsgBox(4096,"Done!", ".ini File has been written") EndFunc Thx a lot for helping and have phun, if u need this program! P.S. Special thanks to SmOke_N and th.meger Yes, I am a noob! But at least I try to learn!Moddingtech.de - Home of the german Modding-Scene!
rush4hire Posted July 26, 2006 Posted July 26, 2006 Eval is not an array...I'm not sure what you're correcting me about. I tested this and it works. Did I ever imply that Eval was an array somehow? All I was doing here was reducing redundancy from the first bit of code posted while staying as close to the origional concept as possible.Then lesson 2, which is a whole different subject, says "You can also use an array."Which implys that this would be even better yet.Obviously I meant an array instead of $variable1, $variable2, etc... uhhDamit I don't need these head games! Decompilable game code manager for Dark Deeds 6 for Warcraft IIIA web broadcast TiVo like thing.. (this example is for 3abn.org)Finally.. AutoIt Pac-Man Digital Hymn Player
Moderators SmOke_N Posted July 26, 2006 Moderators Posted July 26, 2006 I'm not sure what you're correcting me about. I tested this and it works. Did I ever imply that Eval was an array somehow? All I was doing here was reducing redundancy from the first bit of code posted while staying as close to the origional concept as possible.Then lesson 2, which is a whole different subject, says "You can also use an array."Which implys that this would be even better yet.Obviously I meant an array instead of $variable1, $variable2, etc... uhhDamit I don't need these head games!My misunderstanding then. It wasn't a head game I was playing, it was to make sure you weren't under the impression that Eval the way you were using it was an actual array which is how I read your statement. My apologies since it doesn't seem to be the case. 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.
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