GR666N
Senior Member
Tình hình là e nhờ thằng ChatGPT viết hộ mấy cái macro EmEditor mà toàn bị lỗi không chạy được, đành lên đây nhờ các bác biết code macro Emeditor/Python giúp ợ
Dữ liệu của e có dạng thế này: https://files.catbox.moe/o550dm.txt
Macro 1: Xóa toàn bộ địa chỉ email có từ khóa trong file blacklist txt
Còn đây là macro do thằng ChatGPT code
Macro 2: Dòng nào có nhiều email thì tách thành các dòng giống nhau nhưng chỉ chứa 1 email
Macro do thằng ChatGPT code
Em xin cám ơn nhìu ợ 
Dữ liệu của e có dạng thế này: https://files.catbox.moe/o550dm.txt
Macro 1: Xóa toàn bộ địa chỉ email có từ khóa trong file blacklist txt
Mã:
blacklist.txt có nội dung thế này
sales
yahoo
hotmail
sale@
vozer@
...
JavaScript:
// Ask for the location of the blacklist file
var strBlacklistFile = document.GetFilename( eeDlgOpen, "", "Text Files (*.txt)|*.txt||", "Select the Blacklist file" );
if( strBlacklistFile == "" ){
alert( "No file selected" );
return;
}
// Read the blacklist file into an array
var arrBlacklist = new Array();
var objFS = new ActiveXObject( "Scripting.FileSystemObject" );
var objFile = objFS.OpenTextFile( strBlacklistFile, 1 );
while( !objFile.AtEndOfStream ){
var strLine = objFile.ReadLine();
if( strLine != "" ) arrBlacklist.push( strLine );
}
objFile.Close();
// Define the regular expression pattern to match email addresses
var reEmail = /[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/i;
// Loop through each line of the document and remove any emails that match the blacklist
document.selection.StartOfDocument();
while( !document.selection.EndOfDocument ){
if( document.selection.Find( reEmail ) ){
var strEmail = document.selection.Text;
for( var i = 0; i < arrBlacklist.length; i++ ){
if( strEmail.indexOf( arrBlacklist[i] ) >= 0 ){
document.selection.Delete();
break;
}
}
}else{
break;
}
}
// Alert when finished
alert( "Done" );
Macro 2: Dòng nào có nhiều email thì tách thành các dòng giống nhau nhưng chỉ chứa 1 email
Macro do thằng ChatGPT code
JavaScript:
// Define the regular expression pattern to match email addresses
var reEmail = /[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}/ig;
// Loop through each line of the document and split any lines that contain multiple emails
document.selection.StartOfDocument();
while( !document.selection.EndOfDocument ){
var strLine = document.selection.Text;
if( reEmail.test( strLine ) ){
var arrMatches = strLine.match( reEmail );
for( var i = 0; i < arrMatches.length; i++ ){
document.selection.Text = arrMatches[i] + "\n";
document.selection.LineDown();
}
}
document.selection.LineDown();
}
// Alert when finished
alert( "Done" );

Sửa lần cuối:
