Jump to content
Macro Express Forums

stevecasper

Members
  • Posts

    570
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by stevecasper

  1. How to Past CR /LF directly in the clipboard

    Example

    Variable modify sting append “ is red” to T 8%

    Variable modify sting append “ is blue” to T 12%

    Variable modify sting append T 8% to T 12%

    Variable modify sting save T 12% to clpboard

     

    I got when I paste the clipboard

    the balloon is blue the square is red

    but I want to get

    the balloon is blue

    the square is red

    Probably I have to use the clipboard append text but I’m not sure about this one?

    Guliver,

     

    For what you're trying to do, you'll have to create a variable which contains the CR/LF values, then append that variable to your %T12% variable before appending the %T8% variable.

     

    Try this:

    // Based on your post, I will assume %T8% contains "The square" and %T12% contains "The balloon"
    Variable Set String %T8% "The square"
    Variable Set String %T12% "The balloon"
    // First we create the CR/LF variable:
    Variable Set %T1% to ASCII Char of 13
    Variable Set %T2% to ASCII Char of 10
    Variable Modify String: Append %T2% to %T1%
    // Now we can do what you were trying to do:
    Variable Modify String: Append " is red." to %T8%
    Variable Modify String: Append " is blue." to %T12%
    Variable Modify String: Append %T1% to %T12%
    Variable Modify String: Append %T8% to %T12%
    Variable Modify String: Save %T12% to Clipboard

    <REM2:Based on your post, I will assume %T8% contains "The square" and %T12% contains "The balloon"><TVAR2:08:01:The square><TVAR2:12:01:The balloon><REM2:First we create the CR/LF variable:><ASCIIC:1:1:13><ASCIIC:2:1:10><TMVAR2:08:01:02:000:000:><REM2:Now we can do what you were trying to do:><TMVAR2:07:08:00:000:000: is red.><TMVAR2:07:12:00:000:000: is blue.><TMVAR2:08:12:01:000:000:><TMVAR2:08:12:08:000:000:><TMVAR2:16:12:00:000:000:>

  2. Would you be able to give an example on how to parse out the cunks by finding the markers? and the macro you have sounds very interesting as well ! :P Thank you!

    I'm not Cory (he doesn't monitor the ME3 boards anymore, to my knowledge), so his method may differ from mine, but I might use features such as

    "Set Integer from position of text in Variable" to locate the To:, then use copy to clipboard starting at that Integer and copying over a specific number

    of characters from that point. You'll need some logic to determine the exact number of spaces, and you'll need to modify the original integer in order

    to prevent the "To:" from being copied as well, but that's the general idea.

     

    Something like this:

     

    Example email header:

    To: Captain Caveman

    From: Jean Gray

     

    Example macro:

    Clipboard Copy
    Variable Set String %T1% from Clipboard
    Variable Set Integer %N1% from Position of Text in Variable %T1%
    Variable Modify Integer: %N1% = %N1% + 3
    Variable Set Integer %N2% from Position of Text in Variable %T1%
    Variable Modify Integer: %N3% = %N2% - %N1%
    Variable Modify String: Copy Part of %T1% to %T2%
    Variable Modify String: Trim %T2%
    Text Box Display: Recipient

    <CLIPC><TVAR2:01:03:><IVAR2:01:13:1:To:><NMVAR:01:01:1:0000001:2:0000003><IVAR2:02:13:1:From:><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:02:01:N01:N03:><TMVAR2:01:02:00:000:000:><TBOX4:T:1:CenterCenter000278000200:000:Recipient%T2%>

     

    EDIT-

     

    If you read this earlier, I had posted the above code for ME Pro, not realizing I was on the ME3 board... I have now updated the code for ME3. Sorry for any confusion.

  3. Jason,

     

    I'm not sure if this is the same issue, but in recent builds of MEP the Paste functions when called by a macro (either clipboard paste, or Text Type: Use clipboard to paste), do not work 100% of the time. Closer to about 50%, if that. I've had to change all my TextTypes to "Simulate keystrokes" or build self-check repeat-loops to make sure the pasted info is actually pasting.

     

    It's a pain in the butt, and I originally attributed it to my PoS work-computer, but pasting works fine when done in ME3 or when I manually do Ctrl+V

     

    I have not ever reported it as an official bug, because I just don't know what info to give the folks at ISS, and because my MEP at home works 100% whenever I've built macros to test it.

     

    <shrug>

  4. this is the logic to compute the age. Today's date minus date of birth = xxxx days divided by 365.25 (accounts for leap year) to calculate age in years. Any suggestions on how to make this work in MEP?

    Yes, that will work - I don't know what I was thinking when I said you can't do it.

     

    I guess what I meant was that there is no way to convert a text variable in the format 03/15/1980 into a date/time variable directly. What I believe you'll need to do is parse each segment into a different text variable, eg. %Mm%, %Day%, %Yr%; then convert each text variable into an integer or decimal and do whatever math needs to be done in order to create the date/time variable.

     

    Having thought about it a little today, I'm now sure that it can be done with some patience, but I don't know that I'll have a chance to figure it out today.

  5. Thanks for your suggestions. Everything works. I will keep looking for a way to compute (in MEP) age based on date of birth.

    Cory is probably the best person to ask for help with that particular aspect. He grasps the way dates are handled in MEP and Excel and has posted a number of times hints and suggestions on using the date features of MEP. Some of that might help you. I just have a hard time wrapping my head around date/time functions as decimals.

  6. Ok, this will do everything you specified, with the exception of calculating the patient's age. That kind of scripting is way too complex for me

    to try to do while working (and I'm not 100% convinced it's even possible with MEP right now). If it is, it's way beyond my comprehension at

    this point.

     

    Anyway, you'll obviously want to change the location of the source file (this macro points to a .txt file I saved to my desk top), and the location

    of the results file (again, I pointed it at my desk top.

     

    You'll make those changes on the Text File Begin Process command and on the very very last command: Variable Modify String

     

    Any other changes you may need to make for your specific needs will be between the "Begin Process" and "End Process" commands, more than likely.

     

    <COMMENT Value="Create a carriage return variable"/>
    <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CRLF%"/>
    <VARIABLE SET TO ASCII CHAR Value="10" Destination="%T[1]%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%CRLF%" Variable="%T[1]%"/>
    <TEXT FILE BEGIN PROCESS Filename="C:\\Documents and Settings\\z051940\\Desktop\\medrecord.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%FileProcess[1]%"/>
    <IF VARIABLE Variable="%FileProcess[1]%" Condition="\x06" Value="Person" IgnoreCase="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%FileProcess[1]%" ToReplace="Person: " All="FALSE" IgnoreCase="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x00" Destination="%FileProcess[1]%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%FileProcess[1]%%CRLF%"/>
    <END IF/>
    <IF VARIABLE Variable="%FileProcess[1]%" Condition="\x06" Value="MRN" IgnoreCase="FALSE"/>
    <COMMENT Value="Set MRN"/>
    <VARIABLE SET INTEGER Option="\x0E" Destination="%Position[1]%" Text_Variable="%FileProcess[1]%" Text=" MRN" Ignore_Case="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x0A" Destination="%FileProcess[1]%" Start="1" Count="%Position[1]%"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%FileProcess[1]%" ToReplace="MRN:" All="FALSE" IgnoreCase="FALSE"/>
    <VARIABLE SET INTEGER Option="\x0E" Destination="%Position[2]%" Text_Variable="%FileProcess[1]%" Text=" DOB" Ignore_Case="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x09" Destination="%MRN%" Variable="%FileProcess[1]%" Start="1" Count="%Position[2]%"/>
    <VARIABLE MODIFY STRING Option="\x00" Destination="%MRN%"/>
    <COMMENT Value="Set DOB"/>
    <VARIABLE MODIFY STRING Option="\x0A" Destination="%FileProcess[1]%" Start="1" Count="%Position[2]%"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%FileProcess[1]%" ToReplace="DOB:" All="FALSE" IgnoreCase="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x00" Destination="%FileProcess[1]%"/>
    <VARIABLE MODIFY STRING Option="\x09" Destination="%DOB%" Variable="%FileProcess[1]%" Start="1" Count="10"/>
    <VARIABLE MODIFY STRING Option="\x00" Destination="%DOB%"/>
    <COMMENT Value="Set Gender"/>
    <VARIABLE SET INTEGER Option="\x0E" Destination="%Position[3]%" Text_Variable="%FileProcess[1]%" Text=" Gender" Ignore_Case="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x0A" Destination="%FileProcess[1]%" Start="1" Count="%Position[3]%"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%FileProcess[1]%" ToReplace="Gender:" All="FALSE" IgnoreCase="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x00" Destination="%FileProcess[1]%"/>
    <VARIABLE SET STRING Option="\x00" Destination="%Gender%" Value="%FileProcess[1]%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%MRN%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%CRLF%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%DOB%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%CRLF%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%Gender%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%CRLF%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%NewMedRecord%" Variable="%CRLF%"/>
    <END IF/>
    <TEXT FILE END PROCESS/>
    <VARIABLE MODIFY STRING Option="\x11" Destination="%NewMedRecord%" Filename="C:\\Documents and Settings\\z051940\\Desktop\\New Medical Record.txt" CRLF="FALSE"/>

     

    It will look something like this, in the script editor:

     

    // Create a carriage return variable
    Variable Set to ASCII Char 13 to %CRLF%
    Variable Set to ASCII Char 10 to %T[1]%
    Variable Modify String %CRLF%: Append Text String Variable (%T[1]%)
    Text File Begin Process: C:\Documents and Settings\z051940\Desktop\medrecord.txt
     If Variable %FileProcess[1]% Contains "Person"
    Variable Modify String: Replace "Person: " in %FileProcess[1]% with ""
    Variable Modify String %FileProcess[1]%: Trim
    Variable Modify String %NewMedRecord%: Append Text String Variable (%FileProcess[1]%%CRLF%)
     End If
     If Variable %FileProcess[1]% Contains "MRN"
     // Set MRN
    Variable Set Integer %Position[1]% to the position of " MRN" in %FileProcess[1]%
    Variable Modify String %FileProcess[1]%: Delete a substring starting at 1 and %Position[1]% characters long
    Variable Modify String: Replace "MRN:" in %FileProcess[1]% with ""
    Variable Set Integer %Position[2]% to the position of " DOB" in %FileProcess[1]%
    Variable Modify String: Copy a substring in %FileProcess[1]%, starting at 1 and %Position[2]% characters long to %MRN%
    Variable Modify String %MRN%: Trim
    // Set DOB
    Variable Modify String %FileProcess[1]%: Delete a substring starting at 1 and %Position[2]% characters long
    Variable Modify String: Replace "DOB:" in %FileProcess[1]% with ""
    Variable Modify String %FileProcess[1]%: Trim
    Variable Modify String: Copy a substring in %FileProcess[1]%, starting at 1 and 10 characters long to %DOB%
    Variable Modify String %DOB%: Trim
    // Set Gender
    Variable Set Integer %Position[3]% to the position of " Gender" in %FileProcess[1]%
    Variable Modify String %FileProcess[1]%: Delete a substring starting at 1 and %Position[3]% characters long
    Variable Modify String: Replace "Gender:" in %FileProcess[1]% with ""
    Variable Modify String %FileProcess[1]%: Trim
    Variable Set String %Gender% to "%FileProcess[1]%"
    Variable Modify String %NewMedRecord%: Append Text String Variable (%MRN%)
    Variable Modify String %NewMedRecord%: Append Text String Variable (%CRLF%)
    Variable Modify String %NewMedRecord%: Append Text String Variable (%DOB%)
    Variable Modify String %NewMedRecord%: Append Text String Variable (%CRLF%)
    Variable Modify String %NewMedRecord%: Append Text String Variable (%Gender%)
    Variable Modify String %NewMedRecord%: Append Text String Variable (%CRLF%)
    Variable Modify String %NewMedRecord%: Append Text String Variable (%CRLF%)
     End If
    Text File End Process
    Variable Modify String: Save %NewMedRecord% to "C:\Documents and Settings\z051940\Desktop\New Medical Record.txt"

  7. Most of this will be very simple to do using either a Text File Process command loop, or even a basic set of Copy/Delete Text File commands.

     

    The hardest part is going to be converting DOB to actual age.

     

    I'll take a stab at building a macro that does what I think you are trying to do. Even if mine isn't exact you ought to be able to extrapolate just exactly how to do it right based on picking my macro apart and... um... familiarizing yourself with the sample macros that come with Macro Express, as well as reading the help pages. Ahem. Hint-hint.

     

    Give me a while to work on it, though. I'm at work, and they prefer when I do what I get paid to do.

  8. I have a macro which simply grabs the title of the topmost window title, application and a logs to a file. I do not use any Variable Restores. It is distributed and runs every minute and is instantaneous. For some time now I've been noticing when I reconnect to a disconnected Terminal Server session The Forrest icon will be in the system tray and if I hover it claims this macro is running. However it never goes away even though it's responsive. I eventually have to resort to killing MEP and restarting. I reckoned it was just something to do with the TS but I've seen it a couple of time on other normal desktop sessions on user's workstations.

     

    Has anyone else seen this? Does anyone think this might be related to the other slow down issue we have been seeing?

     

    I know that at least some of these systems do not have the latest version so I do not want to officially report it yet but I wanted to see if anyone else has seen this.

    I used to have the hanging Forrest in early versions of MEP, and it is back with the latest version, though I've only noticed it once. He didn't affect my work-flow or the functionality of my macros, though, so I ignored him. Until ME crashed. At that point I sent a bug report and relaunched the program. This was on Thursday or Friday, I believe, so it hasn't been a huge nightmare for me like some of the crashes I was getting on the last version.

  9. In MEP you must define all your variables in advance under the "Variables" tab. Here you can define a variable like %Stuff% with any number of elements and you use these like %Stuff[1382]%. You must define the number of elements in the array at the time of writing and you can not make them variable. IE can not change at run time.

    But what you can do is estimate how big your array is going to need to be, and then establish it larger than you expect to need, and then you should be fine.

     

    And by way of clarifying, you can use integer variables to manipulate the array within the macro itself. eg: %Stuff[%Integer[1]%]%

     

    If Integer[1] = 25, then this will establish or call variable %Stuff[25]%

  10. Actually, come to think about it, I don't need any If commands...

    Good point!

     

    Let us know how it turns out.

     

    Something else you might want to do is enable logging of all commands (under the miscellaneous tab in the ME Editor).

     

    When the macro fails, you'll be able to pull up that log and see exactly what the last executed line of code was. That can be useful to help catch the faulty command, whether it's the script or some bug within ME itself.

     

    Of course, if this macro is running thousands of times in a row, you might want to work something into the macro that deletes the file every so often. Kevin once told me that when that file gets really big, it can adversely affect the macro being logged.

     

    Also, errors will often tell you what line broke the macro, but I'm sure you probably already caught that.

  11. A few quick observations that may or may not be useful (depending on what the "calling macro" contains).

     

    1. The "Undefined Variable" error I used to get all the time when I had Save and Restore variable commands in use. I stopped using them, and stopped getting that error.
    2. Your "If variable is greater than/Goto" sequence seems redundant, since the random value being generated will never be greater than 99999 (as per the Set Integer command). Though I don't see how this would negatively affect the macro, it just seems unnecessary.
    3. Your "If Variable is less than" sequences are excessive. The way you have it built, you really only need the one "If less than 10000". No matter what, if it's less than 10, 100, 1000, then it's also less than 10000, and you only need to have one command sequence to establish the 6-digit padding. Again, the extra commands probably aren't going to affect the outcome of the macro, but streamlining can make things easier to trouble-shoot.

     

    As it is, I don't see any obvious reason for the macro to be failing or erring. Perhaps with the other macros involved, we may be able to see something you could have missed.

  12. As far as the wildcard issue goes, I have to say I'm not completely certain what it is you need to do. Are you calling it a wildcard

    because it will be different each time the macro runs, and you need the macro to recognize the text that needs to change regardless of

    what numbers are inside it? If so, it is possible, though it will take a bit more logical code to make the macro work.

     

    I'll take a shot at it and post my results when I have them (at work right now, so it may take a little while).

    Assuming I understood what you wanted, the answer was not too difficult to figure out. As I mentioned, it did require a little bit of extra logic

    which, in turn, required quite a few extra lines of code, but nothing too extreme. The following code makes several assumptions about the text

    you'll be modifying with it.

     

    1. It assumes the wildcards will always fall after style id=" or script id='

    2. It assumes that script id=' will always be followed by title=

    and

    3. It assumes that style id=" will always be followed by name=

     

     

    Where you see N1 modified by +11 and +10, those numbers are derived by the number of characters of script id=' and style id=",

    respectively.

     

    Finally, because the original request to change

     

    <subtitle_script id='47166' to [script Info]^p

    and

    <style id="49922" name=" to Style:

     

    The Replace commands completely removed the "wildcards", leaving there no reason to even care about them... so in order to be

    thorough (I like thoroughness), I went ahead and added them back in so the results should end up looking like this:

     

    <subtitle_script id='47166' to [script Info]^p 47166

    and

    <style id="49922" name=" to Style: 49922

     

    Here's the code. Let us know if you're still having issues (though we really might want to move it over to the ME3 forum).

     

    <REM2:use text file in installationPath "textanswers.txt"><TVAR2:05:04:C:\Documents and Settings\z051940\Desktop\sample.txt><REM2:The following code will isolate the "script id" wildcards><IVAR2:01:13:5:script id='><NMVAR:01:01:1:0000001:2:0000011><IVAR2:02:13:5:title='><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:06:05:N01:N03:><TMVAR2:21:06:01:001:000:'><TMVAR2:01:06:00:000:000:><REM2:The following code will isolate the "style id" wildcards><IVAR2:01:13:5:style id="><NMVAR:01:01:1:0000001:2:0000010><IVAR2:02:13:5:name="><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:07:05:N01:N03:><TMVAR2:21:07:01:001:000:"><TMVAR2:01:07:00:000:000:><REM2:Do all your replaces here; this only example><TMVAR2:21:05:01:001:000:<subtitle_script id='%T6%'[Script info]^p %T6%><TMVAR2:21:05:01:001:000:<style id="%T7%" name="Style: %T7%><DELAY:1><REM2:....all numbers, descending, in between; there's probably a better way...><TMVAR2:17:05:00:000:000:C:\Documents and Settings\z051940\Desktop\sample2.txtT>

  13. The T4 variable was left in by mistake, ignore it heh.

    The name and apple part where simple examples I used for testing.

     

    The macro above will not work for me, and it's starting to annoy me. I simply cannot understand why that isn't working...

    For the time being I made a MSoffice macro, but a ME macro would be much more efficient.

     

    Also, if it did work not sure how to make the ID a wildcard.

    Hmmm...

     

    Make sure your "Replace" commands don't have any spaces before or after the text you want changed. That is the number one problem I have when using this particular command. Those invisible spaces will throw a monkey wrench into the gears, making a mess of an otherwise perfect macro.

     

    If that doesn't work, try my code (it's virtually identical to yours). My sample.txt is on my desktop, so you'll want to either change the directory in the macro, or put your sample.txt on your desktop.

     

    <REM2:use text file in installationPath "textanswers.txt"><TVAR2:05:04:C:\Documents and Settings\z051940\Desktop\sample.txt><REM2:Do all your replaces here; this only example><TMVAR2:21:05:01:001:000:<subtitle_script id='47166'[Script info]^p><TMVAR2:21:05:01:001:000:<style id="49922" name="Style:><DELAY:1><REM2:....all numbers, descending, in between; there's probably a better way...><TMVAR2:17:05:00:000:000:C:\Documents and Settings\z051940\Desktop\sample2.txtT>

     

    As far as the wildcard issue goes, I have to say I'm not completely certain what it is you need to do. Are you calling it a wildcard because it will be different each time the macro runs, and you need the macro to recognize the text that needs to change regardless of what numbers are inside it? If so, it is possible, though it will take a bit more logical code to make the macro work.

     

    I'll take a shot at it and post my results when I have them (at work right now, so it may take a little while).

  14. Copy the range is something I never thought of doing. So the general idea that we are talking about is removing the values from Excel as a range than do the manipulation. I would emagine removing the range would be the same as when I do a cell by puting the range into a variable.

     

    In the past going to a program and using the arrow key to go from cell to cell and doing a variable on each one seemed so easy. But things change.

     

    Bob

    I put the names "John Wilkes Booth" in cells A1, B1, and C1 respectively. I highlighted them all, then did a Ctrl+C copy. At that point I ran this macro:

     

    Variable Set to ASCII Char 9 to %Tab% - I did this because Excel uses TABs when separating cells along a row. ASCII char 9 is TAB, so I assigned ASCII 9 to the variable %Tab%

    Variable Set String %T[1]% from the clipboard contents

    Split String "%T[1]%" on "%Tab%" into Names, starting at 1 - Here I use the variable %Tab% to tell the macro where to make the transition from one array index to the next

    Text Box Display:

    <VARIABLE SET TO ASCII CHAR Value="9" Destination="%Tab%"/>
    <VARIABLE SET STRING Option="\x02" Destination="%T[1]%"/>
    <SPLIT STRING Source="%T[1]%" SplitChar="%Tab%" Dest="Names" Index="1"/>
    <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %Names[1]%\r\n\\par %Names[2]%\r\n\\par %Names[3]%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

     

    This appears to do the trick.

  15. Normal line breaks are carriage-return-line-feed, or x'0D0A' (decimal '1310'). So if your text is in T1, I think this will do it:

    // .... set up CR-LF in T98

    Variable Set %T98% to ASCII Char of 13

    Variable Set %T99% to ASCII Char of 10

    Variable Modify String: Append %T99% to %T98%

    Replace "%T98%" with " " in %T1% [all instances]

    I second that.

     

    Of course, the macro I built above removes them automatically (unless you want them removed from the "some text" section).

  16. First, I have to ask: What version of Macro Express are you using? Your code above looks like Macro Express 3, but this is the Macro Express Pro forum. The help you're looking for is likely going to be different depending on which version you're using..

     

     

    Second, I see you set the installation path to T4, but then you don't do anything with T4. You then set T5 from sample.txt, but we don't know what sample.txt contains (I'm assuming it contains the information from the first "code box" in your post. If that is the case, I don't see any reason why this macro wouldn't be replacing the text you've specified. I just ran the macro (after changing the sample.txt and sample2.txt locations to my desktop for my convenience).

     

    Here are my results, before and after:

    Before

    <subtitle_script id='47166' title='English' play_res_x='640' play_res_y='480' lang_code='enUS' lang_string='English (US)' created='2 days ago' progress_string='' status_string='Approved' wrap_style='2'><styles><style id="49922" name="PLACEHOLDERS"

    After

    <subtitle_script id='47166' title='English' play_res_x='640' play_res_y='480' lang_code='enUS' lang_string='English (US)' created='2 days ago' progress_string='' status_string='Approved' wrap_style='2'><styles><style id="49922" apple="PLACEHOLDERS"

     

    btw, I did this in ME3, based on the code provided.

     

    Edit - Time: 8:07 Mtn

    In the interest of being thorough, I modified the macro to perform exactly the changes you asked specifically about. The macro had no trouble making these changes:

     

    <subtitle_script id='47166' was changed to [script Info]^p

    and

    <style id="49922" name=" was changed to Style:

     

    Well, that's not entirely true. There was a brief moment when the second one didn't work, but that was before I realized that the word "name" had already been changed to "apple", which led to a whole other confusion. Anyway, I disabled the command that changed "name" to "apple" and the macro worked fine. See examples of before and after below.

     

    The question remains: do you want name changed to apple? or do you want <style id="49922" name=" changed to Style:? Or do you want some other combination altogether?

     

    Before

    <subtitle_script id='47166' title='English' play_res_x='640' play_res_y='480' lang_code='enUS' lang_string='English (US)' created='2 days ago' progress_string='' status_string='Approved' wrap_style='2'><styles><style id="49922" name="PLACEHOLDERS"

    After

    [Script info]^p title='English' play_res_x='640' play_res_y='480' lang_code='enUS' lang_string='English (US)' created='2 days ago' progress_string='' status_string='Approved' wrap_style='2'><styles>Style:PLACEHOLDERS"

  17. Why do I will I'm getting a slap on the wrist? This horse is still looking for the water.

     

    Yes I sure am open to a better way for the mouse trap. I keep on getting my finger cought in what used to work.

     

    Bob

    I think part of what Cory is getting at is that this particular issue has been dealt with over and over ad nauseum on both the ME3 boards as well as ME Pro.

     

    Frankly, Excel is a bear to work with directly. It is generally easier to do like Cory suggests and copy the entire range of cells you're trying to manipulate and utilize functions like Text File Process and ASCII File Process commands (or, as he actually suggested, the Split String command).

  18. Thank you all. Now I have to understand how this script works then I'll go for modifying it.

    I'll help you figure it out, since I'm the one who just threw it in there without any explanations :) .

     

    Since I basically just did the same thing over and over and over, I'll just pick apart one section to help you see what I was doing, so you can modify it to suit your specific needs.

     

    // Collect income "xxxx"
    Variable Set Integer %N1% from Position of Text in Variable %T1%
    Variable Modify Integer: %N1% = %N1% + 7
    Variable Set Integer %N2% from Position of Text in Variable %T1%
    Variable Modify Integer: %N3% = %N2% - %N1%
    Variable Modify String: Copy Part of %T1% to %T3%
    Variable Modify String: Trim %T3%
    Variable Modify String: Append %T3% to %T2%
    Variable Modify String: Append "#" to %T2%

    // Collect income "xxxx"

    Variable Set Integer %N1% from Position of Text in Variable %T1% - This sets the value of N1 to the position of "Income:" in the variable T1 (saved from the clipboard). If you started at the P in "Personname" and counted how many characters and spaces before reaching the I in "Income:" you would get the same value.

     

    Variable Modify Integer: %N1% = %N1% + 7 - This counts forward from N1 (the position of I in Income) 7 spaces (because Income: is 7 characters long - including the colon). It sets N1 as this new value. Now, N1 = the position of the space immediately following "Income:"

     

    Variable Set Integer %N2% from Position of Text in Variable %T1% - This sets N2 with the value of the position of the A in "Age:". This is useful to help define the location to the right hand side of the XXXX of "Income".

     

    Variable Modify Integer: %N3% = %N2% - %N1% - This command takes the difference between N2's value and N1's value, and assigns that value to N3. Example: If N1 = 5 and N2 = 12, then N3 = 7. This will be important for the next step.

     

    Variable Modify String: Copy Part of %T1% to %T3% - Here we take T1 (the entire clipboard contents) and we start at the position N1 (the location of the space immediately following "Income:") and we copy N3 characters over. So, if N1=5 and N2=12, then we will be copying 7 characters over from the space after "Income:". Now those 7 characters get saved to variable T3.

     

    Variable Modify String: Trim %T3% - The Trim commands remove spaces from a text variable. So if T3 looks like this: " 9453 ", the trim command will make it look like this: "9453" (without the quotes, of course).

     

    Variable Modify String: Append %T3% to %T2% - This will add T3 to the end of T2 (which I established earlier in the macro - T1 contains the clipboard contents, and T2 receives the modified text). I use "append" rather than "save" because I want to add information, not replace it.

     

    Variable Modify String: Append "#" to %T2% - Because your example used the pound sign "#" as your separator character between each bit of information, I did the same thing. Appending # to the end of T2 after each modification will keep the macro in line with what you are trying to do.

     

    I hope this helps you out!

  19. Hi,

     

    i want to make a makro wich gets text from clipboard, reformates its content and append it to a file. I am not familiar with textprocessing in Macro Express.

     

    The clipboard text is in such a format:

     

    Personname

    (Department)

     

    Income: XXXX Entrydate: XX.XX.XXXX

    Sex: XXX Age: XX

     

    Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-

    Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-

     

    The file should appear like this:

     

    PersonName#Department#XXXX#XX.XX.XXXX#XXX#XX#Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text-Some text...

     

    The formatinglogic isnt so hard but i dont find the right commands in ME to manipulate strings.

     

    Any ideas?

    There are a few different ways to do this. The way I'm going to show you is the longest, yet simplest, way. It's long because it treats each bit of

    information individually. There are more complex processes that you can use which result in a much shorter macro, but it is a bit more complicated

    logically. Since you're new to processing text, I felt it would be better to go with the simpler, if longer, approach.

     

    I used exactly your text from above to build this macro, however it should work fine if "Personname" is replaced by "Gary Strongmore" or if

    "(Department)" is replaced by "(Accounting)" - Note, however, it will not work without the parentheses. Because you put them in your text, I

    built the macro to rely upon them. If your clipboard text does NOT have those parentheses, you'll need to modify the logic, though I'm not in a

    position to instruct you in exactly what direction.

     

    Here it goes:

    <TVAR2:01:03:><REM2:Collect "Personname"><IVAR2:01:13:1:(><NMVAR:02:01:1:0000001:2:0000001><TMVAR2:10:02:01:001:N01:><TMVAR2:01:02:00:000:000:><TMVAR2:07:02:00:000:000:#><REM2:Collect "(Department)"><IVAR2:02:13:1:)><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:03:01:N01:N03:><TMVAR2:21:03:00:000:000:(><TMVAR2:01:03:00:000:000:><TMVAR2:08:02:03:000:000:><TMVAR2:07:02:00:000:000:#><REM2:Collect income "xxxx"><IVAR2:01:13:1:Income:><NMVAR:01:01:1:0000001:2:0000007><IVAR2:02:13:1:Entrydate><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:03:01:N01:N03:><TMVAR2:01:03:00:000:000:><TMVAR2:08:02:03:000:000:><TMVAR2:07:02:00:000:000:#><REM2:Collect entrydate "xx.xx.xxxx"><IVAR2:01:13:1:Entrydate:><NMVAR:01:01:1:0000001:2:0000010><IVAR2:02:13:1:Sex><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:03:01:N01:N03:><TMVAR2:01:03:00:000:000:><TMVAR2:08:02:03:000:000:><TMVAR2:07:02:00:000:000:#><REM2:Collect sex: "xxx"><IVAR2:01:13:1:Sex:><NMVAR:01:01:1:0000001:2:0000004><IVAR2:02:13:1:Age><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:03:01:N01:N03:><TMVAR2:01:03:00:000:000:><TMVAR2:08:02:03:000:000:><TMVAR2:07:02:00:000:000:#><REM2:Collect age "xx"><IVAR2:01:13:1:Age:><NMVAR:01:01:1:0000001:2:0000004><NMVAR:01:02:1:0000001:2:0000007><NMVAR:02:03:1:0000002:1:0000001><TMVAR2:10:03:01:N01:N03:><TMVAR2:01:03:00:000:000:><TMVAR2:08:02:03:000:000:><TMVAR2:07:02:00:000:000:#><REM2:Attach the "some text"><IVAR2:01:12:1><NMVAR:02:03:1:0000001:1:0000002><TMVAR2:10:03:01:N02:N03:><TMVAR2:01:03:00:000:000:><TMVAR2:08:02:03:000:000:><TBOX4:T:1:CenterCenter000278000200:000:T2%T2%>

     

    In the Script Editor it will look something like this:

     

    Variable Set String %T1% from Clipboard
    // Collect "Personname"
    Variable Set Integer %N1% from Position of Text in Variable %T1%
    Variable Modify Integer: %N1% = %N1% - 1
    Variable Modify String: Copy Part of %T1% to %T2%
    Variable Modify String: Trim %T2%
    Variable Modify String: Append "#" to %T2%
    // Collect "(Department)"
    Variable Set Integer %N2% from Position of Text in Variable %T1%
    Variable Modify Integer: %N3% = %N2% - %N1%
    Variable Modify String: Copy Part of %T1% to %T3%
    Replace "(" with "" in %T3%
    Variable Modify String: Trim %T3%
    Variable Modify String: Append %T3% to %T2%
    Variable Modify String: Append "#" to %T2%
    // Collect income "xxxx"
    Variable Set Integer %N1% from Position of Text in Variable %T1%
    Variable Modify Integer: %N1% = %N1% + 7
    Variable Set Integer %N2% from Position of Text in Variable %T1%
    Variable Modify Integer: %N3% = %N2% - %N1%
    Variable Modify String: Copy Part of %T1% to %T3%
    Variable Modify String: Trim %T3%
    Variable Modify String: Append %T3% to %T2%
    Variable Modify String: Append "#" to %T2%
    // Collect entrydate "xx.xx.xxxx"
    Variable Set Integer %N1% from Position of Text in Variable %T1%
    Variable Modify Integer: %N1% = %N1% + 10
    Variable Set Integer %N2% from Position of Text in Variable %T1%
    Variable Modify Integer: %N3% = %N2% - %N1%
    Variable Modify String: Copy Part of %T1% to %T3%
    Variable Modify String: Trim %T3%
    Variable Modify String: Append %T3% to %T2%
    Variable Modify String: Append "#" to %T2%
    // Collect sex: "xxx"
    Variable Set Integer %N1% from Position of Text in Variable %T1%
    Variable Modify Integer: %N1% = %N1% + 4
    Variable Set Integer %N2% from Position of Text in Variable %T1%
    Variable Modify Integer: %N3% = %N2% - %N1%
    Variable Modify String: Copy Part of %T1% to %T3%
    Variable Modify String: Trim %T3%
    Variable Modify String: Append %T3% to %T2%
    Variable Modify String: Append "#" to %T2%
    // Collect age "xx"
    Variable Set Integer %N1% from Position of Text in Variable %T1%
    Variable Modify Integer: %N1% = %N1% + 4
    Variable Modify Integer: %N2% = %N1% + 7
    Variable Modify Integer: %N3% = %N2% - %N1%
    Variable Modify String: Copy Part of %T1% to %T3%
    Variable Modify String: Trim %T3%
    Variable Modify String: Append %T3% to %T2%
    Variable Modify String: Append "#" to %T2%
    // Attach the "some text"
    Variable Set Integer %N1% from Length of Variable %T1%
    Variable Modify Integer: %N3% = %N1% - %N2%
    Variable Modify String: Copy Part of %T1% to %T3%
    Variable Modify String: Trim %T3%
    Variable Modify String: Append %T3% to %T2%
    Text Box Display: T2

  20. Stumped, eh? ;)

    Mostly confused by the question.

     

    Is your audio device an iPod? Zune? 8-track player? Because if so, then yeah, completely stumped, and pretty sure that ME can't affect those devices directly, even if they are hooked into the computer.

     

    If, on the other hand, you are simply referring to WinAmp, Windows Media player, etc., then yes, you can use MEP to manipulate those programs through the applications' own built-in hot-keys or through meticulously defined mouse-movements within the macro.

     

    Macro Express also has commands specifically designed for multimedia manipulation. They're under the "Multimedia" category of commands (shockingly). The commands range from Audio Balance, Mute, Beep, to MIDI Volume controls etc.. From my understanding these commands are very general, affecting the computer settings, rather than those of individual applications. I have personally never had any cause to use any of them other than the Beep command which I have used for diagnostic purposes only.

  21. Just a quick observation: You have a Mouse Left Click command after the window activates. If the mouse is hovering over a different window, that click will cause Excel to lose focus, thereby defeating the rest of the macro.

     

    I will now test your code for my own enjoyment.

     

    Edit

    Your macro doesn't do anything. At least it doesn't do anything like what you're trying to make it do.

     

    Let me explain what your macro is doing, because from there we can work out what to change to make it do what you want it to do.

     

    Window Activate: Microsoft Excel - I see no reason to change this at this time

     

    Mouse Left-Click - You definitely want to make sure the mouse is hovering over Excel when you launch the macro.

     

    Get Mouse Position into (%N[1]%, %N[2]%) Relative to Current Window - This is setting N1 and N2 to the coordinates of the mouse pointer relative to whatever window was underneath the mouse (hopefully Excel).

     

    Delay: 2 seconds - Self explanatory

     

    Mouse Move: 300, 300 Relative to Screen - Here is where I think you're most noticeable mistake is located (hence the RED). This command is moving your mouse pointer to 300 pixels down and 300 pixels over from the top left corner of your screen. I honestly don't know why you programmed that into this macro. Unless you are confident that your Excel window will always be maximized or at least always positioned in the top-left corner. Even then, I don't know why you are moving the mouse to that location. Hovering the mouse right there doesn't do anything.

     

    If, by chance, you want it there so the next time you run the macro, the Mouse Click command highlights the cell located at 300 x 300, then it starts to make sense, except that it will ALWAYS be the same cell at that location, so you won't actually be doing anything productive after the first time you run it.

     

    Delay: 2 seconds - 2 seconds is a pretty big delay for most macros. You might want to reduce these down a little

     

    Get Mouse Position into (%N[1]%, %N[2]%) Relative to Current Window - This just updates the N1 and N2 coordinates to express where 300 x 300 on your screen is relative to the top left corner of your Excel page. I don't know that this would be useful information.

     

    Delay: 2 seconds - again

     

    Text Type (Simulate Keystrokes): <ARROW DOWN><ENTER> - This command is the one command that makes sense to me, considering what you're trying to do. But it won't work if you don't have a cell selected. And even if you do have a cell selected, you'll actually be going down twice (once with the Arrow Down, and again with the Enter).

     

    What I think you probably want to do is drop the Mouse Position commands, because they don't appear to do anything, as well as the Mouse Click command.

     

    As long as a cell is already selected, the following should work flawlessly:

     

    <WINDOW ACTIVATE Title="Microsoft Excel" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <TEXT TYPE Action="0" Text="<ENTER>"/>

     

    Yep, two lines:

    Window Activate: Microsoft Excel
    Text Type (Simulate Keystrokes): <ENTER>

  22. I have a macro that runs every 15 minutes (it does some work on files in a folder). Do I have to lock the player to prevent even that same macro from running again on top of itself? Or will MacroExpress Pro know not to run that same macro again until it was finished? Thanks in advance.

    My experience has been that you cannot run a macro while that macro is running from a previous iteration. Just to test the theory I did what Cory suggested and built a little test macro. My suspicions were confirmed.

  23. 2. I hesitated to insert any sound files in my macros, as I can't use headphones and didn't want to annoy my co-workers with incessant beeping, but today it's just me (for some irritating reason), so I inserted a Beep command at the beginning of the two previously mentioned macros.

     

    The lag appears to have stopped. It's possible that it's just the "luck of the draw" so-to-speak, as it is an inconsistent bug. But I'm going to go ahead and leave the beeps in place for now

     

    Ok, scratch all that.

     

    The macro just lagged, the beep followed the lag. So I'm going to conclude that the lag is within the activation itself.

     

    I guess now I need to follow Kevin's third suggestion and contact Support.

×
×
  • Create New...