Sign in to follow this  
Followers 0
darkshark

Math Worksheet Generator

6 posts in this topic

#1 ·  Posted (edited)

Hi, everybody!

i'm trying to make a math worksheet generator for kids, but i need it in this format:

formula.jpg

formula_2.jpg

formula_3.jpg

and generate a PDF file with the math problems....

i know how to generate a problems, but idk how to 'format' this

anyone have a ideia how to make this?

 

Thanks a lot.

 

p.s: Here is my sum generator code:

Func _Sum_Generator($iMin, $iMax, $iProblems = 100, $iMaxAddends = 2, $bRandomAddends = True, $bUseDecimal = False, $bUseNegative = False)
    Local $aGenerated[$iProblems][2]

    If $iMaxAddends < 2 Then $iMaxAddends = 2

    For $i = 0 To $iProblems -1
        $aGenerated[$i][1] = 0
        $iAddends = $iMaxAddends -1

        If ($bRandomAddends And $iMaxAddends > 2) Then $iAddends = Random(2, $iMaxAddends, 1) -1

        For $j = 0 To $iAddends
            Local $iOnlyInt = 1, $Negative = 0
            If $bUseDecimal Then $iOnlyInt = Random(0,1,1)
            If $bUseNegative Then $Negative = Random(0,1,1)
            Local $iRandom =  Round(Random($iMin, $iMax, $iOnlyInt), 2)
            If $Negative Then $iRandom *= -1

            If $j = $iAddends Then
                $aGenerated[$i][0] &=  String($iRandom) & " = "
            Else
                $aGenerated[$i][0] &=  String($iRandom) & " + "
            EndIf
            $aGenerated[$i][1] += $iRandom
        Next

    Next

    Return $aGenerated
EndFunc
Edited by darkshark

Share this post


Link to post
Share on other sites



Why not look at the built in Word features in the help file? Word allows you numerous formatting styles, almost all of which you can control via your script. Then when you're done, you can use the Office engine to save as a PDF (or print to PDF if you have a PDF printer installed).


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I tried to use what you recommended but idk how to add a equation in word using autoit...

=/

Share this post


Link to post
Share on other sites

thanks a lot

i will see that!

Share this post


Link to post
Share on other sites

Here is an example that I got to work:

#include <Word.au3>

$oWord=_Word_Create ( )
_Word_DocAdd($oWord)

Dim $objRange; As Range
Dim $objEq; As OMath

$objRange = $oWord.Selection.Range
$objRange.Text = "Celsius = (5/9)(Fahrenheit – 32)"
$objRange = $oWord.Selection.OMaths.Add($objRange)
$objEq = $objRange.OMaths(1)
$objEq.BuildUp

I adopted it from this page.  It is a very cool interface - I did not realize you could do that.


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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

  • Similar Content

    • jrsofsd
      By jrsofsd
      RunningStats calculates running (moving) statistics: Standard Deviation, Variance, and Mean . The single function _RunningStats(), queries, clears, restores, or adds to the running statistics.
      Example.au3 adds 7 samples of data to running statistics and displays the results using _ArrayDisplay().
      Example-Persistent-Storage.au3 adds the first 6 samples to the running statistics and stores the results in an INI file. The data is read from the INI file and restored to the running statistics. The 7th sample is added and the results displayed, matching the results from Example.au3.
      Credits: John D. Cook for his article "Accurately computing running variance" at http://www.johndcook.com/blog/standard_deviation/
      RunningStats.zip
    • scintilla4evr
      By scintilla4evr
      I started writing this UDF a while ago, so I decided to share it here.
      This is an UDF full of advanced mathematical functions. It allows to work with primes, create number sequences, interpolate, calculate values of functions like Riemann zeta.
      Full list of functions:
       
      Changelog:
      Download
    • Katie_Deely
      By Katie_Deely
      Hey there
      I'm thinking about making a program that will calculate with huge numbers. Well above 1*10^18 probably. Can autoit deal with that? If not, how can I make it work?
      Thanks!
    • rm4453
      By rm4453
      I keep getting error : Statement cannot be just an expression.
      Here are the 3 error variations it gives:
      Global $ImageCount += 1
      ~~~~~~~~~~~~~~~~~~~~~^
      Global $ImageCount += 1
      ~~~~~~~~~~~~~~~~~~~~^
      Global $ImageCount +=
      ~~~~~~~~~~~~~~~~~~~^
      Here is the code:
      Case $Image1 ;GUICtrlSetState($Image1, 4+128) GUICtrlSetState($Image2, 64) $Image1_done = 1 OpenImages() Global $Image1_added = $imagePath ;MsgBox("Info", "Image 1 Path", $Image1_added) OpenEditBox() Global $Image1_Description = $editBox_save If $im1 = 0 Then Global $ImageCount += 1 $im1 = 1 EndIf Case $Image2 If $Image1_done = 1 Then ;GUICtrlSetState($Image2, 4+128) GUICtrlSetState($Image3, 64) OpenImages() Global $Image2_added = $imagePath ;MsgBox("Info", "Image 2 Path", $Image2_added) OpenEditBox() Global $Image2_Description = $editBox_save $Image2_done = 1 If $im2 = 0 Then Global $ImageCount += 1 $im2 = 1 EndIf Else EndIf Case $Image3 If $Image2_done = 1 Then ;GUICtrlSetState($Image3, 4+128) GUICtrlSetState($Image4, 64) OpenImages() Global $Image3_added = $imagePath ;MsgBox("Info", "Image 3 Path", $Image3_added) OpenEditBox() Global $Image3_Description = $editBox_save $Image3_done = 1 If $im3 = 0 Then Global $ImageCount += 1 $im3 = 1 EndIf Else EndIf Case $Image4 If $Image3_done = 1 Then ;GUICtrlSetState($Image4, 4+128) GUICtrlSetState($Image5, 64) OpenImages() Global $Image4_added = $imagePath ;MsgBox("Info", "Image 4 Path", $Image4_added) OpenEditBox() Global $Image4_Description = $editBox_save $Image4_done = 1 If $im4 = 0 Then Global $ImageCount += 1 $im4 = 1 EndIf Else EndIf Case $Image5 If $Image4_done = 1 Then ;GUICtrlSetState($Image5, 4+128) GUICtrlSetState($Image6, 64) OpenImages() Global $Image5_added = $imagePath ;MsgBox("Info", "Image 5 Path", $Image5_added) OpenEditBox() Global $Image5_Description = $editBox_save $Image5_done = 1 If $im5 = 0 Then Global $ImageCount += 1 $im5 = 1 EndIf Else EndIf Case $Image6 If $Image1_done = 1 Then ;GUICtrlSetState($Image6, 4+128) OpenImages() Global $Image6_added = $imagePath ;MsgBox("Info", "Image 6 Path", $Image6_added) OpenEditBox() Global $Image6_Description = $editBox_save If $im6 = 0 Then Global $ImageCount += 1 $im6 = 1 EndIf Else EndIf  
    • K3STROS
      By K3STROS
      What i have done is set Coordinates in xyBox1, xyBox2 and xyBox5 (with MouseGetPos() - The rest of my code works 100%)
      And instead of going out every time and entering every single box coordinate i figured i would come up with this "Formula" to calculate all the boxes locations by itself from what i have entered for my 3 Variables
      Everytime i run, it clicks on box 1, 2, 5, 6 and the crashes, skips box 3 and 4
      Any Clue?
      Func FourxSeven() ; 0 Returns the X1 co-ordinate as an integer. ; 1 Returns the Y1 co-ordinate as an integer. Local $xSD = ($xyBox1[1] - $xyBox2[1]) ; (Box1 y - Box2 y) = xAxis - Sideways difference Local $yDD = ($xyBox1[0] - $xyBox5[0]) ; (Box1 x - Box5 x) = yAxis - Downwards Difference MouseClick("Left", $xyBox1[0], $xyBox1[1]) ;#1 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox2[0], $xyBox1[1]) ;#2 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + $xSD), $xyBox1[1]) ;#3 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + ($xSD * 2)), $xyBox1[1]) ;#4 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox1[0], $xyBox5[1]) ;#5 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox2[0], $xyBox5[1]) ;#6 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + $xSD)[0], $xyBox5[1]) ;#7 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + ($xSD * 2))[0], $xyBox5[1]) ;#8 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox1[0], ($xyBox5[1] + $yDD)[1]) ;#9 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox2[0], ($xyBox5[1] + $yDD))[1]) ;#10 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + $xSD)[0], ($xyBox5[1] + $yDD)[1]) ;#11 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + ($xSD * 2))[0], ($xyBox5[1] + $yDD)[1]) ;#12 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox1[0], ($xyBox5[1] + ($yDD * 2))[1]) ;#13 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox2[0], ($xyBox5[1] + ($yDD * 2))[1]) ;#14 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + $xSD)[0], ($xyBox5[1] + ($yDD * 2))[1]) ;#15 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + ($xSD * 2))[0], ($xyBox5[1] + ($yDD * 2))[1]) ;#16 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox1[0], ($xyBox5[1] + ($yDD * 3))[1]) ;#17 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox2[0], ($xyBox5[1] + ($yDD * 3))[1]) ;#18 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + $xSD)[0], ($xyBox5[1] + ($yDD * 3))[1]) ;#19 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + ($xSD * 2)[0], ($xyBox5[1] + ($yDD * 3))[1]) ;#20 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox1[0], ($xyBox5[1] + ($yDD * 4))[1]) ;#21 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox2[0], ($xyBox5[1] + ($yDD * 4))[1]) ;#22 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + $xSD)[0], ($xyBox5[1] + ($yDD * 4))[1]) ;#23 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + ($xSD * 2)[0], ($xyBox5[1] + ($yDD * 4))[1]) ;#24 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox1[0], ($xyBox5[1] + ($yDD * 5))[1]) ;#25 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", $xyBox2[0], ($xyBox5[1] + ($yDD * 5))[1]) ;#26 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + $xSD)[0], ($xyBox5[1] + ($yDD * 5))[1]) ;#27 Box Locations Sleep(Random(590,1390,1)) MouseClick("Left", ($xyBox2[0] + ($xSD * 2))[0], ($xyBox5[1] + ($yDD * 5))[1]) ;#28 Box Locations Sleep(Random(590,1390,1)) Sleep(Random(990, 1990, 1)) EndFunc