rec0il Posted January 2, 2008 Share Posted January 2, 2008 Hi. This is my first post in AutoIt Forum. I hope will my English is not bad To The Problem: I have this simple code: WinActivate ("AutoIt Help") $powt = _StringRepeat (omg(), GuiCtrlRead($Input2)) Func omg() If WinActive ("AutoIt Help") Then Sleep (1000) Send ("{enter}") Send (GuiCtrlRead($Input1)) Send ("{enter}") Sleep (2000) EndIf EndFunc And i do not know why "_StringRepeat" not work. The action repeats herself only once, even if in $Input2 is written 2 or another number. Why? Link to comment Share on other sites More sharing options...
DW1 Posted January 2, 2008 Share Posted January 2, 2008 you are calling a string repeat on the return of a function that returns nothing... am I missing something here? AutoIt3 Online Help Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 2, 2008 Share Posted January 2, 2008 (edited) Hi. This is my first post in AutoIt Forum. I hope will my English is not bad To The Problem: I have this simple code: WinActivate ("AutoIt Help") $powt = _StringRepeat (omg(), GuiCtrlRead($Input2)) Func omg() If WinActive ("AutoIt Help") Then Sleep (1000) Send ("{enter}") Send (GuiCtrlRead($Input1)) Send ("{enter}") Sleep (2000) EndIf EndFunc And i do not know why "_StringRepeat" not work. The action repeats herself only once, even if in $Input2 is written 2 or another number. Why? An Input control returns a string vice a number. Try this: $powt = _StringRepeat (omg(), Number(GuiCtrlRead($Input2)))oÝ÷ Ù*&z)íz¹Ú _ºw-쩽ªâi¹^·*^rïz»"¢{¢¼¨¹»©òP1_ºw-ìv÷öÛ(Ýý²Æz»hë-jË.쨺ÈhºWZ²±·ÁªÞ¡ûazö«¦åzÜ©{*.ªÞ¥«,xH:²}ýµªiyªí¡·êk¡¹^«y«¢+Ø¥¹±Õ±ÐíÍÑÉ¥¹¹ÔÌÐì) ½¹Í½±]ɥѡ}MÑÉ¥¹IÁÐ ÅÕ½ÐíQÍÐÅÕ½Ðì°Ô¤µÀì1¤) ½¹Í½±]ɥѡ}MÑÉ¥¹IÁÐ ÅÕ½ÐíQÍÐÅÕ½Ðì°ÅÕ½ÐìÔÅÕ½Ð줵Àì1¤ Since omg() returns nothing as danwilli said, what exactly got repeated once? Did you mean _StringRepeat() to actually run the omg() funtion repeatedly (it doesn't do that). Edited January 2, 2008 by PsaltyDS 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 Link to comment Share on other sites More sharing options...
rec0il Posted January 2, 2008 Author Share Posted January 2, 2008 An Input control returns a string vice a number. Try this: $powt = _StringRepeat (omg(), Number(GuiCtrlRead($Input2))) Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 2, 2008 Share Posted January 2, 2008 Did you see the edit at the bottom of my post? The _StringRepeat() will not call omg() more than once to get the string to be repeated. Use a For/Next loop if you need to repeat the function. 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 Link to comment Share on other sites More sharing options...
rec0il Posted January 2, 2008 Author Share Posted January 2, 2008 Now i see i try For/Next and this too not work. WinActivate ("AutoIt Help") For $s = 5 to 1 Step -1 Func omg() If WinActive ("AutoIt Help") Then Sleep (1000) Send ("{enter}") Send (GuiCtrlRead($Input1)) Send ("{enter}") Sleep (2000) EndIf EndFunc Next ToolTip ("End",0,0)oÝ÷ Ú+kÊ«¨´Û¦mêƺ ®T^iÝ7èéºÝªºZÛh¢z-Âä6"±çÚòÿ5ìmjwm+-¢è· +«¢+Ø]¥¹Ñ¥ÙÑ ÅÕ½ÐíÕѽ%Ð!±ÀÅÕ½Ðì¤($$%½ÈÀÌØíÌô9յȡե ÑɱI ÀÌØí%¹ÁÕÐȤ¤¤Ñ¼ÄMÑÀ´Ä(Õ¹½µ ¤(%]¥¹Ñ¥Ù ÅÕ½ÐíÕѽ%Ð!±ÀÅÕ½Ðì¤Q¡¸(M±À ÄÀÀÀ¤(M¹ ÅÕ½Ðíí¹ÑÉôÅÕ½Ðì¤(M¹¡Õ¥ ÑɱI ÀÌØí%¹ÁÕÐĤ¤(M¹ ÅÕ½Ðíí¹ÑÉôÅÕ½Ðì¤(M±À ÈÀÀÀ¤(¹%(¹Õ¹($$%9áÐ($$%Q½½±Q¥À ÅÕ½Ðí¹ÅÕ½Ðì°À°À Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 2, 2008 Share Posted January 2, 2008 Now i see Only loop the function call, not the declaration: For $n = 1 To 5 omg() 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 Link to comment Share on other sites More sharing options...
DW1 Posted January 2, 2008 Share Posted January 2, 2008 Are you looking to repeat the function X times like this? WinActivate("AutoIt Help") For $s = Number(GUICtrlRead($Input2))) To 1 Step - 1 omg() Next Func omg () If WinActive("AutoIt Help") Then Sleep(1000) Send("{enter}") Send(GUICtrlRead($Input1)) Send("{enter}") Sleep(2000) EndIf EndFunc ;==>omg Next ToolTip("End", 0, 0) You don't want to declare the function in a Next loop like you were. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
DW1 Posted January 2, 2008 Share Posted January 2, 2008 Damn aquatic, flightless birds keep beating me to the punch. LOL AutoIt3 Online Help Link to comment Share on other sites More sharing options...
rec0il Posted January 2, 2008 Author Share Posted January 2, 2008 (edited) ok, now work thx btw: this is my first script Edited January 2, 2008 by rec0il Link to comment Share on other sites More sharing options...
DW1 Posted January 2, 2008 Share Posted January 2, 2008 We all started somewhere. You are doing well Keep up the good autoit AutoIt3 Online Help Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 2, 2008 Share Posted January 2, 2008 Damn aquatic, flightless birds keep beating me to the punch. LOLHas Paulie been picking on you again? 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 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