Jump to content
Macro Express Forums

Maths Functions


DavidWall

Recommended Posts

I need to rotate slightly some images - there is a built in function of IrfanView which lets me type in a positive or negative angle to rotate an image.

I can use getmouseposition to work out adjacent and opposite sides of a right angle triangle but then need Tan function to calculate the angle.

I see randallc has made up some wonderful macros for this type of stuff but am totally at a loss as to how to incorporate them into my simple task.

 

heeelllppp !!

 

tia

 

dave wall

Link to comment
Share on other sites

Hi,

Yes, you could (theoretically!) use my "MEBasic [access the example macro lirary mex file from my signature links].

You would need to add all your current macros to that library,and use the syntax as in the "Example" macros in that library ["alt-Shft-A" to run, from memory].

however, if PGMmacro library has that function, it would be more reliable than my home-made MEBasic.

If you don't need all the rest, you are probably better to use Joe's approach to use a vbs script for "tan" and run it.

PM or email me if you really want to go into detail.

Best, Randall

Link to comment
Share on other sites

Welcome David

 

There are no Trig functions in the PGM Functions Library. You can, instead, use the built-in Windows Calculator. Simply create a macro to pass the info back and forth from Macro Express. This can be done using mouse and/or keystrokes along with the clipboard commands or by using Window Control commands.

Link to comment
Share on other sites

Floyd, What a great idea!

 

Dave, There is a sample macro that demonstrates how to create a macro that uses the Windows Calculator program from within a macro. It doesn't use the Tan button but it is a good starting point. The macro file 'Samples.mex' is installed in the same folder as the Macro Express program. By default, c:\Program Files\Macro Express3. Open the Samples.mex macro file and look for the macro 'Calc ulator and Note pad'.

Link to comment
Share on other sites

For more complex mathamatical calculations I will often will pop open Excel. Here I could have a predefined formula for really complex things or I can paste in a formula and get the results. I don't know how else I could do a beta probabliity density but BETADIST works well. Also in excel you can even define your own functions. Also if you gather data from some place and create a tab delimited file you can open that in Excel and use the variaous lookup functions. Excel can be a very useful slave....

Link to comment
Share on other sites

The sample shows how to do it but it will not run 'out of the box' because Windows Controls often vary between different versions of Windows (2003,XP,2000,NT,98,Me,95, NT) or depending on which view is being used in Calculator. If you examine the sample, it will show you how to do it. However, you will need to recapture the controls using your own computer.

Link to comment
Share on other sites

Here is the vbs version; needs only the attached macro to be imported to your library.

// Example of Trig Function Tan (30)

Variable Set String %T11% "Tan"

Variable Set String %T12% "30"

Variable Modify String: Save %T11% to Environment Variable

Variable Modify String: Save %T12% to Environment Variable

Macro Run: TrigFunctionVBS

Text Box Display:

Macro Return

<REM2:Example of Trig Function Tan (30)><TVAR2:11:01:Tan><TVAR2:12:01:30><TMVAR2:19:11:00:000:000:TrigFunc><TMVAR2:19:12:00:000:000:degrees><MACRUN2:TrigFunctionVBS><TBOX4:T:1:CenterCenter000278000200:000:%TrigFunc%(%Degrees%)=%TrigAnswer%><MRETURN>
Best, Randall

TrigFunctionVBS.mxe

Link to comment
Share on other sites

See previous post (first time posted had error; fixed now?...); here is better example; does other math too; [this macro is example to run previous; import both]

// Example of Trig Functions uses vbs ; output as %TrigAnswer% env variavle; AND as %D1%

Repeat Until %T1% <> %T1%

  Variable Set String %T11% "Tan"

  Multiple Choice Menu: Trig Functions for ME3

  Variable Set String %T12% "30"

  Variable Set String %T12% from Prompt

  Variable Modify String: Save %T11% to Environment Variable

  Variable Modify String: Save %T12% to Environment Variable

  Macro Run: TrigFunctionVBS2

  Text Box Display:

Repeat End

Macro Return

Tan

Sin

Cos

Atn

Exp

Hex

Fix

Log

Sqr

Randall

TrigExample.mxe

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...