한글 자동화 하기 위해 문제와 해설 분리되어 있는 걸 미주처리하는 매크로를 만들었는데.
찾기기능으로 조건식을 이용하여 숫자중에 맑은 고딕, 굵게 처리된 숫자만 찾도록 설정했습니다.
그런데 실행해보면 원하는 결과가 아닌 굵게 처리되지 않은 맑은 고딕 글꼴의 숫자를 찾게 되어 원하는 결과가 안나오네요.
그런데 따로 찾기기능 매크로를 만들어서 굵게 처리된 맑은 고딕 글꼴을 한번 찾기 실행후 이전 매크로를 실행하면 정상적으로 작동합니다. 어떻게 수정해야 하는지 알고 싶습니다.
// 미주처리 매크로 코드
function OnScriptMacro_모의고사미주처리() {
cnt = InputBox("문항개수는 ?")
var answer = new Array(cnt); //배열정의
for (i = 0; i < cnt; i++) {
//숫자찾기();
숫자찾기("맑은 고딕");
HAction.Run("Cancel");
HAction.Run("MoveRight");
HAction.Run("MoveSelParaEnd");
answer[i] = GetTextFile("HWP","saveblock");//배열에삽입
HAction.Run("Cancel");
}
var solution = new Array(cnt); //배열정의
for (i = 0; i < cnt; i++) {
if (i < cnt - 1) {
//숫자찾기();
숫자찾기("맑은 고딕");
HAction.Run("Delete");
HAction.Run("Delete");
HAction.Run("QuickMarkInsert1");
//숫자찾기();
숫자찾기("맑은 고딕");
HAction.Run("Cancel");
HAction.Run("CloseEx");
HAction.Run("MoveLineBegin");
HAction.Run("MoveLeft");
HAction.Run("Select");
HAction.Run("QuickMarkMove1");
solution[i] = GetTextFile("HWP","saveblock");//배열에삽입
HAction.Run("Delete");
}
else {
//숫자찾기();
숫자찾기("맑은 고딕");
HAction.Run("Delete");
HAction.Run("Delete");
HAction.Run("QuickMarkInsert1");
HAction.Run("MoveTopLevelEnd");
HAction.Run("Cancel");
HAction.Run("MoveLineEnd");
HAction.Run("Select");
HAction.Run("QuickMarkMove1");
solution[i] = GetTextFile("HWP","saveblock");//배열에삽입
HAction.Run("Delete");
}
}
HAction.Run("MoveTopLevelBegin");
//미주달기
for (i = 0; i < cnt; i++) {
//숫자찾기();
숫자찾기("맑은 고딕");
//HAction.Run("CloseEx");
//HAction.Run("MoveSelRight");
HAction.Run("Delete");
HAction.Run("Delete");
HAction.Run("InsertEndnote");
HAction.GetDefault("InsertText", HParameterSet.HInsertText.HSet);
HParameterSet.HInsertText.Text = "[정답] ";
HAction.Execute("InsertText", HParameterSet.HInsertText.HSet);
SetTextFile(answer[i], "HWP", "insertfile");
HAction.Run("MoveParaEnd");
HAction.Run("BreakPara");
HAction.Run("Delete");
SetTextFile(solution[i], "HWP", "insertfile");
HAction.Run("CloseEx");
HAction.Run("MoveLineEnd");
}
}//마지막
function InputBox(prompt, title) {
if (prompt === undefined) prompt = ‘’;
if (title === undefined) title = ‘’;
var script = new ActiveXObject(‘MSScriptControl.ScriptControl’);
script.language = ‘vbscript’;
return script.eval(‘inputbox("’ + prompt + ‘","’ + title + ‘")’);
}
function 숫자찾기(s) {
HAction.GetDefault("RepeatFind", HParameterSet.HFindReplace.HSet);
with (HParameterSet.HFindReplace) {
ReplaceString = "";
FindString = "\z";
IgnoreReplaceString = 0;
IgnoreFindString = 0;
Direction = FindDir("Forward");
WholeWordOnly = 0;
UseWildCards = 0;
SeveralWords = 0;
AllWordForms = 0;
MatchCase = 0;
FindCharShape.FontTypeUser = FontType("TTF");
FindCharShape.FaceNameUser = s;
FindCharShape.FontTypeSymbol = FontType("TTF");
FindCharShape.FaceNameSymbol = s;
FindCharShape.FontTypeOther = FontType("TTF");
FindCharShape.FaceNameOther = s;
FindCharShape.FontTypeJapanese = FontType("TTF");
FindCharShape.FaceNameJapanese = s;
FindCharShape.FontTypeHanja = FontType("TTF");
FindCharShape.FaceNameHanja = s;
FindCharShape.FontTypeLatin = FontType("TTF");
FindCharShape.FaceNameLatin = s;
FindCharShape.FontTypeHangul = FontType("TTF");
FindCharShape.FaceNameHangul = s;
FindCharShape.Bold = 1;//글씨체 bold
ReplaceMode = 0;
ReplaceStyle = "";
FindStyle = "";
FindRegExp = 1;
FindJaso = 0;
HanjaFromHangul = 0;
IgnoreMessage = 1;
FindType = 1;
}
HAction.Execute("RepeatFind", HParameterSet.HFindReplace.HSet);
}
function 숫자찾기() {
HAction.GetDefault("RepeatFind", HParameterSet.HFindReplace.HSet);
with (HParameterSet.HFindReplace) {
ReplaceString = "";
FindString = "\z";
IgnoreReplaceString = 0;
IgnoreFindString = 0;
Direction = FindDir("Forward");
WholeWordOnly = 0;
UseWildCards = 0;
SeveralWords = 0;
AllWordForms = 0;
MatchCase = 0;
ReplaceMode = 0;
ReplaceStyle = "";
FindStyle = "";
FindRegExp = 1;
FindJaso = 0;
HanjaFromHangul = 0;
IgnoreMessage = 1;
FindType = 1;
}
HAction.Execute("RepeatFind", HParameterSet.HFindReplace.HSet);
}
// 숫자찾기 기능만 따로 만든 매크로 코드
function OnScriptMacro_script72() {
숫자찾기("맑은 고딕");
}
function 숫자찾기(s) {
HAction.GetDefault("RepeatFind", HParameterSet.HFindReplace.HSet);
with (HParameterSet.HFindReplace) {
ReplaceString = "";
FindString = "\z";
IgnoreReplaceString = 0;
IgnoreFindString = 0;
Direction = FindDir("Forward");
WholeWordOnly = 0;
UseWildCards = 0;
SeveralWords = 0;
AllWordForms = 0;
MatchCase = 0;
FindCharShape.FontTypeUser = FontType("TTF");
FindCharShape.FaceNameUser = s;
FindCharShape.FontTypeSymbol = FontType("TTF");
FindCharShape.FaceNameSymbol = s;
FindCharShape.FontTypeOther = FontType("TTF");
FindCharShape.FaceNameOther = s;
FindCharShape.FontTypeJapanese = FontType("TTF");
FindCharShape.FaceNameJapanese = s;
FindCharShape.FontTypeHanja = FontType("TTF");
FindCharShape.FaceNameHanja = s;
FindCharShape.FontTypeLatin = FontType("TTF");
FindCharShape.FaceNameLatin = s;
FindCharShape.FontTypeHangul = FontType("TTF");
FindCharShape.FaceNameHangul = s;
FindCharShape.Bold = 1;//글씨체 bold
ReplaceMode = 0;
ReplaceStyle = "";
FindStyle = "";
FindRegExp = 1;
FindJaso = 0;
HanjaFromHangul = 0;
IgnoreMessage = 1;
FindType = 1;
}
HAction.Execute("RepeatFind", HParameterSet.HFindReplace.HSet);
}