-
AuthorPosts
-
May 11, 2012 at 8:39 am #10345
user
Participanthello!
I need a macro that will delete all lines that match any of the regexes that are in a txt file (one below the other)
is this possible?
thanks!
May 14, 2012 at 9:43 am #10352user
ParticipantI think I need to make it more clear:
I am looking for a more convenient way than maintaining a list of:
document.selection.Replace(โ^455.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
I just want to have a list of the regex only and then the command to be the same
thanks
May 15, 2012 at 8:43 am #10354user
Participantinstead of doing the below, is there a way to set a var with the numbers and use a single line?
document.selection.Replace(โ^918.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^919.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^920.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^921.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^922.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^924.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^925.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^926.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^927.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^928.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^929.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^946.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^972.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1093.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1109.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1166.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1185.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1188.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1189.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1190.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1191.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1192.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1193.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1194.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1196.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1198.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1200.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1223.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1436.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1438.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1439.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1440.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1441.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1442.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1443.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1444.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1466.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1469.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1636.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1637.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1638.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1640.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1641.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1648.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1650.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1862.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1871.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1872.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1874.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1875.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1883.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);
document.selection.Replace(โ^1884.*$โ, โโ, eeFindNext | eeFindSaveHistory | eeFindReplaceRegExp | eeReplaceAll);thanks
May 15, 2012 at 5:16 pm #10357Stefan
ParticipantIf it allowed to match ANY number between โ918โ and โ1884โ ?
Then try:
for ( Numb = 918; Numb <= 1884; Numb++){
document.selection.Replace("^" + Numb + ".*$", "", eeFindNext
| eeFindReplaceRegExp | eeReplaceAll);
}
Or the showed numbers only?
.
May 16, 2012 at 8:15 am #10358user
Participantthe shown numbers only
also, in a way that the numbers list will be easily maintained, ie. add and remove entries
thatโs the difficult part :/May 16, 2012 at 11:49 am #10361Stefan
ParticipantHaving e.g. โc:tempnumbers.txtโ with one number at each line.
c:tempnumbers.txt:
123
222
345Use an code like this to read this file into an array.
Then use a FOR loop to process each array indices (0 till highest index)
and inside the FOR loop use the current index to do what you want.
// 1.) helper code to read an files content
//Your file with the numbers, each at an own line:
NumbFile = "c:tempnumbers.txt";
//============================================
fso = new ActiveXObject("Scripting.FileSystemObject");
oFile = fso.OpenTextFile(NumbFile, 1, false, 0);
content = oFile.ReadAll();
oFile.Close();
fso = null;
//alert(content);
//============================================
// 2.) the needed code itself
//For Each Line In Lines Do:
LinesArray = content.split("n");
for (LineNumb = 0; LineNumb < LinesArray.length; LineNumb++){
//do here what you want...
bAnswer = confirm( LinesArray[LineNumb] );
if (bAnswer == false){break;}
}
For more about Javascript FileSystemObject and text files read e.g.:
http://www.ezineasp.net/post/Javascript-FSO-OpenTextFile-Method.aspxMay 16, 2012 at 1:41 pm #10363user
Participantgreat! thanks!
-
AuthorPosts
- The forum โQuestions and Answers about Macrosโ is closed to new topics and replies.