Jump to content
Macro Express Forums

terrypin

Members
  • Content Count

    2,015
  • Joined

  • Last visited

  • Days Won

    17

terrypin last won the day on May 20

terrypin had the most liked content!

Community Reputation

12 Good

1 Follower

About terrypin

  • Rank
    Master

Profile Information

  • Gender
    Male
  • Location
    East Grinstead, West Sussex, UK

Recent Profile Visitors

909 profile views
  1. Is 1 second long enough to allow a complex app like CASPER to open and stabilise? Try adding a Wait for Window Title.
  2. As for my intended approach, getting the 7-character groups into an array proved easy enough. But my assumption that the subsequent manipulation of these would be easy was over optimistic! Your solution, Alan, incorporating @rberg’s substitution logic looks great to me, well done, and thanks for an interesting thread. (Trivial point: it seems you switched to using A instead of L for alphabetic characters, so your introductory comment needs editing.) But wish I had learnt VBS 😉
  3. @rberg: Neat! Could you post the code so I can explore it further please, as I haven't grasped how it handles an address containing special chars.
  4. Hi Alan, I'm sorely tempted, but that would mean raising the task several places up my To Do list! Another excuse is that because MXPro sadly lacks Regular Expression features I would always tackle this sort of requirement with assistance from another application, usually my text editor, TextPad. Your challenge is akin to asking me to attach a screw without using a screwdriver. And yet another reason is that I expect you already have a brilliant solution 😉 But if curiosity does get the better of me, then I think I might start as follows: // @acantor's challenge to extract a single post code from a line of text. // No external applications are allowed. // Assumption: a reasonable max length of a single address line like the examples provided is 100 characters. Variable Set String %tResult% to "" // Just in case. Variable Set String %tInput%: Prompt // (Disabled for testing) Variable Set String %tInput% to "1234 Chaplin Dr. Twr. 1- 6th floor , Mississauga, ON L4Q 5Z3 Canada" Variable Set Integer %nLength% to the length of variable %tInput% // A line of that length contains (nLength-6) groups of 7 characters. // So my first approach will be to test every group until I find one with the post code format LDL DLD. // The parsing of that should then be straightforward. Terry
  5. Yes, I’ve always had to write my own ‘wait until ready’ code for Firefox and later Waterfox. That failed occasionally and I no longer bother, usually inserting long delays before I attempt manipulation. A command that will work for those and Chrome, Opera, Edge (Microsoft’s replacement for IE) would be handy. I would prefer to see extra web-work functionality within MXPro. But I’m not into web stuff much these days so probably not a typical prospect.
  6. Hi Joe, pleased to hear from you after such a long time. I’m no programmer, but yes I would indeed like to see MXPro offer improved power and flexibility for web stuff, if that’s what you’re asking. A start would be to get a reliable command that would detect when a site is in a ready state to accept further commands. For any browser. Still occasionally dipping into your excellent book - but how about an update for MXPro under Win 10? 🙂 Terry, UK
  7. OK, pleased to see you appear to have now got the hang of it 😉 BTW, I never had an answer my question about the macro I exported? That would have avoided your difficulty with understanding what to paste. (Although it would admittedly have required learning how to import!)
  8. Invest a little time learning some basics, both about ME Pro and using this forum. In particular, learn how to quote messages. With text, using the Quote tool, not screenshots. I’ve no idea what your latest post is meant to show us. Perhaps others with more patience will step in, but as they say on ‘Dragons Den’, I’m out!
  9. I recommend you use ME Pro’s excellent Help to understand this sort of very basic stuff. Here’s an extract: Copy Command Text - (Script Editor Only) Highlight one or more lines of the macro script. Then click on Edit | Copy Command Text. This option copies the lines of script to the Windows clipboard. Paste the script into another application and the contents are displayed shown in the Script Editor. Typically the contents display in a macro format similar to the Direct Editor script when copying the script to the clipboard and pasting. Use the Copy Command Text function to display the contents exactly as they are shown in the Script Editor. Did you also try to import and run the macro?
  10. That’s easy enough: copy the code section (not the command text), open a new empty macro, and paste it in. Or you can just import the finished macro I exported and attached for you, and run that directly.
  11. Hover over each and read what they do: Rectangular, Window, Freeform, and Full Screen. Just the same as using the Mode button in the old Snipping Tool. I assume you are saying you definitely want to remain with the old, unsupported tool called Snipping Tool, so that you can immediately save to a chosen location as before? If so then the following macro works for me: // Open the Start/Search box Text Type (Simulate Keystrokes): <WIND> Delay: 0.1 seconds Text Type (Simulate Keystrokes): <WINU> Delay: 0.1 seconds Text Type (Simulate Keystrokes): Snipping Tool Delay: 0.5 seconds Text Type (Simulate Keystrokes): <ENTER> // This opens the highlighted entry from your Search, which should by default be 'Snipping Tool'. Wait for Window Title: Snipping Tool Text Type (Simulate Keystrokes): <ALT>n // Select 'New' Delay: 0.1 seconds // Now proceed manually as advised, i.e. select and then save your target. <COMMENT Value="Open the Start/Search box"/> <TEXT TYPE Action="0" Text="<WIND>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="<WINU>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT TYPE Action="0" Text="Snipping Tool"/> <DELAY Flags="\x01" Time="0.5"/> <TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="This opens the highlighted entry from your Search, which should by default be 'Snipping Tool'."/> <WAIT FOR WINDOW TITLE Title="Snipping Tool" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<ALT>n" _COMMENT="Select 'New'"/> <DELAY Flags="\x01" Time="0.1"/> <COMMENT Value="Now proceed manually as advised, i.e. select and then save your target."/> Snipping Tool - New File.mex
  12. "...I'm really just a layperson here." Not in my opinion! I'm not a programmer and my experience with Python has been confined to using PaintShop Pro scripts: 95% content from those who DO know the language, plus adaptation/experiment myself. And even that was a few years ago. I reckon that Samrae's suggestions are likely to give you what you need. The registry would be my preference, as I gather there are several relevant Python commands, e.g: https://docs.python.org/3/library/winreg.html#access-rights Alternatively, going the API route, VBA should be the closest match. You might even be able to use one of the conversion tools to change your VBA code to Python. But FWIW the following is an example of the much cruder method I used to exchange variable data between PSP Python and ME Pro. In summary, the MEP macro first runs a submacro ('Script Open') and then runs a specific Python script. Very ponderous. But it worked for me (daunted by Python's learning curve) to automate a score or so of PSP tasks that I couldn't perform reliably and quickly with ME Pro alone. ==================== MACRO: Script run - Elev-GPSU-Miles Delay: 0.1 seconds Macro Run: Script Open Delay: 0.5 seconds Text Type (Use Clipboard and Paste Text): Elev-GPSU-Miles.PspScript // Elevation Edit Delay: 0.5 seconds Variable Modify String %tMiles%: Trim Variable Modify String: Save %tMiles% to the clipboard Delay: 0.5 seconds Text Type (Simulate Keystrokes): <ENTER> // Run that script. Delay: 0.1 seconds -------------------- MACRO: Script Open // Open Scripts folder // Runs from PSP 8, which must be active. Macro Playback Speed: 0.50 times faster than normal Keystroke Speed: 20 milliseconds Text Type (Simulate Keystrokes): <ALT>f Delay: 0.1 seconds Text Type (Simulate Keystrokes): r Delay: 0.1 seconds Text Type (Simulate Keystrokes): <ENTER> Delay: 0.4 seconds Text Type (Simulate Keystrokes): <ALT>n // Cursor to empty name box Delay: 0.2 seconds Text Type (Use Clipboard and Paste Text): C:\Users\terry\My PSP8 Files\Scripts-Trusted\ // Cursor to empty name box Delay: 0.5 seconds Text Type (Simulate Keystrokes): <ENTER> Delay: 0.2 seconds -------------------- PAINTSHOP PRO PYTHON SCRIPT: Elev-GPSU-Miles.PspScript from JascApp import * from Tkinter import Tk def ScriptProperties(): return { 'Author': u'Terry Pinnell', 'Copyright': u'', 'Description': u'', 'Host': u'Paint Shop Pro', 'Host Version': u'8.10' } def Do(Environment): # EnableOptimizedScriptUndo App.Do( Environment, 'EnableOptimizedScriptUndo', { }) # ASSUMES THAT VALUE OF MILES (%tMiles%) IS ON CLIPBOARD # ****************************************************** # Text App.Do( Environment, 'Text', { 'CreateAs': App.Constants.CreateAs.Vector, 'Segments': [{ 'Bold': App.Constants.Boolean.true, 'Fill': { 'Color': (0,0,0), 'Pattern': None, 'Gradient': None, 'Texture': None, 'Identity': u'Material' }, 'Font': u'Arial', 'LineStyle': { 'Name': u'', 'FirstCap': (u'Butt',0.25,0.25), 'LastCap': (u'Butt',0.25,0.25), 'FirstSegCap': (u'',0.25), 'LastSegCap': (u'',0.25), 'UseSegmentCaps': App.Constants.Boolean.false, 'Segments': [] }, 'LineWidth': 0, 'PointSize': 36, 'Start': (1460.5,314.5), 'Stroke': { 'Color': None, 'Pattern': None, 'Gradient': None, 'Texture': None, 'Identity': u'Material' } },{ 'Antialias': App.Constants.Boolean.true, 'WarpText': App.Constants.Boolean.true, 'AutoKern': App.Constants.Boolean.true, 'Bold': App.Constants.Boolean.true, 'Kerning': 0, 'Leading': 0, 'Fill': { 'Color': (0,0,0), 'Pattern': None, 'Gradient': None, 'Texture': None, 'Identity': u'Material' }, 'Font': u'Arial', 'Italic': App.Constants.Boolean.false, 'Join': App.Constants.JointStyle.Miter, 'LineStyle': { 'Name': u'', 'FirstCap': (u'Butt',0.25,0.25), 'LastCap': (u'Butt',0.25,0.25), 'FirstSegCap': (u'',0.25), 'LastSegCap': (u'',0.25), 'UseSegmentCaps': App.Constants.Boolean.false, 'Segments': [] }, 'LineWidth': 0, 'MiterLimit': 10, 'PointSize': 36, 'SetText': App.Constants.Justify.Left, 'Start': (1460.5,314.5), 'Strikethru': App.Constants.Boolean.false, 'Stroke': { 'Color': (255,255,255), 'Pattern': None, 'Gradient': None, 'Texture': None, 'Identity': u'Material' }, 'Underline': App.Constants.Boolean.false },{ 'Characters': getText() }], 'SavedText': None, 'FinalApply': App.Constants.Boolean.false, 'Matrix': None, 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Default, 'AutoActionMode': App.Constants.AutoActionMode.Match } }) # SelectNone App.Do( Environment, 'SelectNone', { 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Default, 'AutoActionMode': App.Constants.AutoActionMode.Match } }) def getText(): r = Tk() text = r.selection_get(selection='CLIPBOARD') r.withdraw() r.update() r.destroy() return text -------------------- Good luck! Terry, UK
  13. @mikecox The easiest way to open Snip & Sketch is to use the keyboard shortcut combination Shift+Win+S. You can then use its four capture tools by clicking the appropriate icon. If you still need help to write a macro then please specify exactly what it should do once Snip & Sketch is open. P.S: After posting a query, in my experience you cannot rely on receiving a 'notification'. Just check back regularly.
  14. Samrae, Thanks, an interesting folder I hadn't come across before. About 6 GB here. But from the first article I read, guess I'll leave it alone!
×
×
  • Create New...