DavidWall Posted December 4, 2005 Report Share Posted December 4, 2005 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 Quote Link to comment Share on other sites More sharing options...
randallc Posted December 4, 2005 Report Share Posted December 4, 2005 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 Quote Link to comment Share on other sites More sharing options...
floyd Posted December 5, 2005 Report Share Posted December 5, 2005 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. Quote Link to comment Share on other sites More sharing options...
kevin Posted December 5, 2005 Report Share Posted December 5, 2005 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'. Quote Link to comment Share on other sites More sharing options...
Cory Posted December 5, 2005 Report Share Posted December 5, 2005 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.... Quote Link to comment Share on other sites More sharing options...
DavidWall Posted December 5, 2005 Author Report Share Posted December 5, 2005 Thanks Guys, Just shows how much I use a calculator - I've never noticed the view button on the calculator & didn't realise it had a scientific mode with a tan function. Ah well - back to the macro code. dave wall Quote Link to comment Share on other sites More sharing options...
DavidWall Posted December 5, 2005 Author Report Share Posted December 5, 2005 Actually - No !! The sample macro for the calculator doesn't work as follows. The specified control, C1, could not be found. The macro will be aborted. dave Quote Link to comment Share on other sites More sharing options...
kevin Posted December 5, 2005 Report Share Posted December 5, 2005 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. Quote Link to comment Share on other sites More sharing options...
randallc Posted December 6, 2005 Report Share Posted December 6, 2005 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, RandallTrigFunctionVBS.mxe Quote Link to comment Share on other sites More sharing options...
randallc Posted December 7, 2005 Report Share Posted December 7, 2005 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 Quote Link to comment Share on other sites More sharing options...
randallc Posted December 7, 2005 Report Share Posted December 7, 2005 Perhaps more useful, "eval" to evaluate a maths line; eg 4*5/sqr(64) Best, randall (Don't forget to download the function macro, 2 posts back,too!) TrigExample2.mxe Quote Link to comment Share on other sites More sharing options...
DavidWall Posted December 9, 2005 Author Report Share Posted December 9, 2005 Thanks randallc, very much appreciated - sorry for delay - was working a few night shifts & had little time to spare thanks again dave wall Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.