Jump to content
Macro Express Forums

terrypin

Members
  • Content count

    1,787
  • Joined

  • Last visited

  • Days Won

    11

terrypin last won the day on May 15 2017

terrypin had the most liked content!

Community Reputation

2 Neutral

1 Follower

About terrypin

  • Rank
    Master

Recent Profile Visitors

496 profile views
  1. terrypin

    Summing a converging series

    Returning to the original subject, my macro for summing the series turned out to run much faster than I expected. For X = 1, which should give a result of 45 degrees, even ten thousand terms barely took one second . Its convergence is unacceptably slow though., so you'd never use it to actually calculate arctan(x). Terms Result Duration (secs) ----- ------- -------------- 100 44.8568 1,000 44.9857 5,000 44.9971 10,000 44.9986 10,001 45.0014 ~ 1.0 20,001 45.0007 ~ 1.2 50,001 45.0003 ~ 3 Here's the macro, code and upload. For my tests I disabled the user prompts. // Set decimal value = dX and number of terms = nTerms // Either by user prompting... Variable Set Decimal %dX%: Prompt Variable Set Integer %nTerms%: Prompt // Or by hard coded values Variable Set Decimal %dX% to 1 Variable Set Integer %nTerms% to 10001 Variable Set Integer %nSign% to -1 Repeat Start (Repeat %nTerms% times) Variable Modify Integer: %nExp% = 2 * %nT% Variable Modify Integer %nExp%: Decrement Extended Math %dResult%=%dX%^%nExp% Variable Modify Decimal: %dResult% = %dResult% / %nExp% Variable Modify Integer: %nSign% = -1 * %nSign% Variable Modify Decimal: %dResult% = %dResult% * %nSign% Variable Modify Decimal: %dResult% = %dResult% / 3.14159265358979323846264338328 Variable Modify Decimal: %dResult% = %dResult% * 180 Variable Modify Decimal: %dTotal% = %dResult% + %dTotal% End Repeat Text Box Display: Result of %nTerms% terms <COMMENT Value="Set decimal value = dX and number of terms = nTerms"/> <COMMENT Value="Either by user prompting..."/> <VARIABLE SET DECIMAL Option="\x01" Destination="%dX%" Prompt="Enter X" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0" _ENABLED="FALSE"/> <VARIABLE SET INTEGER Option="\x01" Destination="%nTerms%" Prompt="How many terms?" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0" _ENABLED="FALSE"/> <COMMENT Value="Or by hard coded values"/> <VARIABLE SET DECIMAL Option="\x00" Destination="%dX%" Value="1"/> <VARIABLE SET INTEGER Option="\x00" Destination="%nTerms%" Value="10001"/> <VARIABLE SET INTEGER Option="\x00" Destination="%nSign%" Value="-1"/> <REPEAT START Start="1" Step="1" Count="%nTerms%" Save="TRUE" Variable="%nT%"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%nExp%" Value1="2" Value2="%nT%"/> <VARIABLE MODIFY INTEGER Option="\x08" Destination="%nExp%"/> <EXTENDED MATH Option="\x07" Destination="%dResult%" Value1="%dX%" Value2="%nExp%"/> <VARIABLE MODIFY DECIMAL Option="\x03" Destination="%dResult%" Value1="%dResult%" Value2="%nExp%"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%nSign%" Value1="-1" Value2="%nSign%"/> <VARIABLE MODIFY DECIMAL Option="\x02" Destination="%dResult%" Value1="%dResult%" Value2="%nSign%"/> <VARIABLE MODIFY DECIMAL Option="\x03" Destination="%dResult%" Value1="%dResult%" Value2="3.14159265358979323846264338328"/> <VARIABLE MODIFY DECIMAL Option="\x02" Destination="%dResult%" Value1="%dResult%" Value2="180"/> <VARIABLE MODIFY DECIMAL Option="\x00" Destination="%dTotal%" Value1="%dResult%" Value2="%dTotal%"/> <END REPEAT/> <TEXT BOX DISPLAY Title="Result of %nTerms% terms" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 \r\n\\par Sum of %nTerms% terms= \\f1 %dTotal%\\b0 \r\n\\par \\pard \r\n\\par \r\n\\par \r\n\\par }\r\n" Left="728" Top="485" Width="431" Height="144" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> SumSeriesForArctan(X).mex
  2. terrypin

    Summing a converging series

    Brilliant, thanks Cory! At first I tried it with x=1 (the tangent of 45 degrees, or ~ .7854 radians). So I tediously entered the series 1-1/3+1/5-1/7+1/9-1/11+1/13-1/15+1/17-1/19+1/21-1/23+1/25-1/27+1/29-1/31+1/33-1/35+1/37 and got 0.7985. About 1.7% high after 18 terms. But then I realised that http://api.mathjs.org/ supports all the trig functions directly. And I was pleased to find that also includes atan2, which is the ideal function I need. And its result is returned very quickly. @rberg:.I'm sure you're right, but I'd still like to try it! Or a better algorithm/formula if I can find one. It's only a single calculation in a fairly long and partially user interactive macro, for tracing a few straight lines on a map, so a few seconds for each line each would be no problem. But, academic curiosity apart, the only reason for pursuing it instead of simply using the handy web tool above would be to keep everything 'in-house', which I'd find sort of satisfying. Terry, East Grinstead, UK
  3. Any mathematicians around? A macro I wrote needed some trigonometry, so I took the easiest course of an excursion to Excel to use its ATAN2 function. That works fine. But out of curiosity I wondered if I could do it entirely within ME Pro. (The copy/pasting to and from Excel always seems slow.) So i went looking for either a formula or a convergent series delivering a suitable approximation. I failed with ATAN2 but I did find a series for a good second best, arctan (which in Excel is called ATAN): arcatan(x) = x - (x^3)/3 + (x^5)/5 - (x^7)/7... etc where x<1 It's slow to converge but that shouldn't be a problem with enough terms, I thought. But after some hours I gave up trying to implement it. Reckon I could have done it 40 years ago with BASIC or FORTRAN, but Repeats within Repeats in ME Pro (which was my approach) never fail to bring on a headache! It's a long shot, but anyone ever written a similar macro they can share please? Terry, East Grinstead, UK
  4. terrypin

    different loops in one macro

    "...both [macros] should start at the same time but different running times" "...after Macro 1 i Need a waiting time of 5mins" Those seem contradictory? I don't follow your description, but my interpretation is that you want to start a macro called Macro X and when it has finished its task some unspecified time later you want to wait several minutes and then start Macro Y. And so on. So in the main macro you would have commands like these Macro Run: Macro X Delay: 420 seconds // Delay of 7 minutes Macro Run: Macro Y etc Re your last question, in my post I said: "... and disable the option Wait for this macro to terminate before proceeding. " BTW, I'm curious why you've inserted half second delays between mouse clicks? I'd suggest that to develop your understanding you experiment with these three commands: Macro Run, Delay and Text Box Display and in each case use F1 and study the options.
  5. terrypin

    Copy macro and its activation

    Thanks Cory, I'm sure you're right although so far I haven't found the right solution, despite a fair amount of searching. I overcame my antipathy to Apple stuff some years ago. (A gift from my son was a factor!) Although I still resent the file inaccessibility and proprietary aspects I'm now committed to my iPhone and iPad for mobile use. I have iOS Calendar and Reminders on my PC and they sync to some extent. But I've been consistently unable to get a reminder or calendar event to pop-up its message (even silently) on my PC when due. Hence my exploration of a DIY approach with MEP.
  6. terrypin

    Copy macro and its activation

    Agreed, it’s very clever. But what about the PC? I want to be able to enter a reminder in iPhone, iPad or PC and have it work on all three computers. So if say I’m absorbed in writing a macro or editing a video on my PC, I’ll always get an audio and text reminder. Or if I enter it on my PC and I’m out with my iPhone, ditto.
  7. terrypin

    Copy macro and its activation

    Hi Alan, Thanks, yes, I was thinking of perhaps just automating the export and import approach. But I'll first try directly manipulating the MEP UI and see what snags arise. I already have quite a few entries in the 'Macro Express' category although maybe only 20% of them get used regularly. In fact on checking just now there are a few I'd forgotten I'd written! Drifting OT, I'd abandon this project altogether if anyone can recommend a 100% reliable alarm app for the PC that's a no-brainer to use. And if it could sync to the iOS Calendar and/or Reminder app on my iPhone and Pad that would be brilliant. In theory, the iOS app on the PC is supposed to sync, but I've never succeeded in getting it to do so.
  8. terrypin

    different loops in one macro

    Hi, In the main macro try using the Macro Run command to start the two macros and disable the option Wait for this macro to terminate before proceeding. Macro Run: Macro X Macro Run: Macro Y <MACRO RUN Use_ID="FALSE" Name="Macro X" ID="-1" Wait="FALSE"/> <MACRO RUN Use_ID="FALSE" Name="Macro Y" ID="-1" Wait="TRUE"/> That worked OK when I tested it with two macros that simply displayed messages of different durations. But I haven't had time to test how the mouse cursor gets on with being in two places at once. 😉
  9. I'm experimenting with MEP as a simple alarm tool. So I'd like to be able to quickly copy an existing scheduled macro (basically a template) and merely change its text message and initial start time. Copy Macro... doesn't offer an option to copy the activation. That would be handy for a scheduled macro as there are several configuring steps that I want to remain constant. Anyone know a quicker approach than my current method, which does copy the activation, namely exporting the original aa an MEX and re-importing it?
  10. terrypin

    Conflicts with Google Earth?

    I think I’ve narrowed it to one rather complex macro, which operates on either a JPG in File Explorer or open in IrfanView. It uses EXIF data in the JPG to add a placemark at the photo’s location, place it in a folder in My Places, and sort it. But it’s been working sweetly for months and I’ve not changed it.
  11. Anyone getting crashes when running macros in GE? Seems to be happening since latest Win 10 update of version 1709 to build 16299.431.
  12. terrypin

    HEX Variables

    Hadn't seen this until today, but if you're still around you might try this alternative for fun. Works OK here on first couple of tests. Web Site, "https://www.browserling.com/tools/random-hex", using Default Web Browser Delay: 1 seconds // Using a Repeat allows easier trial/error via the included Delay. Repeat Start (Repeat 11 times) // Tab to 'How many digits?' Text Type (Simulate Keystrokes): <TAB> Delay: 0.1 seconds End Repeat Delay: 1 seconds // Trial/error! Text Type (Simulate Keystrokes): 2 // Specify two digits. Delay: 0.2 seconds Text Type (Simulate Keystrokes): <TAB> // Tab to 'How many results?' Delay: 0.1 seconds Text Type (Simulate Keystrokes): 1 // Only a single result wanted Delay: 0.1 seconds Text Type (Simulate Keystrokes): <TAB> // Tab to 'Generate' Delay: 0.1 seconds Text Type (Simulate Keystrokes): <ENTER> // Apply Delay: 0.1 seconds Text Type (Simulate Keystrokes): <SHIFT><TAB><SHIFT><TAB><SHIFT><TAB> // Tab back to the line under the result Delay: 0.1 seconds Text Type (Simulate Keystrokes): <BACKSPACE><SHIFT><HOME> // Select the result Delay: 0.1 seconds Clipboard Copy Delay: 0.2 seconds Variable Set String %tResult% from the clipboard contents Variable Modify String: Replace "%tResult%" in %tResult% with "0x%tResult%" Text Box Display: Result <WEB SITE URL="https://www.browserling.com/tools/random-hex" Wait="FALSE" Default_Browser="TRUE" NoEmbeddedVars="FALSE" _IGNORE="0x000C"/> <DELAY Flags="\x01" Time="1"/> <COMMENT Value="Using a Repeat allows easier trial/error via the included Delay."/> <REPEAT START Start="1" Step="1" Count="11" Save="FALSE" _COMMENT="Tab to 'How many digits?'"/> <TEXT TYPE Action="0" Text="<TAB>"/> <DELAY Flags="\x01" Time="0.1"/> <END REPEAT/> <DELAY Flags="\x01" Time="1" _COMMENT="Trial/error!"/> <TEXT TYPE Action="0" Text="2" _COMMENT="Specify two digits."/> <DELAY Flags="\x01" Time="0.2"/> <TEXT TYPE Action="0" Text="<TAB>" _COMMENT="Tab to 'How many results?'"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="1" _COMMENT="Only a single result wanted"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<TAB>" _COMMENT="Tab to 'Generate'"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="Apply"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<SHIFT><TAB><SHIFT><TAB><SHIFT><TAB>" _COMMENT="Tab back to the line under the result"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<BACKSPACE><SHIFT><HOME>" _COMMENT="Select the result"/> <DELAY Flags="\x01" Time="0.1"/> <CLIPBOARD COPY/> <DELAY Flags="\x01" Time="0.2"/> <VARIABLE SET STRING Option="\x02" Destination="%tResult%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%tResult%" ToReplace="%tResult%" ReplaceWith="0x%tResult%" All="FALSE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 tResult = %tResult%\r\n\\par \\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> RandomHex-ViaWeb.mex
  13. terrypin

    View-Source trick in Chrome and FireFox

    Thanks for sharing that, Cory. Works also in Waterfox (to which I've just switched from Firefox 56). Duly filed for possible use when simple simulation on the normal page with KB and mouse fails or proves unreliable.
  14. terrypin

    MEP toolbar problem

    Excellent, thanks, never saw that Restore Toolbars entry before! A Help search on either 'restore' or 'toolbars' delivers nothing about it. In view of your last paragraph I've decided to resist the temptation to try it, in case it produces the result you recall! I have them the way I want right now, which I've always assumed is the default. If that ever gets corrupted again I'll then try either the built-in method, or by restoring the reg file I made based on my Sunday post. Or if someone comes up with a simple sequence of moves that's less complicated than solving the Rubik's Cube, I'll use that.
×