#include "hspext.as" #include "url.as" #include "inictl.as" ;「google-cache clip」ver2.00 (2004/04/23) ;------------------------------------------------ ;本体の表示(共通) sdim clip,300 ;バッファ確保 sdim useurl,10 ;バッファ確保 sdim uselang,40 ;バッファ確保 sdim url,10,11 ;配列変数の宣言 ini_file "google.ini" ;iniファイル名の指定 ini_section "google" ;iniセクション名[google] ini_getint nowin,"nowin" ;ウインドウ非表示(1:非表示) if nowin ! 1 { ini_section "window" ;iniセクション名[window] ini_getint sizex,"Size_x" ;Size_x 縦の座標位置を指定 ini_getint sizey,"Size_y" ;Size_y 横の座標位置を指定 screen 0,240,150,16,sizex,sizey ;ウインドウ自体の表示位置設定 title "google-cache clip Ver 2.00" ;ウインドウID0のタイトルバーに表示 onexit *finish ;途中終了の場合はfinishへ飛ぶ sysfont 17 ;システム標準フォントを使う gsel 0,1 ;ウインドウID0をアクティブにする } ;---------------- ;本体の表示(メイン画面) *mainwin ini_section "google" ;iniセクション名[google] ini_getint site,"site" ;site どこの国で検索するの?() ini_getint lang,"lang" ;lang 何語で検索するのさ?(1:全言語 2:日本語) ini_getint num,"num" ;表示件数(0:指定しない) url="co.jp","com","co.kr","de","fr","co.uk","it","ch","ca","com.mx","co.il" useurl=url.site ; useurlにgoogleのURLの末尾を代入 if lang=0 { uselang="" } else { if lang=1 : uselang="&lr=" if lang=2 : uselang="&lr=lang_ja" } if nowin=1 : goto *browse redraw 0 ;描画一時OFF pos 0,0 ;座標(0.0)に合わせる cls 1 ;ウインドウID0を明るい灰色(1)でクリア objmode 2,1 ;fontで指定したフォントを使う font "MS UIゴシック",28,16 pos 0,0 objsize 120,60 ;ボタンの大きさを指定 button "通常検索",*browse ;OKボタン pos 120,0 objsize 120,60 button "一発検索",*lucky font "MS UIゴシック",16,16 pos 0,60 objsize 120,60 button "イメージ検索",*spsearch pos 120,60 objsize 120,60 button "ディレクトリ検索",*directry pos 0,120 objsize 120,30 button "オプション",*setting ;オプションボタン pos 120,120 objsize 120,30 button "キャンセル",*finish ;キャンセルボタン redraw 1 ;描画ON stop ;---------------- ;設定画面 *setting redraw 0 ;描画一時OFF pos 0,0 ;座標(0.0)に合わせる cls 1 ;ウインドウID0を明るい灰色(1)でクリア sysfont 17 ;システム標準フォントを使う objmode 1,1 ;オブジェクトもシステム標準フォントを使う pos 5,10 print "・使用するサーバー" pos 5,30 objsize 120,20 ;オブジェクトの大きさを指定 combox site,80,"日本(co.jp)\nアメリカ(com)\n韓国(co.kr)\nドイツ(de)\nフランス(fr)\nイギリス(co.uk)\nイタリア(it)\nスイス(ch)\nカナダ(ca)\nメキシコ(com.mx)\nイスラエル(co.il)" pos 130,10 print "・検索する言語" pos 130,30 objsize 105,20 ;オブジェクトの大きさを指定 combox lang,80,"Cookie依存\n全言語\n日本語" ;検索する言語を選ぶチェックボックス pos 5,60 print "・結果の表示件数(0の場合は無効)" pos 200,55 input num,30,20,3 pos 5,80 print "・メインウインドウを開かない設定" pos 5,95 objsize 185,15 chkbox "起動したらいきなり検索結果を開く",nowin pos 20,120 objsize 80,22 ;ボタンの大きさを指定 button "OK",*keep ;OKボタン pos 130,120 objsize 80,22 ;ボタンの大きさを指定 button "キャンセル",*mainwin ;キャンセルボタン redraw 1 ;描画ON stop ;---------------- ;設定保存 *keep ini_section "google" ;iniセクション名[google] ini_setint site,"site" ini_setint lang,"lang" ini_setint num,"num" ini_setint nowin,"nowin" ; if reg=0 { ; regkey 0,"Software\\Microsoft\\Internet Explorer\\MenuExt\\googleで検索",1 ; settxt=exedir+"\\menu.html" ; setreg settxt,"",1 ; settxt=16 ; setreg settxt,"contexts",0 ; } goto *mainwin ;---------------- ;イメージ検索実行 *spsearch clipget clip,200 ;クリップボードの内容を取得(200バイトまで) urlenc clip,clip ;URLエンコード clip="http://www.google."+useurl+"/images?ie=Shift_JIS&q="+clip exec clip,16 goto *finish ;---------------- ;グループ検索 *directry uselang = uselang + "&cat=gwd%2FTop" goto *browse ;---------------- ;I'm Feeling Lucky *lucky uselang = uselang + "&btnI=I%27m+Feeling+Lucky" jump=1 ;---------------- ;通常検索実行 *browse if jump!=1 { if num!=0 : uselang = uselang + "&num=" + num } clipget clip,200 ;クリップボードの内容を取得(200バイトまで) instr cache1,clip,"http://" ;http://を含む場合はキャッシュに変換 instr cache2,clip,"www." ;www.を含む場合はキャッシュに変換 if (cache1=0)|(cache2=0) { clip="http://www.google."+useurl+"/search?ie=Shift_JIS&q=cache:"+clip ;キャッシュ変換 } else { urlenc clip,clip ;URLエンコード clip="http://www.google."+useurl+"/search?ie=Shift_JIS&q="+clip+uselang ;通常検索変換 } exec clip,16 ;ブラウザ起動 ;---------------- ;終了処理 *finish if nowin ! 1 { wps_restore ;最小化等を元にもどす ginfo 2 sizex=prmx sizey=prmy ini_section "window" ;iniセクション名[window] ini_setint sizex,"Size_x" ;Size_x 縦の座標位置を指定 ini_setint sizey,"Size_y" ;Size_y 横の座標位置を指定 } end ;プログラム終了 ;------------------------------------------------ ;Copyright 2004 karia All rights reserved. ;Thanks to : USKさん・K−Kさん・ 堅田和之さん