UTF-8 // TestPage: http://www.amazon.co.jp/dp/B001JKRNNW/ref=pe_ar_x1 :amazonZoom{ int["debug"]=0; if (int["debug"] == 1) { log open: dir=Dir.Desktop file="debugAmazon.txt"; debug: true; } if (input[0].Length < "http://z2-ec2.images-amazon.com/".Length) { // // パラメタinput[0]が未指定の場合は、適当なサンプルURLを設定 // input[0]="http://z2-ec2.images-amazon.com/R/1/a=B001JKRNNW+d=_SCR(0,0,0)_+o=01+s=RMTILE+va=PT01+ve=242805519+e=.jpg"; } str["url-F"]=input[0].Former("_SCR("); str["url-L"]=input[0].Latter("_SCR("); str["url-L"]=str["url-L"].Latter(")"); if (str["url-F"].Length < 1) { put: value="NG: Bad URL, " input[0]; end: } if (str["url-L"].Length < 1) { put: value="NG: Bad URL, " input[0]; end: } intl[10]=0; while (intl[10] < 256) { strl["url"]=str["url-F"] "_SCR(" intl[10] ",0,0)" str["url-L"]; Ex:Http-Get: url=strl["url"] O:bin=strl["binfile"] O:cType=strl["ctype"]; if (strl["ctype"].StartsWith{"image/"} != "true") { break; } culc: intl[10]++; } int["zoom"]=intl[10] -1; log: "最大拡大値: " int["zoom"]; str["url-F"] = str["url-F"] "_SCR(" int["zoom"] ","; intl["x"]=0; intl["y"]=0; while (intl["x"] < 256) { while (intl["y"] < 256) { strl["url"]=str["url-F"] intl["x"] "," intl["y"] ")" str["url-L"]; Ex:Http-Get: url=strl["url"] O:bin=strl["binfile"] O:cType=strl["ctype"] O:ext=strl["ext"]; if (strl["ctype"].StartsWith{"image/"} != "true") { break; } str["Ext"]=strl["ext"]; strl["blk"]=Dir.DeskTop "\\AmazonProductImage\\block_x=" intl["x"] "_y=" intl["y"] "." str["Ext"]; file rename: src=strl["binfile"] to=strl["blk"] ov=true; culc: intl["y"]++; } if (intl["y"] == 0) { int["max-x"]=intl["x"] -1; log: "最大X値: " int["max-x"]; break; } int["max-y"]=intl["y"] -1; log: "最大Y値: " int["max-y"]; culc: intl["x"]++; intl["y"]=0; } gosub: buildImage; end: } :buildImage{ intl["x"]=0; while (intl["x"] <= int["max-x"]) { intl["y"]=0; while (intl["y"] <= int["max-y"]) { strl[10]="parts." intl["y"]; strl[strl[10]] = Dir.DeskTop "\\AmazonProductImage\\block_x=" intl["x"] "_y=" intl["y"] "." str["Ext"]; culc: intl["y"]++; } intl["y-count"]=int["max-y"] 1; strl["dest"]=Dir.DeskTop "\\AmazonProductImage\\VertConnected_x=" intl["x"] "." str["Ext"]; Ex:Img.Connect.V: strl.files.Index="parts" files.Count=intl["y-count"] O:result=strl[100] dest=strl["dest"]; log: "縦方向結合: " strl[100]; culc: intl["x"]++; } intl["x"]=0; while (intl["x"] <= int["max-x"]) { strl[10]="parts." intl["x"]; strl[strl[10]] = Dir.DeskTop "\\AmazonProductImage\\VertConnected_x=" intl["x"] "." str["Ext"]; culc: intl["x"]++; } intl["x-count"]=int["max-x"] 1; str[0]=":/*|?\"<>"; strl[10]=input[0].ReplaceEach(":/*|?”<>"); //全角化 strl["dest"] = Dir.Desktop "\\" strl[10]; Ex:Img.Connect.H: strl.files.Index="parts" files.Count=intl["x-count"] O:result=strl[100] dest=strl["dest"]; log: "横方向結合: " strl[100]; if (strl[100].StartsWith{"NG:"} == "true") { put: value=strl[100]; return: } put: value="OK:" strl["dest"]; return: }