오늘 갑자기 그전까지는 잘 사용하고 있던 매크로들이 실행을 하면 한글이 종료가 됩니다.
다른 컴에서는 잘 되는 매크로 입니다.
그래서 한글을 완전삭제하고 재설치 후 업데이트까지 마친후 다시 시도해도 같은 증상이네요.
모든 매크로가 안되는 건 아니고 아래 코드처럼 수식의 속성을 제어하러 들어가는 매크로만 안됩니다.
function OnScriptMacro_EA로만체로_정규식버젼()
{
Num=0 //1이면 행렬수정, 0이면 일반수식
//수식을 찾기
HAction.GetDefault("Goto", HParameterSet.HGotoE.HSet);
with (HParameterSet.HGotoE)
{
HSet.SetItem("DialogResult", 37); //37이 수식을 의미하는 숫자
SetSelectionIndex = 5;
}
HAction.Execute("Goto", HParameterSet.HGotoE.HSet);
FindCtrl();
//수식속성으로 들어가서 내부 명령어 수정하기
HAction.GetDefault("EquationPropertyDialog", HParameterSet.HShapeObject.HSet);
with (HParameterSet.HShapeObject)
{
BaseUnit = PointToHwpUnit(11.0);// 수식 크기 11부분을 수정하면 원하는 크기가 됩니다.
HSet.SetItem("ShapeType", 3);
//기본 명령어 중에 대문자이지만 바꾸면 안되는 것들을 미리 소문자로 바꾸는 부분
String =String.replace( /`/g,"" );
String =String.replace( /\s/g,"" );
String =String.replace( /,~/g,"," );
String =String.replace( /,/g,",~" );
String =String.replace( /LEFT/g,"left" );
String =String.replace( /left/g," left" );
String =String.replace( /bold/g,"" );
String =String.replace( /rm/g,"" );
String =String.replace( /it/g,"" );
String =String.replace( /THEREFORE/g,"therefore" );
String =String.replace( /SMALLINTER/g,"`cap" );
String =String.replace( /RIGHT/g,"right" );
String =String.replace( /right/g,"`right" );
String =String.replace( /INF/g,"inf" );
String =String.replace( /inf/g,"`inf" );
String =String.replace( /INT/g,"int" );
String =String.replace( /IN/g,"in" );
String =String.replace( /\bin/g,"`in" );
String =String.replace(/sintheta/g, 'sin`theta');
String =String.replace( /int/g,"`i_tegral" )
.replace( /in/g,"`in" )
.replace( /i_tegral/g,"`int" );
String =String.replace( /s`in/g,"sin" );
String =String.replace( /CUP/g,"`cup`" );
String =String.replace( /CAP/g,"`cap`" );
String =String.replace( /GEQ/g," geq" );
String =String.replace( /geq/g,"`geq" );
String =String.replace( /ge/g,"`ge" );
String =String.replace( /CDOTS/g,"`cdots" );
String =String.replace( /cdots/g,"`cdots" );
String =String.replace( /CDOT/g,"`cdot" );
String =String.replace( /cdot/g,"`cdot" );
String =String.replace( /BOT/g,"`bot" );
String =String.replace( /BULLET/g,"`cdot" );
String =String.replace( /TRIANGLE/g,"triangle`" );
String =String.replace( /LEQ/g," leq" );
String =String.replace( /leq/g,"`leq" );
String =String.replace( /left/g,"_LEFT_" ); //left의 le변형안하기 위해서 중간에 잠시 바꿔두는 코드
String = String.replace(/angle/g, "ang_temp")
.replace(/le/g, "`le")
.replace(/ang_temp/g, "angle");
//String =String.replace( /le/g,"`le " );
String =String.replace( /_LEFT_/g,"left" );
String =String.replace( /ANGLE/g,"`angle`" );
String =String.replace( /DEG/g,"°" );
String =String.replace( /Deg/g,"°" );
String =String.replace( /TIMES/g,"`times" );
String =String.replace( /BAR/g,"bar" );
//String = String.replace(/bar([A-Z]*)/g, "bar{$1}");//중괄호 생략된 선분기호 수정
//String = String.replace(/vec([A-Z]*)/g, "vec{$1}");//중괄호 생략된 벡터기호 수정
String =String.replace( /BOX/g,"box" );
String =String.replace( /vert/g,"``vert``" );
String =String.replace( /rarrow/g,"`rarrow" );
String =String.replace( /larrow/g,"`arrow" );
String =String.replace( /LRARROW/g,"`LRARROW" );
String =String.replace( /sqrt/g,"`sqrt" );
String =String.replace( /sin/g,"`sin" );
String =String.replace( /cos/g,"`cos" );
String =String.replace( /not=/g,"`not=" );
String =String.replace( /ne/g,"`ne" );
String =String.replace( /tan/g,"`tan" );
String =String.replace( /sec/g,"`sec" );
String =String.replace( /ln/g,"`ln" );
String =String.replace( /log/g,"`log" );
String =String.replace( /prime/g,"`prime" );
String =String.replace( /alpha/g,"`alpha" );
String =String.replace( /beta/g,"`beta" );
String =String.replace( /gamma/g,"`gamma" );
String =String.replace( /delta/g,"`delta" );
String =String.replace( /xi/g,"x` i" );
String =String.replace(/pi/g, '`pi');
String =String.replace(/&~/g, '&');
String =String.replace(/&/g, '&~');
String =String.replace(/•/g, 'cdot');
String =String.replace(/dtheta/g, 'd`theta');
String =String.replace(/:/g, '``:``');
if(Num==0)
{
//대문자 문자열 앞뒤에 rm it붙이는 명령어
String = String.replace(/[A-Z]+/g, function(match) {
if (match === 'X'| match==='Y'|match==='Z') {
return match; // 'X'만 있는 경우는 수정하지 않음
} else {
return ' rm`' + match + '`it'; // 대문자로 시작하는 단어에 접두사와 접미사를 붙여 'rm'으로 바꿈
}
});
//P([A-Z])꼴은 괄호 안에 있는 rm 제거
String = String.replace(/P[^)]*\([^)]*\)/g, function(match) {
return match.replace(/\s*rm\`\s*/g, '');
});
/*String = String.replace(/\([^)]*\)/g, function(match) {
return match.replace(/\s*\`it/g, '');//이 코드를 실행하면 괄호 안에 it 삭제 대신 뒤에 소문자가 로만체가 되어버림
});*/
}
String =String.replace(/``/g, '`');
}
HAction.Execute("EquationPropertyDialog", HParameterSet.HShapeObject.HSet);
UnSelectCtrl();
HAction.Run("MoveRight");
}