satocchiaブログ
2026
2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
1月
2月
3月
4月
5月
6月
7月
8月
9月
10月
11月
12月
全1件 (1件中 1-1件目)
1
inputにタイトルを表示するの新バージョン。前回はinputボックスだけを考えてみたけど、ほかのダイヤログも変えられないかなあと思って。そこで、考えたのは一時UWSCファイルを作って呼び出してみてはどうか。CallSub関数を作ってみたら、結構うまくいきました。第二引数をtrueにすると、サブ側でstdout(出力文字列)を実行することで、呼び出し元に値(文字列オンリー)を返せます。inputの使用例はこんな感じres=CallSub(sample,true)msgbox( res )textblock sample //サブプログラムoption DLGTITLE="入力してください" //ダイヤログタイトルの変更stdout(input( "サブプログラムからの入力プロンプト","既定値",,60,60 ))endtextblockCallSubUwsc.uwsfunction CallSub( AllText, isFunction=false ) fso=CreateOleObj("Scripting.FileSystemObject") repeat tmp=fso.GetTempName tempuws=Copy(tmp, 1, length(tmp)-4)+".uws" tempuws=fso.GetSpecialFolder(2) + "\" + tempuws until !fopen(tempuws, f_exists) if isFunction UWSText=AllText + "<#CR>" + stdout_uws else UWSText=AllText endif fd=fopen( tempuws, f_write16 ) fput( fd, UWSText, f_alltext ) fclose( fd ) UWSCEXE=GET_UWSC_DIR+"\uwsc.exe" if isFunction result=doscmd( UWSCEXE + " " + tempuws +"|more" )//このmoreを外すとなぜかエラーになります。ご注意を。 else exec( UWSCEXE + " " + tempuws ) endif deletefile(tempuws)textblock stdout_uws procedure StdOut(text) with CreateOleObj("Scripting.FileSystemObject") .GetStandardStream( 2 ).WriteLine( text ) endwith fendendtextblockfend
2020.11.25
コメント(0)