Jump to content
Macro Express Forums

Recommended Posts

Posted

Hello,

 

Joe I just ordered Macros Explained so I eagerly await the reference :)

 

I have a fairly large MACRO and this a portion has me stumped.

what happens is that the macro will run and never return a result, when i know that a one of the words from my list IS in every one of the 3 titles.

 

I have left for over an hour to return, to no result, even though the macro isn't frozen, as I can stop is instantly. I have adjusted speeds and added delays also to no avail.

 

 

***The scanning if one-liner's in txt file is derived from Joe's simple method here Read Random Line From Text File

 

in this portion of the macro I am wanting to

 

1. choose a title randomly from 3 titles of the same line in my example.csv file. (have used for a while w/out any hitches)

 

2. scan my "title_words_to_modify.txt" file randomly, (which contains one word on each line) --Until a word matches up with a word contained in my randomly chosen title from above.

 

**Now it is a possibility that the randomly chosen title will NOT contain ANY of my words in my "title_words_to_modify.txt" in this is a small chance, but still possible... in this case I would like the macro to leave the title "as is" and move on.**

 

3. In the common case that a matching word is found, I would like to add a character(s) from my "characters_to_append.txt" file which contains the character(s) on each line -- to either the beginning or end of the word i.e. *WORD or WORD*

 

4. Then, I would like this modified word inserted back into the title replacing the original word.

 

***********************

The above would be within one days work. The next day I would like to be able to do the same, but to not have the exact same title as end result.

 

each repeat loop created a different titles (originally chosen from one of the 3 per line in the CSV file -- maybe stick titles created from one day into a file and compare them the next dady

 

so the following would be classified as OK

 

Monday = TITLEWORD *SAMETITLEWORD TITLEWORD

Tuesday = TITLEWORD SAMETITLEWORD* TITLEWORD

 

 

That would be all.. as you can see after thinking that couldn't simply modify the current variable, (using the same variable for some repetitive randomizing functions) I started clearing the variable out after each portion.

 

Help would be greatly appreciated, or if I have missed a similar post on this, a reference would be just as appreciated.

 

I have attached the sample files

 

Thank you in Advance!

 

 

Clear All Variables: All


// ASK FOR LINE NUMBER FROM CSV FILE TO START FROM
Variable Set Integer %N1% from Prompt
Variable Modify Integer: %N1% = %N1% - 1
Repeat Prompt Start (Prompt for repeat count at macro play time)
 Variable Modify Integer: %N1% = %N1% + 1
 Wait Time Delay 0.5 Seconds


 // LOAD "T" VARIABLES USED IN CSV FILE
 ASCII File Begin Process: "example.csv" (Comma Delimited Text )
 ASCII File End Process
 Wait Time Delay 0.5 Seconds


 Keystroke Speed: 4 Milliseconds



 // RANDOM TITLE IS CHOSEN BY THE "IF" STATEMENTS
 // AFTER TITLE IS CHOSEN FROM T43, T44, 0R T45 IN CSV FILE
 // AFTER TITLE IS CHOSEN THEN, IT IS PUT INTO A VARIABLE (T46)
 Variable Set Integer %N90% with a Random Number <-- MAX VALUE 2
 If Variable %N90% = 0  
   Variable Set String %T46% "%T43%"
 End If
 If Variable %N90% = 1
   Variable Set String %T46% "%T44%"
 End If
 If Variable %N90% = 2
   Variable Set String %T46% "%T45%"
 End If
 Delay 0.5 Seconds



 // SEARCHES COMMON WORDS UNTIL ONE IS FOUND THAT IS IN CURRENT TITLE
 Repeat Until %T46% Contains %T67%
   Delay 0.5 Seconds
   Clear Integer Variables: From 11 To 11
   Delay 0.5 Seconds
   Clear Integer Variables: From 2 To 2
   Delay 0.5 Seconds
   Clear Text Variables: From 67 To 67
   Delay 0.5 Seconds
   Clear Text Variables: From 70 To 70
   Delay 0.5 Seconds
   Variable Set Integer %N11% to 0
   Text File Begin Process: "title_words_to_modify.txt"
     Variable Modify Integer: Inc (%N11%)
   Text File End Process
   Variable Set Integer %N2% with a Random Number
   Text File Begin Process: "title_words_to_modify.txt"
   Text File End Process
   Wait Time Delay 0.5 Seconds
 Repeat End
 Wait Time Delay 0.5 Seconds
 Clear Integer Variables: From 11 To 11
 Wait Time Delay 0.5 Seconds
 Clear Text Variables: From 70 To 70
 Wait Time Delay 0.5 Seconds


 // CHOOSES RANDOM CHARACTER TO ADD TO COMMON WORD
 Variable Set Integer %N11% to 0
 Text File Begin Process: "characters_to_append.txt"
   Variable Modify Integer: Inc (%N11%)
 Text File End Process
 Variable Set Integer %N2% with a Random Number
 Text File Begin Process: "characters_to_append.txt"
 Text File End Process
 Wait Time Delay 0.5 Seconds
 Clear Integer Variables: From 11 To 11
 Wait Time Delay 0.5 Seconds
 Clear Text Variables: From 70 To 70
 Wait Time Delay 0.5 Seconds


 // APPENDS CHARACTER(s) TO COMMON WORD FOUND ABOVE
 Clear Text Variables: From 69 To 69
 Wait Time Delay 0.5 Seconds
 Variable Set String %T69% "%T67%"



// SETS UP STRUCTURE OF COMMON WORD AND APPENDED CHARACTER (CHARACTER ADDED BEFORE OR AFTER COMMON WORD)
// TO EITHER "COMMON WORD""ADDED CHARACTER"
//                               -OR-
// OR             "ADDED CHARACTER""COMMON WORD"
 Clear Text Variables: From 71 To 71
 Variable Set Integer %N90% with a Random Number
 If Variable %N90% = 0
   Variable Set String %T71% "%T67%%T68%"
 End If
 If Variable %N90% = 1
   Variable Set String %T71% "%T68%%T67%"
 End If



 // REPLACES COMMON WORD IN TITLE W/ MODIFIED WORD IN FROM ABOVE
 Replace "%T69%" with "%T71%" in %T46%
 Wait Time Delay 0.5 Seconds


Repeat End

sample_files.zip

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...