Sign in to follow this  
Followers 0
Rigo

Question for Loop !

10 posts in this topic

Hello, I has a problem. I do not come with the loops clearly. I have there this loop

While $i < = 19

$i = $i + 1

turn which I still need now am a 2te variable count up myself whom $i = 19 am. Then that must begin to the 2te variable also 19 again from the front is. How do I have to make that?

Thanks for your assistance.

Share this post


Link to post
Share on other sites



I really don't understand what you are asking here, but if you are looking for a variable to starts at 1 and then loops around till 19, then this is the easiest:

For $x = 1 to 19
  ; do what you need to do
Next

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

some other examples:

$x = 1
Do
  ; ... what you need to do
   $x = $x + 1
Until $x = 19

$x = 1
While Not $x = 19
 ; do what you need to do
  $x = $x + 1
WEnd

Share this post


Link to post
Share on other sites

My problem is.

I have 2 variables.

$i and $f

$i must count up itself to 20 $f with 0 to remain so long.

Whom must that worth 1 $f reached $i 20 get and $i again with 0 begin.

Whom $i again 20 must that $f worth 2 reached receive and again from the front. So long to $f the value 21 has.

Now the loop must be left.

Big thx

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You mean something like this ??

For $f = 0 to 21
   For $i = 0 to 20
    ;do your stuff
   Next 
Next
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I have so up to now.

$i = 0

While $i <= 19

    $i = $i + 1

WinActivate($Namefenster, "")
WinMove($Namefenster, "", 0, 0, 633, 858)
Send("+{TAB}")
Sleep(1000)
Send("{Space}")
Sleep(1000)
Send("+{TAB 2}")

If $i = 1 Then
  
Else
$f = $i - 1
    Send("{DOWN " & $f &"}")
EndIf

Send("+{TAB}")

If $h = 1 Then
  
Else

$g = $h - 1
    Send("{DOWN " & $g &"}")
EndIf

Send("{TAB 2}")
Sleep(1000)
Send("{Space}")
Sleep(1000)
MouseClickDrag("left", $Fensterl1, $Fensterr1, $Fensterl2, $Fensterr2)
MouseMove($Fensterl2, $Fensterr2, 0)

Send("^{c}")
WinActivate("Unbenannt -", "")
Send("^{v}")

WinActivate($Namefenster, "")
Send("{TAB 3}")
Sleep(1000)
Send("{Space}")
Sleep(1000)


WEnd

But does not go correctly.

Thx

Share this post


Link to post
Share on other sites

But does not go correctly.

what doesn't work?

without any winwait your script will keep rolling even if $namefenster doesn't exist or isn't actually active... where does it stop working?


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

No the whole is a Function which I by a Hotkey calls.

The variables are all correct.

That can be done also the script.

Only it does not enumerate correctly.

Thus it makes $i to 19 then whom it $f over one enumerates, there goes then inclined.

Big thx

Share this post


Link to post
Share on other sites

No the whole is a Function which I by a Hotkey calls.

The variables are all correct.

That can be done also the script.

Only it does not enumerate correctly.

Thus it makes $i to 19 then whom it $f over one enumerates, there goes then inclined.

Big thx

if you want :

$I - $F

0 - 0

1 - 0

2 - 0

-----

20 - 0

0 - 1

1 - 1

then have a look at the code i posted and use that to increment the 2 variables...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thx JDEB

This is my Code :

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!s", "Sonnensystem") ;Shift-Alt-s
HotKeySet("+!g", "Schaltflaechen") ;Shift-Alt-g




$Fensterl1 = IniRead("evo.ini", "Changegal", "Fensterl1", "")
$Fensterr1 = IniRead("evo.ini", "Changegal", "Fensterr1", "")
$Fensterl2 = IniRead("evo.ini", "Changegal", "Fensterl2", "")
$Fensterr2 = IniRead("evo.ini", "Changegal", "Fensterr2", "")
$Namefenster = IniRead("evo.ini", "Changegal", "Namefenster", "")



While 1
    Sleep(100)
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func Schaltflaechen()
Sleep(2000)
WinActivate($Namefenster, "")
Sleep(2000)
MsgBox(4096, "Test", $Namefenster, 10)
WinMenuSelectItem($Namefenster, "Links", "&Datei", "Seite ein&richten...")
EndFunc

Func Sonnensystem()

$i = 0

While $i <= 19

    $i = $i + 1

WinActivate($Namefenster, "")
WinMove($Namefenster, "", 0, 0, 633, 858)
Send("+{TAB}")
Sleep(1000)
Send("{Space}")
Sleep(1000)
Send("+{TAB 2}")

If $i = 1 Then
  
Else
$f = $i - 1
    Send("{DOWN " & $f &"}")
EndIf

Send("+{TAB}")

If $h = 1 Then
  
Else

$g = $h - 1
    Send("{DOWN " & $g &"}")
EndIf

Send("{TAB 2}")
Sleep(1000)
Send("{Space}")
Sleep(1000)
MouseClickDrag("left", $Fensterl1, $Fensterr1, $Fensterl2, $Fensterr2)
MouseMove($Fensterl2, $Fensterr2, 0)

Send("^{c}")
WinActivate("Unbenannt -", "")
Send("^{v}")

WinActivate($Namefenster, "")
Send("{TAB 3}")
Sleep(1000)
Send("{Space}")
Sleep(1000)


WEnd


EndFunc

$i

1 - 1

1 - 2

1 - 3

.......

$f

2 - 1

2 - 2

2 - 3

.......

So it is to look.

Thus first the number from $i then of $f.

Big thx

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0