Jump to content
Macro Express Forums

jrgreenman

Members
  • Posts

    77
  • Joined

  • Last visited

Posts posted by jrgreenman

  1. Thanks Kevin. Stan got back to me and solved the problem. For everyone's reference, here's what he wrote:

     

    ========================================================================

    Hi Jace,

     

    I made one modification to your macro, adding a trim command after the Variable Set String. This seems to make it work correctly.

     

    Variable Set String %Customer% from the clipboard contents

    Variable Modify String %Customer%: Trim

     

    Excel adds a bunch of hidden characters to a cell when it is copied to the clipboard. Trimming the variable strips the extra hidden characters. I noticed when I did the steps manually that pressing Enter twice pasted the text. One of the hidden characters may have been doing something similar to an Enter.

     

    Thanks,

    Stan

    ========================================================================

     

    Thanks to everyone who contacted me to help out.

  2. You should probably submit a support request, not a bugrep as i seriously doubt it's a bug.

     

    Here's something I don't understand. Your code is opening the GoTo box but why on earth are you typing the customer name into the GoTo box? Don't you want to go somewhere and then paste in the customer? I mean unless what you are coping is a string like "Sheet1!B15" it isn't going to work.

     

    This is the only reporting mechanism I am aware of: http://www.macros.com/bugreport.htm

     

    Is a "support request" mae through some other web page??

     

    Regarding the question on the GoTo box, I have created named cells so that I can search for data (like a customer name), expand my selection (which I don't do in the test code I uploaded) and copy the expanded selection to the destination named for the customer it applies to. So I'm using the customer name for double duty, both as the target of my search and the named cell that is the destination of the copied data. It helps keep my code data-driven and compact.

     

    It will be more obvious if you take a look at the test.xls spreadsheet. You'll see that Copy (and Main) is the name of a cells as well as the literal data being moved around.

  3. My guess is that you have anohter macro and the keystrokes of this macro are activating the other macro. Create a new macro file (export) with only the macro in it and try again. Make sure only this 1 MEX is open.

     

    PS F5 works for the GoTo box as well

     

    Thanks for the reply, Cory. A good suggestion, but no joy. I even replaced <CTRL>g w/ <F5>, but still see the same behavior.

     

    From my initial post, note that the macro works as expected if I merely invert the last two lines of code. That is, if I type out the string literal "Copy" instead of the contents of the variable %Customer%, the macro works fine.

     

    I think this is some kind of bug in MEP related to the clipboard contents and typing out variables.

     

    Will submit a bug report.

  4. Bump. Any PGM people out there??

     

    I'm having some trouble with PGM and MEP 4.0.4.1.

     

    When I converted my old mex file, I guess it converted all the PGM macros as well. But now I'm getting an occasional cryptic error message (will post on that another time), and some behavior from {PGM Function} where it blast out crazy strings of character like this:

     

    \x3c\x52\x45\x47\x57\x49\x4e\x54\x3a90\x3a\x48\x4b\x45\x59\x5f\x43\x55\x52\x52\x45\x4e\x54\x5f\x55\x53\x45\x52\x5c\x53of\x74\x77a\x72e\x5c\x50\x72ofe\x73\x73io\x6ea\x6c\x20\x47\x72ade\x20\x4dac\x72o\x73\x5c\x53\x77a\x70

     

    ...literally forever.

     

    I tried to uninstall/reinstall PGM, and although the app disappears, the PGM macros are all still in my mex file. And they can't be deleted because they are password protected.

     

    The PGM site says that, while PGM is optimized for ME3, they "can be imported" into MEP.

     

    A little more info:

     

    1. PGM was actually working more-or-less ok w/ MEP 4.0.2.1. The crazy characters and other behaviors started when I installed MEP 4.0.4.1

    2. I still have ME3 installed because there are some macros I use that I have not ported over to MEP yet.

     

    Might having ME3 installed affect how PGM behaves???

     

    Help... :)

     

    Jace

  5. I have an spreadsheet (xls, but opened in Excel 2007) for which I am copying data from one sheet to another (attached).

     

    The data "Copy" is in a named cell called Main (on MainSheet). The destination is a named cell on CopySheet called "Copy".

     

    Here's the code:

     

    ========================================================================

    <WINDOW ACTIVATE Title=".xls [Compatibility Mode]" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>

    <CLIPBOARD COPY/>

    <VARIABLE SET STRING Option="\x02" Destination="%Customer%"/>

    <TEXT TYPE Action="0" Text="<CTRL>x"/>

    <TEXT TYPE Action="0" Text="<CTRL>g"/>

    <WAIT FOR WINDOW TITLE Title="Go To" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>

    <DELAY Flags="\x02" Time="300"/>

    <TEXT TYPE Action="0" Text="%Customer%<ENTER>"/>

    <TEXT TYPE Action="0" Text="Copy<ENTER>" _ENABLED="FALSE"/>

    ========================================================================

     

    As written, the code should copy BUT NOT PASTE the data into the destination cell. But it does paste it!

     

    Curiosities:

    1. When I execute the same keystrokes manually, data is not pasted.

    2. When I invert lines 9 and 10, data is not pasted (even though %Customer% holds the string literal "copy").

     

    I'm stumped. Why is MEP automatically pasting the data into the destination sheet??

     

    Jace

     

    test.zip

  6. Only one of any activation type is allowed. But it is extremely easy to do what you want. Simply create another macro with the other activation and put a Macro Run command in it to run the original macro.

     

    I have a bunch of macros (hundreds) for which I use shortkeys to type longer clips of text, and am trying to figure out if I can combine them into a single macro with multiple activations of different shortkeys. Based on my reading here, that's currently not possible. So:

     

    a ) I'd put forward another vote to allow multiple different shortkey (or multiple different instances of the same activation type) to be permitted, and:

     

    b ) The second part of the solution to my many-one-line-macros is that I'd like to be able to discern the actual shortkey (or hotkey) used to invoke the macro and then do a Switch on it.

     

    Even if "a)" is implemented, it there (or could there) be a way to know which shortkey/hotkey invoked a given macro so I could test and branch based on it??

     

    Thanks.

     

    Jace

  7. I'm having some trouble with PGM and MEP 4.0.4.1.

     

    When I converted my old mex file, I guess it converted all the PGM macros as well. But now I'm getting an occasional cryptic error message (will post on that another time), and some behavior from {PGM Function} where it blast out crazy strings of character like this:

     

    \x3c\x52\x45\x47\x57\x49\x4e\x54\x3a90\x3a\x48\x4b\x45\x59\x5f\x43\x55\x52\x52\x45\x4e\x54\x5f\x55\x53\x45\x52\x5c\x53of\x74\x77a\x72e\x5c\x50\x72ofe\x73\x73io\x6ea\x6c\x20\x47\x72ade\x20\x4dac\x72o\x73\x5c\x53\x77a\x70

     

    ...literally forever.

     

    I tried to uninstall/reinstall PGM, and although the app disappears, the PGM macros are all still in my mex file. And they can't be deleted because they are password protected.

     

    The PGM site says that, while PGM is optimized for ME3, they "can be imported" into MEP.

     

    A little more info:

     

    1. PGM was actually working more-or-less ok w/ MEP 4.0.2.1. The crazy characters and other behaviors started when I installed MEP 4.0.4.1

    2. I still have ME3 installed because there are some macros I use that I have not ported over to MEP yet.

     

    Might having ME3 installed affect how PGM behaves???

     

    Help... :)

     

    Jace

  8. I have a macro that attaches a named file and then deletes the file. Even though the "file delete" command comes after the keystrokes that attach the file to the email, sometimes the file gets deleted before the attachment is actually attached.

     

    I've added in various delays to combat the problem, and they usually work, but not always.

     

    Does anyone know of a reliable way to detect when a named attachment is actually attached to an email? If I could test for that, I could put in a "wait" or something until I know for sure the attachment is actually attached.

     

    Thanks.

     

    Jace

  9. I don't think it is possible to map the Print Screen key to a Macro Express macro, but you can do the opposite: Choose another hotkey to simulate pressing Print Screen or Alt + Print Screen.

     

    Yeah, that's what I've done so far. I use Win+P to invoke Gadwin Printscreen to shoot a copy to the clipboard and Win+Ctrl+P to shoot a copy to a file.

     

    But those hotkeys are not as intuitive as "Prnt Scrn" and Ctrl+"Prnt Scrn".

  10. I'd have thought the latter - when I press Prt Scr I want it to do what it says on the label! ;)

     

    --

    Terry, East Grinstead, UK

     

    I can see the argument, but I'd also like to map Ctrl-PrntScrn and Alt-PrntScrn to other things. And if one chose not to map the "Prnt Scrn" button at all, it would still perform whatever default function the OS had for it.

     

    3rd party utilities that make use of the Prnt Scrn button (I use the free Gadwin Printscreen utility) allow the user to map combinations of Prnt Scrn to do various things. I'd just prefer to do the mapping and manage the third party app via MEP.

  11. Just got a screaming new computer and upgrades from Office 2003 to Office 2007 at the the same time. I still have my old PC w/ Office 2003 installed and have seen some differences in the way macros run on the new fast machine (w/ Office 2007) and the old slow machine (w/ Office 2003).

     

    I've been inserting delays here and there to try and make things work better, but one of the things I think would be very helpful is if I could slow ALL of ME3 down, all keystrokes, all mouse clicks, for all macros.

     

    I've already set the global Text Type Delay preference to 5000 microseconds. That has helped some. But there are still plenty of odd behaviors that show up on the new machine, but not the old (running the same macros)>

     

    Does ME3 support some kind of global slow-the-heck-down setting?

     

    Thanks

  12. Got a new question. Well, it's kind of related and since we're already gathered here, why start a new thread? :)

     

    Anyway, I now notice that if I use meproc (yes, I concede passing variables this way is fewer lines of code) to run a macro from VBA, that the meproc process exits upon _starting_ the macro. That is, it runa asynchronously.

     

    If my VBA app depends on the results of the macro after it concludes running, I'm outta luck. My app races ahead even though the macro is still running.

     

    Is there a way to tell meproc to run synchronously, that is, NOT to exit until the macro concludes execution?

     

    Jace

  13. Kevin,

     

    meproc.exe /AMacroName /VT1:Variable One /VN23:150 /D6:22:23

     

    What's that last thing at the end? I don't see any documentation for the /D switch. If that is intended to be an example of passing a decimal variable, shouldn't it be /VD? And if so, what's the second colon (betw the 22 and the 23)?

     

    Seems like the last parameter oughtta read: /VD6:22.23

     

    Yes? No?

     

    Jace

  14. randallc:

     

    Well, anytime you have to write something to the hard disk, that's relatively slow. But it's still milliseconds (instead of microseconds). But I have a consicientious objection to it because it's inelegant. Same w/ passing stuff thru the clipboard (which should much faster in any case since it does not involve writing to disk).

     

    jowensii:

     

    Would you be able to post an example of your working VBA code?

    I sent it to Kevin Heaton who is packaging it up for public consumption, but here's what I'm using:

     

    ===================================================

    Private Declare Function FindWindow _

      Lib "User32" Alias "FindWindowA" ( _

          ByVal lpClassName As String, _

          ByVal lpWindowName As String) As Long

             

    Private Declare Function PostMessage _

      Lib "User32" Alias "PostMessageA" ( _

          ByVal hwnd As Long, _

          ByVal wMsg As Long, _

          ByVal wParam As Long, _

          ByVal lParam As Long) As Long

     

    Private Sub RunMacro()

      'Runs a macro express macro

     

      Const WM_USER = &H400

      Const Command = WM_USER + 20

      Const Macroname = "Macroname"  'Replace this with your macro name

     

      Dim hwnd, I, Result As Long

     

      hwnd = FindWindow("TMainWin", "Macro Express Player")

      For I = 1 To Len(Macroname)

        Result = PostMessage(hwnd, Command, Asc(Mid(Macroname, I, 1)), 0)

      Next I

      Result = PostMessage(hwnd, Command, 0, 0)

     

    End Sub

    ===================================================

     

    Is the Windows API route really that much faster than starting ME macro with MeProc.exe and command line switches?

     

    Again, starting MeProc.exe involves the hard disk. And if, for example, your VBA code is looping through a long file processing each line, you could be invoking MeProc.exe a zillion times.

     

    But in many cases, and for a non-real-time application, I'm sure it's perfectly serviceable.

     

    Jace

  15. Well, I finally found the ASC function in VBA and wrote this sub:

     

    ===================================================

    Sub RunMacro(Command As Long, MacroName As String)

    'Runs a macro express macro

    Dim hwnd, I, Result As Long

     

    hwnd = FindWindow(vbNullString, "Macro Express Player")

     

    For I = 1 To Len(MacroName)

    Result = PostMessage(hwnd, Command, Asc(Mid(MacroName, I, 1)), 0)

    Next I

    Result = PostMessage(hwnd, Command, 0, 0)

     

    End Sub

    ===================================================

     

    But Macro Express does not repspond. :(

     

    Ideas anyone??

  16. I've been trying this in VBA (Microsoft Access) but also have not yet been able to get it to work.

     

    I'll repost here if I ever get it figured out.

     

    I did find this in the KB which indicates the characters streamed to Macro Express should be the ordinal values of the characters in the Macro nickname:

     

    http://www.macros.com/faq//4.23.html

     

    Looks like they are casting the character to its ordinal value.

     

    I haven't yet figured out how to do that in MS Access VBA.

     

    Jace

×
×
  • Create New...