Jump to content
Macro Express Forums

terrypin

Members
  • Posts

    2,232
  • Joined

  • Last visited

  • Days Won

    23

Posts posted by terrypin

  1. Quote

    does this only apply to ME Pro?  I'm usnig the regular 5.0

     

    Did you try it?


     

    Quote

    What about the t before FileName?  -  %tFilename%


    You need to read the comments in my original macro more thoroughly.

    // Create a variable with a name of your choice. (Note that I prefix mine with a 't', 'n', etc, to identify the TYPE of variable, but that's a personal preference.)”

     

    Re your latest query, you’re on your own now to apply in Facebook what you’ve learned about setting variables and using Repeats.

  2. An exported macro preserves its variable definitions, which is why you were able to run it as it stood.

     

    But when you are writing a macro - and that includes pasting in code that you've copied from elsewhere, such as from a forum post - then all variables have to be defined. For example, if I paste your code into a fresh macro and just run it with no further attention I get an error:
    "Line 11: Debug Error: Undefined variable or the variable is the wrong type"

    MX Pro offers help in defining variables. When you're writing a command with a variable it will alert you if it's undefined and offer to do so for you. So after pasting a macro you should step through and open each command that includes reference to a variable, to check and get that automatic definition.

     

    As for the percentage signs, that's how MX Pro recognises a string as a variable. You enter the name as normal text and MX Pro enters the % signs.

     

    --------------------

     

    Are you making full use of MX Pro's excellent Help? For example:

     

     

    UsingHelp-Variables.jpg

  3. 13 hours ago, Gerry Peters said:
    I'm trying to use your macro. I created a folder named"1 1 macro express". So I changed your line to read Window Activate: 1 macro express.
    This folder is open in Windows File Explore and  A new empty text file is open in Notepad, 'Untitled - Notepad'
     
    I tried changing this: Variable Set String %tFilename%
    ME didn't like what I put in there, so I  left it the name you have: %tFilename%
     
    When I hit save macro, This window popped up. 
    The variable tFilename is not currently defined. Would you like to create it now? Yes - OK
     
    I saved the macro and ran it and got these results in Notepad
     
    %tFilename%
    %tFilename%
    %tFilename%
    %tFilename%
    %tFilename%
    %tFilename%
    %tFilename%
    %tFilename%
    %tFilename%
    %tFilename%
     
    Here's a pic of my folder
     
     
     

     

    Please reply to my post a minute ago, as the next step.

     

    EDIT:

    Or if you cannot succeed with that macro, let's try some simpler ones.
     
    I've shown the commands and code of the simplest macro as usual. But to demonstrate another way of quickly exchanging macros I've also exported it as the file GerrySimpleDemo-1.mex and attached it below. You can Import that with File > Import > Import Macros... and just run it as it stands.

    Then try adding a Repeat loop so that you successively display say five filenames.

    Then edit it further so that after each display it types them one at a time into Notepad.

    If any of these three do not work as you expect then post again - including the code! - with full details.

     

    Commands

    // This macro will simply ask you to select any file in any folder and then display its name.
    // It assumes you have defined the variable tFilename
    Text Box Display: Initial Instructions
    Text Type (Simulate Keystrokes): <F2> // Switch to Edit mode
    Delay: 0.2 seconds
    Clipboard Copy
    Delay: 0.2 seconds
    Text Type (Simulate Keystrokes): <ESC>
    Delay: 0.1 seconds
    Variable Set String %tFilename% from the clipboard contents
    Delay: 0.1 seconds
    Text Box Display: This should show the filename // Disabled after testing

     

    Code

     

    <COMMENT Value="This macro will simply ask you to select any file in any folder and then display its name."/>
    <COMMENT Value="It assumes you have defined the variable tFilename"/>
    <TEXT BOX DISPLAY Title="Initial Instructions" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 Open any folder and select any file.\r\n\\par \r\n\\par \\ul Then\\ulnone  close this message.\\f1 \r\n\\par }\r\n" Left="Center" Top="485" Width="278" Height="163" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <TEXT TYPE Action="0" Text="<F2>" _COMMENT="Switch to Edit mode"/>
    <DELAY Flags="\x01" Time="0.2"/>
    <CLIPBOARD COPY/>
    <DELAY Flags="\x01" Time="0.2"/>
    <TEXT TYPE Action="0" Text="<ESC>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <VARIABLE SET STRING Option="\x02" Destination="%tFilename%" NoEmbeddedVars="FALSE"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <TEXT BOX DISPLAY Title="This should show the filename" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 tFilename\\f1  = \\f0 %tFilename%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _COMMENT="Disabled after testing"/>

     

    GerrySimpleDemo-1.mex

  4. 10 hours ago, Gerry Peters said:

    I pasted my command text above using  @Samrae method.

     

    I finally found the Code Tool in the "Message Posting box". But I can't see what it does that's different from @Samrae method. It seems like it's for posting. Is there another Code Tool?

     

    Terry, since I found this in the message posting box do you still want a screen shot?

     

    That did not use the code tool.

     

    I'm really curious to know where you were looking for it, which I described last Monday and later showed a picture?

     

    I think you still have some basic misunderstanding, so let's straighten that out. The Code tool, like the Bold tool, Emoji tool, Text Colour tool, etc, is for optional use when preparing a post. When clicked, the icon opens a box into which anything you type will be in a 'clean' form, no extra formatting, so that it can then safely be later copy/pasted by anyone and guaranteed to be identical to the original. Not so important for the command text, but crucial for the actual code. Incidentally, you can quickly see that code by clicking the button 'Toggle Direct Editor', which I've highlighted in this screenshot of my original macro. It toggles between the Script Editor (where you enter your commands) and the Direct Editor (which contain the code, and which occasionally advanced users might be brave enough to edit directly in a text editor.)

     

    Please post a  message confirming you now understand and also inserting in two code boxes:

    1. Your command text (i.e. my working macro after your edits).

    2. The code of that.

     

    CommandTextOriginal.jpg

  5. 10 hours ago, Gerry Peters said:

    Text Type (Simulate Keystrokes): s
    Text Type (Simulate Keystrokes): <ARROW DOWN>
    Text Type (Simulate Keystrokes): <ENTER>
    Text Type (Simulate Keystrokes): <TAB>
    Text Type (Simulate Keystrokes): <TAB>
    Text Type (Simulate Keystrokes): <TAB>
    Text Type (Simulate Keystrokes): <TAB>
    Text Type (Simulate Keystrokes): <CTRL>v
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <ENTER>
    Text Type (Simulate Keystrokes): s
    Text Type (Simulate Keystrokes): <HOME>
    Text Type (Simulate Keystrokes): <ARROW DOWN>
    Text Type (Simulate Keystrokes): <ARROW DOWN>
    Text Type (Simulate Keystrokes): <ENTER>
    Text Type (Simulate Keystrokes): <TAB>
    Text Type (Simulate Keystrokes): <TAB>
    Text Type (Simulate Keystrokes): 

    Text Type (Simulate Keystrokes): lyri
    Text Type (Simulate Keystrokes): <DOWN ARROW>
    Text Type (Simulate Keystrokes): <ENTER>
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <SHIFT><TAB>
    Text Type (Simulate Keystrokes): <ENTER>
     

     

    That is not using the code tool.

     

    Nor is it now relevant, as we've moved on to working with the macro I wrote for you to edit and try.

  6. OK, I've now read your full post.

    "I assume what you're getting at is having a macro use the file list to open those 3 files one at a time and then stop. Let me know if I did what you asked."

     

    No! 🙂

    What I've been aiming at is for you to attempt the macro I described, so that we can continue the discusson entirely outside Facebook.

    So I've written the sort of macro I was hoping to see from you, but more in the style of a tutorial. Step through this and come back when you are able to get a successful list in Notepad.

    Here are the macro commands:

     

    // Use Comments like this generously. Particularly directly before a command to describe what it's about to do. That may seem obvious to you but not to others.
    // This macro assumes that:
    1. A folder is open in Windows File Explorer
    2. A new empty text file is open in Notepad, 'Untitled - Notepad'
    // Its purpose is to demonstrate a simple use of the Repeat command, as you said you have not yet used that. I'm hoping it ovecomes the obstacle you're having in your Facebook macro.
     
    // Iin case you forgot to do so beforehand, the macro first activates the File Explorer window by using its exact or partial title as circumstances require.
    // Activate the window with the exact title 'UK 2020', in case you forgot to do so beforehand.
    Window Activate: UK 2020
    // The first file in the folder should be selected by default, but the next command should ensure that.
    Text Type (Simulate Keystrokes): <HOME>
    // TextType commands often work OK without any delay but I often use a short one when developing. I can remove it later if proves to be redundant.
    Delay: 0.1 seconds // Now, before attempting to insert a Repeat command, simply perform the basic task of this macro on a SINGLE element. In this demo it's the first entry, already selected at the top.
    // As a novice, before inserting a Repeat command, first perform the basic task of this macro on a SINGLE element. In this demo it's the first entry, already selected in UK 2020.
    // So get your macro working WITHOUT the following Repeat command and WITHOUT the End Repeat command near the end.
    // For simplicity this loop will copy the the first TEN filenames (without the extension) to Notepad. Learn more about other Repeat options in Help.
    Repeat Start (Repeat 10 times)
      Text Type (Simulate Keystrokes): <F2> // Switch to Edit mode
      Delay: 0.2 seconds
      Clipboard Copy
      Delay: 0.2 seconds
      // Create a variable with a name of your choice. (Note that I prefix mine with a 't', 'n', etc, to identify the TYPE of variable, but that's a personal preference.)
      Variable Set String %tFilename% from the clipboard contents
      Delay: 0.1 seconds
      // For testing your macro you can use temporary commands like the following.
      Text Box Display: TEMP // Disabled after testing
      // The filename is now on the clipboard, so restore normal mode before you forget.
      Text Type (Simulate Keystrokes): <ESC>
      Delay: 0.1 seconds
      // NOTE: When you are entering any command you can type F1 to display Help about it.
      // NOTE: To quicklly test the macro use F9 from here in the Script Editor. In 'Start Debugger in a Different Window', for this demo choose '<<Don't Switch Focus>>, so that you can check your Activate command is working.
      // NOTE: To quicklly test the macro use F9 from here in the Script Editor. In 'Start Debugger in a Different Window', for this demo accept the top option, '<<Don't Switch Focus>>, so that you can check your Activate command is working.
      // Now the macro needs to copy that line into the waiting Notepad file.
      // NOTE: We could have done this with a simple Paste, but I chose the variable method as you said you have not yet used it. And it's more flexible anyway, because you might want to use that variable value again much later.
      Window Activate: Untitled - Notepad
      // Often you can use a Wait for Window Title command after Activate, to ensure it is ready before proceeding. But in this case (as I frequently find) it didn't work reliably, so I used a Delay instead. Some trial/error may be needed to get the delays optimsed.
      Delay: 0.2 seconds
      Text Type (Simulate Keystrokes): %tFilename%
      Delay: 0.1 seconds
      Text Type (Simulate Keystrokes): <ENTER>
      Delay: 0.1 seconds
      Window Activate: UK 2020
      Delay: 0.2 seconds
      // Select the next line, ready to repeat the cycle.
      Text Type (Simulate Keystrokes): <ARROW DOWN>
    End Repeat
    // Now proceed with whatever other tasks are needed.

     

    And here is the code you can paste into a new macro and then edit to reflect your own folder choice.

     

    <COMMENT Value="Use Comments like this generously. Particularly directly before a command to describe what it's about to do. That may seem obvious to you but not to others." _BACK="0080FFFF"/>
    <COMMENT Value="This macro assumes that:\r\n1. A folder is open in Windows File Explorer\r\n2. A new empty text file is open in Notepad, 'Untitled - Notepad'"/>
    <COMMENT Value="Its purpose is to demonstrate a simple use of the Repeat command, as you said you have not yet used that. I'm hoping it ovecomes the obstacle you're having in your Facebook macro."/>
    <COMMENT/>
    <COMMENT Value="Iin case you forgot to do so beforehand, the macro first activates the File Explorer window by using its exact or partial title as circumstances require."/>
    <COMMENT Value="Activate the window with the exact title 'UK 2020', in case you forgot to do so beforehand."/>
    <WINDOW ACTIVATE Title="UK 2020" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <COMMENT Value="The first file in the folder should be selected by default, but the next command should ensure that."/>
    <TEXT TYPE Action="0" Text="<HOME>"/>
    <COMMENT Value="TextType commands often work OK without any delay but I often use a short one when developing. I can remove it later if proves to be redundant."/>
    <DELAY Flags="\x01" Time="0.1" _COMMENT="Now, before attempting to insert a Repeat command, simply perform the basic task of this macro on a SINGLE element. In this demo it's the first entry, already selected at the top."/>
    <COMMENT Value="As a novice, before inserting a Repeat command, first perform the basic task of this macro on a SINGLE element. In this demo it's the first entry, already selected in UK 2020." _BACK="00C080FF"/>
    <COMMENT Value="So get your macro working WITHOUT the following Repeat command and WITHOUT the End Repeat command near the end."/>
    <COMMENT Value="For simplicity this loop will copy the the first TEN filenames (without the extension) to Notepad. Learn more about other Repeat options in Help."/>
    <REPEAT START Start="1" Step="1" Count="10" Save="FALSE"/>
    <TEXT TYPE Action="0" Text="<F2>" _COMMENT="Switch to Edit mode"/>
    <DELAY Flags="\x01" Time="0.2"/>
    <CLIPBOARD COPY/>
    <DELAY Flags="\x01" Time="0.2"/>
    <COMMENT Value="Create a variable with a name of your choice. (Note that I prefix mine with a 't', 'n', etc, to identify the TYPE of variable, but that's a personal preference.)"/>
    <VARIABLE SET STRING Option="\x02" Destination="%tFilename%" NoEmbeddedVars="FALSE"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <COMMENT Value="For testing your macro you can use temporary commands like the following."/>
    <TEXT BOX DISPLAY Title="TEMP" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 tFilename\\f1  = \\f0 %tFilename%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE" _COMMENT="Disabled after testing"/>
    <COMMENT Value="The filename is now on the clipboard, so restore normal mode before you forget."/>
    <TEXT TYPE Action="0" Text="<ESC>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <COMMENT Value="NOTE: When you are entering any command you can type F1 to display Help about it." _BACK="0080FFFF"/>
    <COMMENT Value="NOTE: To quicklly test the macro use F9 from here in the Script Editor. In 'Start Debugger in a Different Window', for this demo choose '<<Don't Switch Focus>>, so that you can check your Activate command is working." _BACK="0080FFFF"/>
    <COMMENT Value="NOTE: To quicklly test the macro use F9 from here in the Script Editor. In 'Start Debugger in a Different Window', for this demo accept the top option, '<<Don't Switch Focus>>, so that you can check your Activate command is working."/>
    <COMMENT Value="Now the macro needs to copy that line into the waiting Notepad file."/>
    <COMMENT Value="NOTE: We could have done this with a simple Paste, but I chose the variable method as you said you have not yet used it. And it's more flexible anyway, because you might want to use that variable value again much later." _BACK="0080FFFF"/>
    <WINDOW ACTIVATE Title="Untitled - Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <COMMENT Value="Often you can use a Wait for Window Title command after Activate, to ensure it is ready before proceeding. But in this case (as I frequently find) it didn't work reliably, so I used a Delay instead. Some trial/error may be needed to get the delays optimsed."/>
    <DELAY Flags="\x01" Time="0.2"/>
    <TEXT TYPE Action="0" Text="%tFilename%"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <TEXT TYPE Action="0" Text="<ENTER>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <WINDOW ACTIVATE Title="UK 2020" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <DELAY Flags="\x01" Time="0.2"/>
    <COMMENT Value="Select the next line, ready to repeat the cycle."/>
    <TEXT TYPE Action="0" Text="<ARROW DOWN>"/>
    <END REPEAT/>
    <COMMENT Value="Now proceed with whatever other tasks are needed."/>

     

     

     

  7. I'll study your post later today but meanwhile you might want to practice the method of exchanging macros. As I said on Monday:

    "Post it, both the commands and the direct code, using the Code tool ('<>'). "

     

    CodeTool.thumb.jpg.09d4f1e659f087b8ed06bab93eab76b4.jpg

     

    The forum itself is another rich source of learning material. Browse other posts for tips and detailed advice. For instance, here's a verbatim paste from a post by @Samrae two days ago:

    --------------------

    "To copy what you see in the Macro Script Editor, highlight the macro lines lines you want, right-click, and click "Copy Command Text". Then, in this forum, click the <> icon and type ctrl+v to paste. The result looks like this:

    Text Type (Simulate Keystrokes): <ALT>e
    Text Type (Simulate Keystrokes): <ALTD>e<ALTU>

    To copy macro commands that someone can copy from this forum and paste into Macro Express, highlight the macro lines you want, right-click, and click "Copy". Then, again, in this forum, click the <> icon and type ctrl+v to paste. The result looks like this:

    <TEXT TYPE Action="0" Text="<ALT>e"/>
    <TEXT TYPE Action="0" Text="<ALTD>e<ALTU>"/>

     

    Often when asking for help it is a good idea to post both. If you make it easy for forum members to understand and help you will get better answers. 🙂"

    --------------------

     

  8. Your code as requested? As mentioned, that might help us to help you.

     

    And, as you are rightly regarding this as a learning exercise,  have you tried the suggestion in my last para?

     

    It does sound as if you need to study the basics. The Help is comprehensive and well written. Most commands show simple examples you can try, and then adapt. Get some simpler macros containing a Repeat loop working before tackling the FB group sharing. For instance, from Windows File Explorer create a list in Notepad of each filename  in the active folder. That’s a task we can all access.

     

    BTW, is the macro you’re trying to get working during the trial what I would call a mass marketing project?

  9. 43 minutes ago, rberq said:

     

    Ouch.  You really did mean ALL the menus were dumped at once into the one bag and scrambled together.  Sounds to me like a macro file corruption -- did your macro file recently get auto-converted from one ME version to the next, like from 4 to 6?

     

    No changes to version or any other relevant significant activity. (Apart from a Win 10 update the other night, an event I'm always nervous about.)

     

    This is Macro Express Pro 6.1.3.1 and Win 10 Pro is Version 1909 (OS Build 18363.1016).

  10. Thanks both. Note that it’s not the re-ordering but the unscrambling that’s the major pain. (And I have a macro that re-assigns the hotkeys, once they have been manually restored to the preferred alphabetic order, which I use after a editing the contents.)

     

    But as an example of the ‘scrambling’, my menu of about 30 macros for IrfanView is now sprinkled with macros for other applications like Excel, Google Earth and Explorer!

     

    What about my second question re the frequency of your .~mex backup files? I backup all my stuff nightly (and weekly) anyway, but I’d like to be sure those automated ones are behaving properly.

  11. I make great use of menu macros. (For example, a middle click on the title of any of 60 applications displays a menu of many macros to work specifically within that app.) So I was dismayed to find that about a quarter of these menus have somehow become corrupted. Many of the macros within them are not scoped to that app, and - less important - their alphabetc sequence has been lost. It's rather like all menus were tipped into a bag, shaken up, and then replaced randomly.

     

    I'm stepping through old backup files (extension .~mex) but it's going to be a hard job to fix.

     

    If anyone else does use menus, I'd appreciate it if you could check for similar corruption please.

     

    --------------------

     

    While engaged on this I was surprised to find long gaps in the dates of these backup files. How do yours look?

     

     

  12. Frustrating: trying to develop a macro to perform a Facebook task when that feature has already been publicly announced!

     

    For the reasons I gave I'm not going to be able to help much, sorry. But I could take a look at your macro to see if I can spot anything obvious. Post it, both the commands and the direct code, using the Code tool ('<>').

     

    You said you have "used ME for many years," but I see you still appear to be using the Recorder? As well as posting your macro as it stands, also post a version with all the redundant lines removed, mainly Delays  and Mouse Moves.

     

    Have you written other macros using Repeat loops?

     

    Ideally: can you find another widely accessible web site or Windows application to demonstrate the same obstacle to progress that you're having in Facebook?

     

     

  13. 6 hours ago, Gerry Peters said:
     The URL approach does apply at all to this situation, Facebook has a specific way to do this that only involves text.  All I need is a way to insert text into a box and finish running the macro, then with the next macro repeat I need different text in there. Thanks for all your help
     

     

    Hi Garry.

     

    One word missing from that first sentence 🙂 but I see your point.

     

    I'll study your subsequent post later today, but I hope someone who actually uses FB will step in and help. The risk of accidentally 'sharing' stuff with 'groups' while testing your macro is one I'll avoid! But I hope it will prove to be just a careful use of the Repeat command.

     

    Meanwhile, have you tried the new method described in this YT tutorial?

    July 2020 - How To Post To Multiple Facebook Groups At The Same Time - NEW Facebook Beta

    https://www.youtube.com/watch?v=DtzZ9gH5ufg

     

     

     

    Terry, Sunday 16 August 2020, 0844 UK BST

     

     

  14. 11 hours ago, acantor said:

    Terry,

     

    I would be curious to know if my two macros work when you run them. If you do, attend closely to the settings I outlined in the comments for "Activation" and "Scope." I found the settings to be persnickety. No problem setting "Scope" to "Global."

     

    Second macro:

    OK

     

    First macro: with scope and activation same as yours:

    Fails here except for ASCII Char and ASCII Val. However I suspect a timing issue because for the other eight types I found that the macro did run on about 10-15% of attempts. That was with the command selected followed by either a mouse left d-click or keyboard Enter, in either case followed by Esc to repeatedly try again. IOW the brisk sequence of Enter, Esc would occasionally result in your macro being run. The converse applied with the two ASCII types, which would occasionally fail.

     

    First macro: with global scope and activation same as yours:

    Fails here except for ASCII Char and ASCII Val. But I don't think it gave even that small proportion of successes with the other eight.

     

    First macro: with global scope and activation Window Gains Focus (like my macro).

    All work OK (except for Bool).

     

    Terry, Wednesday 5 August 2020, 10:05 UK

     

     

     

     

  15. On 7/31/2020 at 9:31 PM, Boss-Ton said:

    I have a series of Crystal reports I need to send to a specific printer each morning at a designated time (with finishing options such as double sided and stapled). I haven't been able to find options within ME Pro to allow me to do this. Has anyone successfully accomplished a task like this yet? If so, can they share with me the specifics on how to do it?

     

    Much appreciated!


    Are you already comfortable with writing MEP macros? Or is this your first serious attempt?

     

    As you’ve still been unable to achieve your objective after Cory’s very detailed instructions, I suggest you set Crystal Reports aside for a while and instead try to tackle the task as close as possible with Notepad. That’s an application we can access. Show us your macro, including its code, and we can then try to reproduce and/or advise you of any specific issues.

     

    You can then apply the same approach to CR.

     

    Terry

     

     

  16. This sure is throwing up some strange behaviour!

     

    My original macro, which I'm pretty sure I tested thoroughly, now fails for the following types: Decimal, Handle, ASCII Char and ASCII Value.

     

    In every case it's because the macro does not get activated. (Note again that, unlike Alan, I can only get any success with Window Gains Focus.)

     

    I tried changing the IF criterion to the width of the dialog, as the ten are unique. But that gave the same failures.

     

    I tried changing the macro activation to Window Loses Focus from Macro Express Pro - Script Editor (Name of macro) which gave a different set of failures.

     

    It seems those four culprit dialogs are Invisible to MX Pro in some way!

     

    I'm even considering using the full command list (instead of my preferred Favourites) and activating the macro by mouse clicks in the relevant area of Macro Express Pro - Script Editor (Name of macro)...

     

     

  17.  

    This appears to work although I had some erratic behaviour. Decimal played hard to get but fiddling around with delays appears to have sorted it. Bool is very slow to display. My code is just plain stuff, slogging through the IFs and could no doubt be improved.

     

    Also I haven't figured out why I need to double click twice in the command list to get the dialog.

     

    EDIT: Activation is

    Window Title: Variable Set
    Window Gains Focus
    Title is a partial match

     

    (Coudn't get reliable triggering with  Window Is Opened.)

     

    Whether I'll actually now use this macro is uncertain 😉

     

    // Assumes that one of the Variable Set... dialogs has just been opened
    Wait for Window Title: Variable Set 
    Variable Set String %tTitle% to topmost window title
     
    // BOOL
    If Variable %tTitle% Equals "Variable Set Bool"
      Text Type (Simulate Keystrokes): <TAB> // First a single tab
      Wait for Text Playback
      Delay: 0.1 seconds
      Text Type (Simulate Keystrokes): <F4> // Open drop-down
      Wait for Text Playback
      Delay: 0.1 seconds
    End If
     
    // CONTROL TEXT
    If Variable %tTitle% Equals "Variable Set Control Text"
      Text Type (Simulate Keystrokes): <TAB>
      Delay: 0.1 seconds
      Text Type (Simulate Keystrokes): <F4> // Opens drop-down
      Delay: 0.1 seconds
    End If
     
    // DECIMAL
    If Variable %tTitle% Equals "Variable Set Decimal"
      Text Type (Simulate Keystrokes): <TAB>
      Delay: 0.2 seconds
      Text Type (Simulate Keystrokes): <F4> // Opens drop-down
      Delay: 0.1 seconds
    End If
     
    // FROM FILE
    If Variable %tTitle% Equals "Variable Set From File"
      Text Type (Simulate Keystrokes): <TAB>
      Delay: 0.1 seconds
      Text Type (Simulate Keystrokes): <F4>
      Delay: 0.1 seconds
    End If
     
    // HANDLE
    If Variable %tTitle% Equals "Variable Set Handle"
    // Back with Shift+Tab
      Text Type (Simulate Keystrokes): <F4> // Open drop-down
      Delay: 0.1 seconds
    End If
     
    // INTEGER
    If Variable %tTitle% Equals "Variable Set Integer"
      Text Type (Simulate Keystrokes): <TAB>
      Delay: 0.1 seconds
      Text Type (Simulate Keystrokes): <F4> // Opens drop-down
      Delay: 0.1 seconds
    End If
     
    // STRING
    If Variable %tTitle% Equals "Variable Set String"
      Text Type (Simulate Keystrokes): <TAB><TAB><TAB><TAB><TAB>
      Delay: 0.1 seconds
      Text Type (Simulate Keystrokes): <F4> // Opens drop-down
      Delay: 0.1 seconds
    End If
     
    // ASCII CHAR
    If Variable %tTitle% Equals "Variable Set to ASCII Char"
      Text Type (Simulate Keystrokes): <TAB>
      Delay: 0.1 seconds
    End If
     
    // ASCII VALUE
    If Variable %tTitle% Equals "Variable Set to ASCII Value"
      Text Type (Simulate Keystrokes): <TAB>
      Delay: 0.1 seconds
    End If
     
    // MISC
    // As it's not one of the preceding nine, the dialog opened must be 'Variable Set From Misc'
    // No tabs needed, and no drop-down.
    <COMMENT Value="Assumes that one of the Variable Set... dialogs has just been opened"/>
    <WAIT FOR WINDOW TITLE Title="Variable Set " Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
    <VARIABLE SET STRING Option="\x05" Destination="%tTitle%"/>
    <COMMENT/>
    <COMMENT Value="BOOL"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Bool" IgnoreCase="TRUE"/>
    <TEXT TYPE Action="0" Text="<TAB>" _COMMENT="First a single tab"/>
    <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Open drop-down"/>
    <WAIT FOR TEXT PLAYBACK Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="CONTROL TEXT"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Control Text" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<TAB>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="DECIMAL"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Decimal" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<TAB>"/>
    <DELAY Flags="\x01" Time="0.2"/>
    <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="FROM FILE"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set From File" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<TAB>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <TEXT TYPE Action="0" Text="<F4>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="HANDLE"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Handle" IgnoreCase="FALSE"/>
    <COMMENT Value="Back with Shift+Tab"/>
    <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Open drop-down"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="INTEGER"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set Integer" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<TAB>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="STRING"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set String" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<TAB><TAB><TAB><TAB><TAB>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <TEXT TYPE Action="0" Text="<F4>" _COMMENT="Opens drop-down"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="ASCII CHAR"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set to ASCII Char" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<TAB>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="ASCII VALUE"/>
    <IF VARIABLE Variable="%tTitle%" Condition="\x00" Value="Variable Set to ASCII Value" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<TAB>"/>
    <DELAY Flags="\x01" Time="0.1"/>
    <END IF/>
    <COMMENT/>
    <COMMENT Value="MISC"/>
    <COMMENT Value="As it's not one of the preceding nine, the dialog opened must be 'Variable Set From Misc'"/>
    <COMMENT Value="No tabs needed, and no drop-down."/>

     

×
×
  • Create New...