WZ6/マクロ集/外部ツール
//20091115分離して修正
#include <windows.h>
#include <text.h>
//##切り出す
HTEXT newobj kiridashi(HTEXT text,char* strmae,char* strato){
jumpend(text);
INT size=getadr(text);
UINT pLen;
INT hajime=searchex(text,0,size,strmae,SEARCH_ALL|SEARCH_RE,&pLen);
if (hajime != IFILE_ERROR) {
delarea(text,0,(hajime+pLen));
}
jumpend(text);
size=getadr(text);
INT owari=searchex(text,0,size,strato,SEARCH_ALL|SEARCH_RE,NULL);
if(owari != IFILE_ERROR){
delarea(text,owari,size);
}
jumptop(text);
return(text);
}
//##ページ取得
HTEXT newobj http_gets(HTEXT arg){
HTEXT recv=new();
if(internetconnect()){
if(internetable()){
recv =httprecv(arg);
tosjis(recv,detectkc(recv));
internetclose();
internetend();
}else{
add(recv,"接続できません\n");
}
}
else{
add(recv,"接続できませんでした\n");
}
return(recv);
}
//##google_calc
gg_calc{
title: 選択中の式をgoogleの電卓機能を使って計算します。結果をステータスウィンウドに表示します。
tool:ggcalc
HTEXT text = getfocus();
HTEXT shiki = getword(text);// textの現在位置から式を取得
if (shiki) {//
HTEXT gg_url=new();
add(gg_url,"http://www.google.co.jp/search?q=");
replace(shiki,\"\+","%2B",SEARCH_RE);
replace(shiki,\"\s","",SEARCH_RE);
add(gg_url,shiki);
HTEXT arg=new();
arg.clmurl=gg_url;
HTEXT gg=http_gets(arg);
char* saki=\"\<h2 class=.*style=.*font-size:138......";
char* ato="\\</b\\>";
char* hantei="calculator"; //成功
if(IFILE_ERROR==searchex(gg,0,getadr(gg),hantei,SEARCH_ALL|SEARCH_RE,NULL)){
printf("-失敗\n");
}else{
kiridashi(gg,saki,ato);
replace(gg,"\\<font size=-2\\>\\s\\</font\\>","",SEARCH_RE|SEARCH_ALL); //なぞの<font>タグを削除
replace(gg," ","",SEARCH_RE|SEARCH_ALL);
printf("-取得式:%s\n",shiki);
printf("-計算結果:%s\n",gg);
printf("-google:%s\n",gg_url);
}
}else{
printf("-式の取得失敗\n");
}
}
MENU
最新の20件
2020-11-14
2017-12-09
2017-12-02
2017-04-05
2014-05-23
2012-04-14
2011-10-17
2011-12-07
2011-12-02
2011-11-03
2011-10-18
2016-10-18
2016-06-17
2016-05-12
2014-11-25
2014-09-15
2014-05-21
2013-05-04
2012-04-14
人気の10件
- counter: 1024
- today: 1
- yesterday: 0
- online: 1