Jump to content

Every 8th time


Recommended Posts

I'm using a script that uses a count and reads questions out of excel.  How do I tell it to perform a task every multiple of 8... .. I imagine this is an If statement... of   If $Count = ......  (fill in the blank..This is where my mind is filling in the blank.. )    I don't know how to list "multiples of 8"  

 

What I'm wanting it to do is on every 8th question they go through to bring up an actual test question.  I'm Using an excel array to pull the question and answers.

Edited by JennMaughan
spelling
Link to comment
Share on other sites

Will the above script work with the structure I already have in place?   Guess I could embed a While within the Overall While that I already have going on.

 

 

Count $i = 0

Gets array...

 

While.... $i < 300

Some variable  = [$i][0]   .... Displays reading material specifically for question

Some second variable = [$i][1] .... Displays second material they read

Practice question goes here.     Most questions will be from one source.. but every 8th draws from different area.

 

Finishes...... with other things

$i += 1

WEnd

 

Link to comment
Share on other sites

The first is a normal For ... Next Loop looping in a step of 8 thrue the loop. In second i test with Mod($i,8) is the rest of division = 0 and if not do the console write. Same checkresult with other funcs:

$i=0
while $i<801
    if ($i/8) = Int($i/8) Then ConsoleWrite('Int '&$i&@CRLF)
    $i+=1
WEnd

    or

$i=0
while $i<801
    if $i-Int($i/8)*8=0 Then ConsoleWrite('Int2 '&$i&@CRLF)
    $i+=1
WEnd

the first posted one (mod) should be the fastet.

Link to comment
Share on other sites

  • 2 weeks later...

This has been going fairly well for class and helping students prep for tests.   What I need to incorporate now is the ability for students to press a hotkey and have it run a different script saved on the computer.   I know how to set up hotkeys but I don't know the commands for playing another autoit script.

Link to comment
Share on other sites

Use Run/RunWait/ShellExecute/ShellExecuteWait to either directly run a script compiled to an exe file, or to run a command like "autoit3.exe myscript.au3".

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...