Sign in to follow this  
Followers 0
JennMaughan

Every 8th time

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



That's definitely new to me.  Thank you!

 

Share this post


Link to post
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

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

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