Skip to content

Commit

Permalink
openfile/newfile等のエラー処理を追加
Browse files Browse the repository at this point in the history
ver 9.15 b1で追加されたgetresultex(25)を利用
  • Loading branch information
ohtorii committed Apr 3, 2022
1 parent 3a6b388 commit 4c0fbaf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ hidemaru-editor-script-directory

# 動作環境

- 秀丸エディタ ver 8.91 以降
- 秀丸エディタ ver 9.15 以降

秀丸マクロの**新命令**を利用しているため**必ず上記バージョン以降**をお使いください。

Expand Down
6 changes: 3 additions & 3 deletions internal/main.mac
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ usage:
sources_args : arg1\targ2\narg3

*/
if(version<891){
if(version<915){
message
"秀丸エディタのバージョンが古いためマクロを実行できません。\n" +
"本マクロのドキュメントに記載されたバージョン以降の秀丸エディタをお使いください。";
Expand Down Expand Up @@ -936,8 +936,8 @@ TrimString:
//#region 秀丸の編集画面
NewFile:
newfile;
if(result==0){
#g_open_newfile=false;
if(getresultex(25)){
#g_open_newfile=false;
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion internal/source.mac
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ LoadFileImage:
*/
##current_hidemaru=hidemaruhandle(0);
openfile "/h /n " + $$1;
if(! result){
if(getresultex(25)){
return false;
}
##new_hidemaru=hidemaruhandle(0);
Expand Down
5 changes: 3 additions & 2 deletions kinds/file_base.mac
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ open:
call check_file_exists $$text;
if(##return){
openfile $$text;
if(result){
if(getresultex(25)==false){
//openfileに成功
##new_hidemaru_handle = hidemaruhandle(0);
}
}
}else{
$$message="ファイルを見付けることが出来ませんでした。\nもしかしたら既に削除されているのかもしれません。\n\n(ファイル名)\n" + $$text;
execmacro $$macro_path, "error", $$message;
Expand Down
7 changes: 5 additions & 2 deletions kinds/jump_list.mac
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ open:
##line =dllfuncw(#g_dll_ohtorii_tools,"GetSelectionActionLine",##i);

openfile $$filename;
moveto2 ##column,##line;
##new_hidemaru_handle=hidemaruhandle(0);
if(getresultex(25)==false){
//openfileに成功
moveto2 ##column,##line;
##new_hidemaru_handle=hidemaruhandle(0);
}

setactivehidemaru ##current_hidemaru_handle;
}else{
Expand Down

0 comments on commit 4c0fbaf

Please sign in to comment.