Jump to content
Macro Express Forums

terrypin

Members
  • Posts

    2,230
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by terrypin

  1. 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
  2. "...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
  3. @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.
  4. 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!
  5. Is there a particular reason you want to use Snipping Tool rather than its replacement a year or so ago by Snip & Sketch? I tried both and found the update superior in all respects. Here's a comparison: https://www.guidingtech.com/snipping-tool-vs-snip-sketch-difference/ Did you also see the 18th April post about this topic? If you do explicitly want the outdated tool, this is the target: C:\Windows\System32\SnippingTool.exe Terry, UK
  6. Did you try my suggestion about your Delay commands? Try adding a Wait for Window Title afer activating Act! Try adding a 0.1 s delay after typing <Alt + I>. Try using Waits for Text Playback after the TextType. Try using mouse move and click commands. Is it only <Alt + I> that fails? Best to confine all subsequent example macros to this single issue, as you’ve just done in your lat post.
  7. Did you try the suggestion from Samrae to use <ALTD>i<ALTU>? i would also use the regular Delay command. I agree about not getting into Controls at this stage of your experience. To narrow the diagnostic focus, have you tried a simple local macro, not remote, using that keystroke successfully?
  8. You don't need a macro to launch Snip & Sketch. The KB shortcut Win + Shift + S opens it directly and displays four options for selecting your screenshot.
  9. You normally RIGHT click a tray icon to access its options. Does that not happen with Avast?
  10. I've corrected a careless mistake and the edited macro now works consistently here. Terry, East Grinstead, UK
  11. I think I see what’s wrong and I’ll fix when I get back to my PC in the morning. Terry 23:45 UK time, from my iPad.
  12. Here's one way to do it: EDITED // Two cols of info, User ID and Name, separated by a tab, are stored in G:\Traffic\IBS\Other\id.txt. This macro prompts for a user id. If it is found it displays the name. Otherwise it displays an appropriate message and ends the macro. // I've defined Use ID as a string variable. That not only allows future flexibility but simplifies the script. And unless you intend to do arithmetic on the User ID it's unnecessary to set it as an integer. // Note: I prefix my string variables with 't' (for 'text'), and integer variables with 'n' (for 'number'). Variable Set String %tUser%: Prompt ASCII File Begin Process: "G:\Traffic\IBS\Other\id.txt" (Tab Delimited Text (.txt)) If Variable %tUser% Equals "%tLine[1]%" // This is a match. Text Box Display: User %tUser% is: Variable Set String %tResult% to "Matched" Macro Stop End If ASCII File End Process If Variable %tResult% Does not Equal "Matched" // There was no match Text Box Display: User %tUser% is: End If CODE: <COMMENT Value="Two cols of info, User ID and Name, separated by a tab, are stored in G:\\Traffic\\IBS\\Other\\id.txt.\r\nThis macro prompts for a user id. If it is found it displays the name. Otherwise it displays an appropriate message and ends the macro."/> <COMMENT Value="I've defined Use ID as a string variable. That not only allows future flexibility but simplifies the script. And unless you intend to do arithmetic on the User ID it's unnecessary to set it as an integer."/> <COMMENT Value="Note: I prefix my string variables with 't' (for 'text'), and integer variables with 'n' (for 'number')."/> <COMMENT/> <VARIABLE SET STRING Option="\x01" Destination="%tUser%" Prompt="Enter the target User ID." Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/> <ASCII FILE BEGIN PROCESS Filename="G:\\Traffic\\IBS\\Other\\id.txt" Format="Tab" Start_Record="1" Process_All="TRUE" Records="1" Variable="%tLine%" Start_Index="1" Parse_Blank_Lines="FALSE" Clear_Array="TRUE"/> <IF VARIABLE Variable="%tUser%" Condition="\x00" Value="%tLine[1]%" IgnoreCase="FALSE" _COMMENT="This is a match."/> <TEXT BOX DISPLAY Title="User %tUser% is:" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 %tLine[2]%\\f1 \r\n\\par }\r\n" Left="689" Top="334" Width="378" Height="138" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <VARIABLE SET STRING Option="\x00" Destination="%tResult%" Value="Matched" NoEmbeddedVars="FALSE"/> <MACRO STOP/> <END IF/> <ASCII FILE END PROCESS/> <IF VARIABLE Variable="%tResult%" Condition="\x01" Value="Matched" IgnoreCase="FALSE" _COMMENT="There was no match"/> <TEXT BOX DISPLAY Title="User %tUser% is:" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 Not on record.\\f1 \r\n\\par }\r\n" Left="689" Top="334" Width="378" Height="138" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END IF/> Terry, UK MacromanDemo-Edited.mex
  13. Thanks for the further details. Yes, I would use ASCll File Begin Process. Personally I would separate the two cols with a tab, to minimise any ambiguity with the Name (which contains a comma). Seeing the variable 'V1' I assume you are using ME Pro? If so I suggest you name your variables meaningfully, especially when arrays are involved. Note that your macro will fail because N2 is an integer but V1 is a string. You'd have to convert N2 first, using Variable Modify Intger > Convert to Text String. I'll suggest a macro shortly. Terry, East Grinstead, UK
  14. Are these two files TXT as your first post seems to indicate, or CSV as per your last post? Please post the full macro you have so far and its code, not just the command text. It would also be helpful to post both files, suitably edited if confidential. Are you using ME3 or ME Pro? As usual, the devil is in the details.
  15. Thanks Alan, I'll explore that interesting approach. Do you think can it be applied in the example under discussion?
  16. "I don't understand why you don't use the MEP file manipulation commands." I'm not sure I've understood. Apart from If File Exists, which I mentioned, what other 'file manipulation commands' do you suggest to handle file saving when OS messages are displayed as in my example? Or maybe you're referring to the simple way I've handled the file processing in that? IOW, are you instead recommending a Repeat with Folder to build a variable holding all files? If so, I agree, and if this was a larger project with many more files involved that's probably how I'd do it. But this was just a simplified example to focus on the subject issue. "I'd never type in file names..." Do you mean you don't use string variables to enter data as in my example? What advantage would using Controls offer? Wouldn't that involve more steps, and the same variable? "When I things that could have a popup error I use the existence of the controls." How would you do that for my example? What would be the target of the Get Control command, for instance?
  17. When running macros that save files they frequently fail because messages from the OS do not automatically pause the macro to allow user interaction before proceeding. A typical example: // Now re-open the file in F2 mode and enter the new name Text Type (Simulate Keystrokes): <F2> Delay: 0.1 seconds Text Type (Simulate Keystrokes): %tFilename% Delay: 0.1 seconds Text Type (Simulate Keystrokes): <ENTER> Delay: 0.1 seconds Text Type (Simulate Keystrokes): <ARROW DOWN> Delay: 0.1 seconds End Repeat After the ENTER command I might briefly see a message like "A file of this name already exists..." and be asked to choose a Yes or No option (e.g. to save with a suffixed name), but the macro continues regardless. Sometimes the fix is easy; for example when the message is asking whether to overwrite the previous file I can often safely insert a Text Type Y command. Or I can use If Window, specify 'Replace File', and add an appropriate action, such as a simple Pause. Or sometimes an If File Exists command is possible. But sometimes it's not so easy. What techniques do others use please? Terry, UK
  18. Let's see if a few others from various countries can join the discussion! I'm guessing it's a Windows OS setting?
  19. Yes. That's what prompted my surprise that our respective MEP versions are apparently 'localised'.
  20. Hi Alan, This command caused failure for me: Wait for Window Title: Color That has me fascinated, especially as I see that you personally spell 'colour' the same as I do! Is your version of MEP indeed AmericaniZed in that way? Using 6.1.3.1 here, and your macro works fine when I use the correct spelling 🙂 Terry
  21. Your original screenshot shows that your 1920 x 1080 screen was on that occasion not occupied by your maximised program. So that's a possible cause of earlier confusion about your Mouse Locator readings.
  22. Didn't get a reply to my Friday post. Is your problem now resolved?
  23. Yes, that's easy enough. Exploring MEP's excellent Help you'll soon find several ways to do it. If you run into difficulty post again, but then please clarify what you are (always) doing at the point you will activate the macro. Looking at the HTML? In what application (browser, text editor, HTML app, etc)? Or with the file selected in its File Explorer folder? The same folder for every file, or varying folders? Also, as your comment suggests you may have many of these to process, think about using Repeat with Folder to convert all target files automatically. That's easy too but, although it might be fun for a while, it will slow down completion enormously.
×
×
  • Create New...