この設定を行うと、インターネットにあるページからでも、Windows のディスクやリソースに直接アクセスが可能になります( ActiveX を使用します )。よく利用されるのは、Excel へのアクセスですが、 ローカルネットワークのデータベースにもアクセスが可能です。![]()
✅ インターネット上の任意のサイトを信頼して追加します
※ ここでは localhost です。インターネット上は 自分のサイト か 業務上のサイト になります![]()
![]()
✅ ActiveX の使用を許可します( この設定で多くの処理が可能になります )
![]()
✅ 以下は ADO でのデーターベースアクセスに必要です
![]()
✅ クリップボードからの貼り付けができるのは IE11 のみです。
通常でもクリップボードへのコピーは可能で、他のブラウザでもクリップボードへのコピーは可能です。18年前より IE を使用して、イントラネットの IIS のページ上に表示されたデータを Excel に転送して印刷に使うという処理を今も続けています。Excel でフォーマットを作っておくと、イレギュラーが発生しても Excel を直接変更すれば対応可能です。 大量な単独データが印刷が必要な場合はさすがに PDF( TCPDF ) を使用していますが、単票なら Excel に勝るものはありません。 IIS のタイムアウトを避けるような処理であれば、ADO で直接データーベースにアクセスして様々なデータをローカルに出力できます。 また、Excel のデータを複数セルでコピーして、IE11 の入力フィールドに貼り付けたり直接初期データを登録する事も可能になります。 さらにこれらのページ処理は、HTML だけで完結できる場合は拡張子を .hta として使う事もできます( 最初から HTA 目的で作成するのならば、IE11 の設定は必要ありませんが、HTA のデフォルトを最新にしておく為の META 要素が必要になります。 )
<meta http-equiv="x-ua-compatible" content="ie=edge">❎ 注意事項として、IE11 のデフォルト状態では、VBSCript は利用できないので、VBScript が必要な場合は META 要素で IE10 以下を設定する必要があります。<meta http-equiv="X-UA-Compatible" content="IE=8">関連する記事
IE11 で VBScript のクラスを使用して Excel(Excel.Application) の処理を検証 HTML Application : JavaScript で新しい Excel の Book を作成するIE11 上でコマンドプロントを模したページ
コマンドプロンプト on IE11( サイトを信頼して設定した場合 )![]()
関連する記事
HTA / ADO / Jscript : Access( .accdb .mdb ) の読み込みと表示
2020年11月14日
IE11 を アプリケーションのプラットホームとして使う為の3つの設定
2020年11月12日
HTA / ADO / Jscript : Access( .accdb .mdb ) の読み込みと表示
データベースは Access です。こちらからダウンロードしてください。ダウンロードして解凍した .accdb または .mdb へのパスは以下のようにしてソースコード上で固定で設定していますvar db_path = "C:\\temp\\hanbaic.accdb";ドライバが無い場合はこちらからダウンロードして AccessDatabaseEngine.exe を実行します ※ HTA は 32ビットです
この HTA を localhost の IE11 で実行する事ができます。その場合は、IE11 の設定が必要です。その方法はこちらをご覧ください。 ※ IE11 で動かす最も大きな目的は、開発者ツールでデバッグができるからです。
<!DOCTYPE html> <html> <head> <!-- edge : 主に hta 用 / VBScript を混在する場合は IE11 で IE10 ) --> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta charset="utf-8"> <title>utf-8 ADO 問合せ処理</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.css"> <script> // *********************** // カンマ編集 // *********************** String.prototype.number_format = function (prefix) { var num = this.valueOf(); prefix = prefix || ''; num += ''; var splitStr = num.split('.'); var splitLeft = splitStr[0]; var splitRight = splitStr.length > 1 ? '.' + splitStr[1] : ''; var regx = /(\d+)(\d{3})/; while (regx.test(splitLeft)) { splitLeft = splitLeft.replace(regx, '$1' + ',' + '$2'); } return prefix + splitLeft + splitRight; } // *********************** // カンマ編集削除 // *********************** String.prototype.remove_number_format = function () { var num = this.valueOf(); return num.replace(/([^0-9\.\-])/g, ''); } // ******************************************************** // ADO オブジェクト // 3 : クライアント側カーソル // https://docs.microsoft.com/ja-jp/sql/ado/reference/ado-api/cursorlocationenum // ******************************************************** var cn = new ActiveXObject( "ADODB.Connection" ); cn.CursorLocation = 3; var rs = new ActiveXObject( "ADODB.Recordset" ); // *********************** // このパスを変更 // *********************** var db_path = "C:\\temp\\hanbaic.accdb"; // *********************** // ******************************************************** // https://www.microsoft.com/ja-jp/download/details.aspx?id=13255 ( ドライバ ) // 接続文字列 : ODBC用 // https://docs.microsoft.com/ja-jp/dotnet/api/system.data.odbc.odbcconnection.connectionstring // ******************************************************** var connection_string = "Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" + db_path + ";"; // *********************** // エラー制御 // *********************** var error_flg = false; // *********************** // 実行 SQL // *********************** var query = "select * from 社員マスタ"; $(function(){ // ************************************** // Windows を中央に移動 // ************************************** var target = window.location + ""; if ( target.indexOf("file:") != -1 ) { try { var w = screen.width - 400; var h = screen.height - 200; top.resizeTo( w, h ); top.moveTo((screen.width-w)/2, (screen.height-h)/2 ); } catch( e ) {} } // ************************************** // ADO 処理( ここから ) // ************************************** try { // *********************** // DB 接続 // *********************** cn.open( connection_string ); } catch (e) { error_flg = true; alert(e.description); } if ( error_flg ) { return; } try { // *********************** // レコードセット取得 // *********************** rs.open( query, cn ); } catch (e) { error_flg = true; alert(e.description); } var table_body = $("#tbl"); var row_unit = $("<tr></tr>"); // *********************** // タイトル部用、列名取得 // *********************** for( loop_idx = 0; loop_idx < rs.fields.count; loop_idx++ ) { $("<th></th>") .text( rs.fields(loop_idx).name ) .appendTo( row_unit ); } row_unit.appendTo( table_body ); // *********************** // 行取得ループ // *********************** while( !rs.EOF ) { // 行オブジェクト row_unit = $("<tr></tr>"); // ********************************************* // 列オブジェクトを作成して行オブジェクトに追加 // ********************************************* $("<td></td>") .text( rs.fields("社員コード").value ) .appendTo( row_unit ); $("<td></td>") .text( rs.fields("氏名").value ) .appendTo( row_unit ); $("<td></td>") .text( rs.fields("フリガナ").value ) .appendTo( row_unit ); $("<td></td>") .text( rs.fields("所属").value ) .appendTo( row_unit ); $("<td></td>") .text( rs.fields("性別").value ) .appendTo( row_unit ); date_work = new Date( rs.fields("作成日").value ); date_string = date_work.getFullYear() + "/" + (date_work.getMonth()+1) + "/" + date_work.getDate(); $("<td></td>") .text( date_string ) .appendTo( row_unit ); date_work = new Date( rs.fields("更新日").value ); date_string = date_work.getFullYear() + "/" + (date_work.getMonth()+1) + "/" + date_work.getDate(); $("<td></td>") .text( date_string ) .appendTo( row_unit ); $("<td></td>") .text( rs.fields("給与").value ) .appendTo( row_unit ); $("<td></td>") .text( rs.fields("手当").value ) .appendTo( row_unit ); $("<td></td>") .text( rs.fields("管理者").value ) .appendTo( row_unit ); date_work = new Date( rs.fields("生年月日").value ); date_string = date_work.getFullYear() + "/" + (date_work.getMonth()+1) + "/" + date_work.getDate(); $("<td></td>") .text( date_string ) .appendTo( row_unit ); // 行オブジェクトを テーブルオブジェクトに追加 row_unit.appendTo( table_body ); // *********************** // 次の行を取得 // *********************** rs.MoveNext(); } // *********************** // レコードセットを閉じる // *********************** rs.close(); // *********************** // 接続解除 // *********************** cn.close(); // *********************** // オブジェクトの解放 // *********************** cn = null; // ************************************** // ADO 処理( ここまで ) // ************************************** // ************************************** // テーブルに対する処理 // ************************************** $("#tbl tr").each(function(idx){ // ************************************** // イベント登録 // ************************************** $(this).on("dblclick", function(idx){ var text = ""; $(this).find("td").each(function(idx){ console.log( idx + ":" + $(this).text() ); if ( idx == 7 || idx == 8 ) { text += idx + ":" + ($(this).text()).remove_number_format() + " "; } else { text += idx + ":" + $(this).text() + " "; } }); $("#result").text( text ); }); // ************************************** // データ部分のフォーマットと右寄せ // ************************************** $(this).find("td").each(function(idx){ switch( idx ) { case 7: $(this).css({"text-align": "right" }); $(this).text( ($(this).text()).number_format() ); break; case 8: $(this).css({"text-align": "right" }); $(this).text( ($(this).text()).number_format() ); break; } }); // ************************************** // タイトル部分の右寄せ // ************************************** $(this).find("th").each(function(idx){ switch( idx ) { case 7: $(this).css({"text-align": "right" }); break; case 8: $(this).css({"text-align": "right" }); break; } }); }); // ************************************** // テーブルに対する処理 // ************************************** }); </script> <style> /* **************************** 1) 列のカーソルは常に矢 2) 改行コードを有効 ******************************/ td,th { cursor: default!important; white-space: pre; } body { margin: 0; padding: 16px; } /* **************************** テーブル内のデータを選択不可 ( ダブルクリック対応 ) ******************************/ #tbl { user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } /* **************************** スクロール無しの状態時の 最上部にデータ表示場所を用意 ******************************/ table { margin-top: 36px; } /* **************************** ダブルクリック時に内容を表示 するブロックの表示方法 ******************************/ #result { font-weight: bold; /* 太文字 */ color: navy; /* 文字色 */ position: fixed; /* 表示位置固定 */ height: 34px; /* ブロック高さ */ background-color: #fff; /* ブロック背景色 */ padding: 5px; /* ブロック内側余白 */ } </style> </head> <body> <!-- ダブルクリックの結果を表示する / fixed で位置固定 --> <div id="result"></div> <table class="table table-hover"> <!-- bootstrap 対応の為、tbody に対して処理 --> <tbody id="tbl"> </tbody> </table> </body> </html>
以下は、列情報を自動取得しています ( ※ 自由な SELECT 文で表示可能です )
<!DOCTYPE html> <html> <head> <!-- edge : 主に hta 用 / VBScript を混在する場合は IE11 で IE10 ) --> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta charset="utf-8"> <title>utf-8 ADO 問合せ処理</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.css"> <script> // *********************** // カンマ編集 // *********************** String.prototype.number_format = function (prefix) { var num = this.valueOf(); prefix = prefix || ''; num += ''; var splitStr = num.split('.'); var splitLeft = splitStr[0]; var splitRight = splitStr.length > 1 ? '.' + splitStr[1] : ''; var regx = /(\d+)(\d{3})/; while (regx.test(splitLeft)) { splitLeft = splitLeft.replace(regx, '$1' + ',' + '$2'); } return prefix + splitLeft + splitRight; } // *********************** // カンマ編集削除 // *********************** String.prototype.remove_number_format = function () { var num = this.valueOf(); return num.replace(/([^0-9\.\-])/g, ''); } // ******************************************************** // ADO オブジェクト // 3 : クライアント側カーソル // https://docs.microsoft.com/ja-jp/sql/ado/reference/ado-api/cursorlocationenum // ******************************************************** var cn = new ActiveXObject( "ADODB.Connection" ); cn.CursorLocation = 3; var rs = new ActiveXObject( "ADODB.Recordset" ); // *********************** // このパスを変更 // *********************** var db_path = "C:\\temp\\hanbaic.accdb"; // *********************** // ******************************************************** // https://www.microsoft.com/ja-jp/download/details.aspx?id=13255 ( ドライバ ) // 接続文字列 : ODBC用 // https://docs.microsoft.com/ja-jp/dotnet/api/system.data.odbc.odbcconnection.connectionstring // ******************************************************** var connection_string = "Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=" + db_path + ";"; // *********************** // エラー制御 // *********************** var error_flg = false; // *********************** // 実行 SQL // *********************** var query = "select * from 得意先マスタ"; $(function(){ // ************************************** // Windows を中央に移動 // ************************************** var target = window.location + ""; if ( target.indexOf("file:") != -1 ) { try { var w = screen.width - 400; var h = screen.height - 200; top.resizeTo( w, h ); top.moveTo((screen.width-w)/2, (screen.height-h)/2 ); } catch( e ) {} } // ************************************** // ADO 処理( ここから ) // ************************************** try { // *********************** // DB 接続 // *********************** cn.open( connection_string ); } catch (e) { error_flg = true; alert(e.description); } if ( error_flg ) { return; } try { // *********************** // レコードセット取得 // *********************** rs.open( query, cn ); } catch (e) { error_flg = true; alert(e.description); } var table_body = $("#tbl"); var row_unit = $("<tr></tr>"); var typeArray = []; // *********************** // タイトル部用、列名取得 // *********************** for( loop_idx = 0; loop_idx < rs.fields.count; loop_idx++ ) { $("<th></th>") .text( rs.fields(loop_idx).name ) .appendTo( row_unit ); typeArray.push( rs.fields(loop_idx).type ); } row_unit.appendTo( table_body ); // *********************** // 行取得ループ // データ型 // https://docs.microsoft.com/ja-jp/sql/ado/reference/ado-api/datatypeenum // *********************** while( !rs.EOF ) { // 行オブジェクト row_unit = $("<tr></tr>"); for( loop_idx = 0; loop_idx < rs.fields.count; loop_idx++ ) { if( typeArray[loop_idx] == 133 || typeArray[loop_idx] == 135 ) { var date_work = new Date( rs.fields(rs.fields(loop_idx).name).value ); var date_string = date_work.getFullYear() + "/" + (date_work.getMonth()+1) + "/" + date_work.getDate(); $("<td></td>") .text( date_string ) .appendTo( row_unit ); } else { $("<td></td>") .text( rs.fields(rs.fields(loop_idx).name).value ) .appendTo( row_unit ); } } row_unit.appendTo( table_body ); // *********************** // 次の行を取得 // *********************** rs.MoveNext(); } // *********************** // レコードセットを閉じる // *********************** rs.close(); // *********************** // 接続解除 // *********************** cn.close(); // *********************** // オブジェクトの解放 // *********************** cn = null; // ************************************** // ADO 処理( ここまで ) // ************************************** // ************************************** // テーブルに対する処理 // ************************************** $("#tbl tr").each(function(idx){ // ************************************** // イベント登録 // ************************************** $(this).on("dblclick", function(idx){ var text = ""; $(this).find("td").each(function(idx){ console.log( idx + ":" + $(this).text() ); text += idx + ":" + $(this).text() + " "; }); $("#result").text( text ); }); // ************************************** // データ部分のフォーマットと右寄せ // ************************************** $(this).find("td").each(function(idx){ if ( typeArray[idx] == 3 ) { $(this).css({"text-align": "right" }); $(this).text( ($(this).text()).number_format() ); } }); // ************************************** // タイトル部分の右寄せ // ************************************** $(this).find("th").each(function(idx){ if ( typeArray[idx] == 3 ) { $(this).css({"text-align": "right" }); } }); }); // ************************************** // テーブルに対する処理 // ************************************** }); </script> <style> /* **************************** 1) 列のカーソルは常に矢 2) 改行コードを有効 ******************************/ td,th { cursor: default!important; white-space: pre; } body { margin: 0; padding: 16px; } /* **************************** テーブル内のデータを選択不可 ( ダブルクリック対応 ) ******************************/ #tbl { user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } /* **************************** スクロール無しの状態時の 最上部にデータ表示場所を用意 ******************************/ table { margin-top: 36px; } /* **************************** ダブルクリック時に内容を表示 するブロックの表示方法 ******************************/ #result { font-weight: bold; /* 太文字 */ color: navy; /* 文字色 */ position: fixed; /* 表示位置固定 */ height: 34px; /* ブロック高さ */ background-color: #fff; /* ブロック背景色 */ padding: 5px; /* ブロック内側余白 */ } </style> </head> <body> <!-- ダブルクリックの結果を表示する / fixed で位置固定 --> <div id="result"></div> <table class="table table-hover"> <!-- bootstrap 対応の為、tbody に対して処理 --> <tbody id="tbl"> </tbody> </table> </body> </html>
2020年11月02日
ロリポップ用ログインブックマークレット( ユーザ専用ページ・phpMyAdmin・WEBメーラ )
※ パスワード等の情報をブラウザに保存するので、自宅の PC で利用してください ✅ ユーザ専用ページ ✅ phpMyAdmin ✅ WEBメーラユーザ専用ページ
ドメインID は自分のアカウントです。ドメイン番号は、ロリポップで選んだ自分のドメインをコンボボックスで選択して Chrome の コンソールで以下のように入力してください
$("#domain-id").val()※ 画像の例ですと、410 をドメイン番号と差し替えます
javascript:$("input[name='account']").val("ドメインID");$('#domain-id').val(ドメイン番号);$("input[name='passwd']").val("パスワード");jf_Login();
出来上がったコードを ブックマークバーに適当に作成したブックマークの URL に入力すると使用可能になりますphpMyAdmin
アカウント文字列は ユーザー名( DB ページでの呼び名 )です。サーバの選択は自分のサーバをコンボボックスで選択して Chrome の コンソールで以下のように入力してください
$("#select_server").val()※ 画像の例ですと、192 をサーバー番号と差し替えます
javascript:$('#select_server').val(サーバー番号);$('#input_username').val("アカウント文字列");$('#input_password').val("パスワード");$('#input_go').click();
WEBメーラ
![]()
javascript:document.getElementsByName("mail_add")[0].value="メールアドレス";document.getElementsByName("mail_pass")[0].value="パスワード";jf_LoginMail();
Seesaa の各ページの表示について
Seesaa の 記事がたまに全く表示されない場合があります。その場合は、設定> 詳細設定> ブログ設定 で 最新の情報に更新の『実行ボタン』で記事やアーカイブが最新にビルドされます。 Seesaa のページで、アーカイブとタグページは要注意です。タグページはコンテンツが全く無い状態になりますし、アーカイブページも歯抜けページはコンテンツが存在しないのにページが表示されてしまいます。 また、カテゴリページもそういう意味では完全ではありません。『カテゴリID-番号』というフォーマットで表示されるページですが、実際存在するより大きな番号でも表示されてしまいます。 ※ インデックスページのみ、実際の記事数を超えたページを指定しても最後のページが表示されるようです 対処としては、このようなヘルプ的な情報を固定でページの最後に表示するようにするといいでしょう。具体的には、メインの記事コンテンツの下に『自由形式』を追加し、アーカイブとカテゴリページでのみ表示するように設定し、コンテンツを用意するといいと思います。※ エキスパートモードで表示しています アーカイブとカテゴリページはこのように簡単に設定できますが、タグページは HTML 設定を直接変更して、以下の『タグページでのみ表示される内容』の記述方法で設定する必要があります
<% if:page_name eq 'archive' -%> アーカイブページでのみ表示される内容 <% /if %> <% if:page_name eq 'category' -%> カテゴリページでのみ表示される内容 <% /if %> <% if:page_name eq 'tag' -%> タグページでのみ表示される内容 <% /if %>この記述は、以下の場所で使用します![]()
|