Jump to content
• Sign Up

## Recommended Posts

Hi, everybody!

i'm trying to make a math worksheet generator for kids, but i need it in this format:   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]

If \$iMaxAddends < 2 Then \$iMaxAddends = 2

For \$i = 0 To \$iProblems -1
\$aGenerated[\$i] = 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] &=  String(\$iRandom) & " = "
Else
\$aGenerated[\$i] &=  String(\$iRandom) & " + "
EndIf
\$aGenerated[\$i] += \$iRandom
Next

Next

Return \$aGenerated
EndFunc```
Edited by darkshark

#### Share this 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

##### Share on other sites

I think the math equations are accessible via the oMath interface but I did not see a ton of examples out there on how to use it ...

http://msdn.microsoft.com/en-us/library/office/Microsoft.Office.Interop.Word%28v=office.15%29.aspx

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

#### Share this 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

## 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

• ### Similar Content

• By MrCheese
hi all,
Dumb question, but say I have a loop:
dim \$i Do     sleep(1000)          if \$i = ; how do i do a function that enters this IF statement every 10 loops?         ; do stuff every 10     EndIf      Until \$i = 100
- what commands in the if statement do I need to use to make it pass, and on every 10th loop, it enters the if statement. ?

Thanks
• 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

• 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

• 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!
• 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
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...