Jump to content
Macro Express Forums

pantho

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by pantho

  1. 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

     

    After

     

     

    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

    CODE
    <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"[/code]

    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"

     

    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.

  2. I am wanting to edit text files, but I want to edit alot of files, and alot of strings in those files. So I come back to my old love Macro Express... Sadly I never really used it for much more than mouse clicks/text input.

     

    So, an example of what I want to edit:

     

    <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"

    <subtitle_script id='47166' I want to replace with: [script Info]^p

    <style id="49922" name=" I want to replace with: Style:

     

    1st Problems: For some reason, even trying to simply replace the word "play" with "apple" is not working, It is loading the file into T5 and then from there it is saving it to sample2.txt as it is supposed to :/

     

    2nd Problem: How do I make wildcards as the ID 47166 is a random number depending which file I want to replace (plan to run macro on 50+ files to start with)

     

    <VSETMISC:T4:Installation Path><REM2:use text file in installationPath "textanswers.txt"><TVAR2:05:04:C:\Program Files\Macro Express3\sample.txt><REM2:Do all your replaces here; this only example><TMVAR2:21:05:01:001:000:nameapple><DELAY:1><REM2:....all numbers, descending, in between; there's probably a better way...><TMVAR2:17:05:00:000:000:C:\Users\Pantho\Documents\sample2.txtT>

    Set Variable %T4% to "Installation Path"
    // use text file in installationPath "textanswers.txt"
    Variable Set String %T5% from File: "sample.txt"
    // Do all your replaces here; this only example
    Replace "name" with "apple" in %T5%
    Delay 1 Seconds
    // ....all numbers, descending, in between; there's probably a better way...
    Variable Modify String: Save %T5% to Text File

     

    This is what I have found so far, from reading related topics. Any help you can with the first 2 search and replace commands would be great, then I could use those examples to finish the rest.

×
×
  • Create New...