satocchiaブログ

satocchiaブログ

PR

×

キーワードサーチ

▼キーワード検索

カレンダー

コメント新着

tomoZo@ Re:Pale Moon日本語化トラブル(06/06) はじめまして。 28.16.0でまたもや提供さ…
satocchia @ Re[1]:Pale Moon日本語化トラブル(06/06) zui_9さんへ 本日、確認しました。ようや…
zui_9 @ Re:Pale Moon日本語化トラブル(06/06) 上記リンク「Githubのプロジェクト」の左…
わたなべ@ Re:powershellコンソール、見づらくありませんか?(08/26) 初めまして、この情報最高です! 背景を白…
y__@ Re:uwscでGUIフォーム(05/12) UWSC 仮掲示板から飛んできました。 HTAで…
2017.12.30
XML
カテゴリ: UWSC
​ 前の ​はWindows.Formsのdatepickerでやったのですが、今回はHTAで。
掲示板方面で、なにやらHTAが盛り上がっているようなので。

HTA.setHTML(html)
repeat
    sleep(0.01)
    getitem( HTA.id, ITM_EDIT, -1 )
    date    =all_item_list[0]
    if (date<>"") and (getstr( HTA.id, 1, str_acc_static )="done") then break

ctrlwin( HTA.id, close )
msgbox( date )
textblock html
<html>
<script>
window.resizeTo( 450, 500 )
</script>
<head>
<!--  カレンダー入力のためJQuerryを読み込む  -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>

<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/pepper-grinder/jquery-ui.css" rel="stylesheet" />
<!--  JQuerry準備終了  -->
</head>
<body>
<div id="ok" style="display:none">waiting</div>

<script>
function ok(){
    document.getElementById( 'ok' ).innerText='done';
}
$(function(){
    $("#datepicker").datepicker({
    numberOfMonths: 1,
    showCurrentAtPos: 1,
    showButtonPanel: true
    });
});</script>
</body>
</html>
endtextblock


module    HTA
    public    id
    public    path
    dim        _temp_hta
    function    setHTML( htmlstring )
        _temp_hta    =CreateFile( htmlstring )
        id            =_temp_hta[ 0 ]
        path        =_temp_hta[ 1 ]
        sleep( 0.1 )
        _clean_atEnd()       
        thread    _close_check( id )
        result        =id
    fend
    procedure    quit()
        while status( id, st_isid )
            ctrlwin( id, close2 )
        wend
        id            =-1
        path        =""
        deletefile( _temp_hta[ 1 ] )
    fend
    procedure    _close_check( _id )    //HTA終了時に一時HTAを消す
        while true
            if !status( _id, st_isid )
                deletefile( _temp_hta[ 1 ] )
                id            =-1
                path        =""
                break
            endif
        wend
    fend
    procedure    _clean_atEnd()    //UWSC終了時に一時HTAを消す
        srcStr        =replace( _clean_atEnd_src, "@@@TEMPHTA@@@", _temp_hta[ 1 ] )
        powershell( srcStr, true )    //powershellのリターンを待たない
textblock _clean_atEnd_src
$uwsc_pid    =gwmi win32_process|?{$_.processId -eq $pid}|%{$_.ParentProcessId}
try{while(ps -id $uwsc_pid -errorAction Stop){}}catch{}
rm "@@@TEMPHTA@@@"
endtextblock
    fend
    function    CreateFile( html, arg="" )        //
        tempHTA        =GetTempFilePath( "hta" )
        fd            =fopen( tempHTA, f_write16 )
        if fd < 0
                msgbox( "一時HTAファイルの作成に失敗しました" )
                exitexit
        endif
        fput( fd, html, f_alltext )
        flg        =fclose( fd, true )                //エラー処理は自前で
        if !flg
                msgbox( "一時HTAファイルの作成に失敗しました" )
                exitexit
        endif
        id        =exec( "mshta " + tempHTA + " " + arg )
        result    =split( id + "<#cr>" + tempHTA, "<#cr>" )
    fend
    function    getTempFilePath( ext="tmp" )
        result=powershell( replace( this.src, "<EXT>", ext ))
        textblock src
                do{
                    rm ($tmp=[system.io.path]::GetTempFileName())
                    $tmp=join-path ( split-path $tmp ) ( [system.io.path]::GetFileNameWithoutExtension($tmp) + ".<EXT>" )
                    $tmp=$tmp -replace "[.]+$",""
                }while( test-path $tmp )
                $tmp
        endtextblock
    fend   
endmodule





お気に入りの記事を「いいね!」で応援しよう

最終更新日  2017.12.30 12:05:46コメント(0) | コメントを書く
[UWSC] カテゴリの最新記事


【毎日開催】
15記事にいいね!で1ポイント
10秒滞在
いいね! -- / --
おめでとうございます!
ミッションを達成しました。
※「ポイントを獲得する」ボタンを押すと広告が表示されます。
x
X

© Rakuten Group, Inc.
X
Design a Mobile Site
スマートフォン版を閲覧 | PC版を閲覧
Share by: