From e1c60571f3dfa273ab8028fde1ca4cb5783eaada Mon Sep 17 00:00:00 2001 From: papple23g Date: Wed, 10 Feb 2021 16:51:04 +0800 Subject: [PATCH] =?UTF-8?q?[Feat]=20=E6=96=B0=E5=A2=9E=E5=8C=AF=E5=87=BA?= =?UTF-8?q?=E5=92=8C=E5=8C=AF=E5=85=A5=E7=A9=8D=E6=9C=A8=E6=AA=94(.xml)?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- onlineToOffline.py | 3 +- protable/AHK_Blockly.html | 3229 +++++++++++++++++++++++-------------- templates/ahkblockly.py | 217 +-- 3 files changed, 2040 insertions(+), 1409 deletions(-) diff --git a/onlineToOffline.py b/onlineToOffline.py index 48839ad..df6fc7a 100644 --- a/onlineToOffline.py +++ b/onlineToOffline.py @@ -1,5 +1,6 @@ import requests -url=u"https://papple23g-ahkcompiler.herokuapp.com/ahkblockly" +# url=u"https://papple23g-ahkcompiler.herokuapp.com/ahkblockly" +url=u"http://127.0.0.1:8000/ahkblockly" res=requests.get(url) diff --git a/protable/AHK_Blockly.html b/protable/AHK_Blockly.html index b27e66b..02f3dc6 100644 --- a/protable/AHK_Blockly.html +++ b/protable/AHK_Blockly.html @@ -14511,7 +14511,7 @@ this.appendDummyInput() .appendField("無限循環"); this.appendStatementInput("DO") - .setCheck(null); + .setCheck("action"); this.setPreviousStatement(true, "action"); this.setNextStatement(true, "action"); this.setColour(120); @@ -14520,6 +14520,158 @@ } }; +Blockly.Blocks['image_filepath'] = { + init: function() { + this.appendValueInput("NAME") + .setCheck(["filepath", "String"]) + .appendField("圖片來源"); + this.setInputsInline(false); + this.setPreviousStatement(true, "get_picture_pos_setting"); + this.setNextStatement(true, "get_picture_pos_setting"); + this.setColour("#DB7093"); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['image_search_area'] = { + init: function() { + this.appendValueInput("X") + .setCheck("Number") + .appendField("偵測範圍 X1:"); + this.appendValueInput("Y") + .setCheck("Number") + .appendField("Y1:"); + this.appendValueInput("W") + .setCheck("Number") + .appendField("X2:"); + this.appendValueInput("H") + .setCheck("Number") + .appendField("Y2:"); + this.setInputsInline(true); + this.setPreviousStatement(true, "get_picture_pos_setting"); + this.setNextStatement(true, "get_picture_pos_setting"); + this.setColour("#DB7093"); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['pixel_search_area'] = { + init: function() { + this.appendValueInput("X") + .setCheck("Number") + .appendField("偵測範圍 X:"); + this.appendValueInput("Y") + .setCheck("Number") + .appendField("Y:"); + this.appendValueInput("W") + .setCheck("Number") + .appendField("寬:"); + this.appendValueInput("H") + .setCheck("Number") + .appendField("高:"); + this.setInputsInline(true); + this.setPreviousStatement(true, "get_pixel_pos_setting"); + this.setNextStatement(true, "get_pixel_pos_setting"); + this.setColour("#E8A0A0"); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + + +Blockly.Blocks['pixel_color_id'] = { + init: function() { + this.appendDummyInput() + .appendField("色碼 #") + .appendField(new Blockly.FieldTextInput("FFFFFF"), "ColorID"); + this.setInputsInline(true); + this.setPreviousStatement(true, "get_pixel_pos_setting"); + this.setNextStatement(true, "get_pixel_pos_setting"); + this.setColour("#E8A0A0"); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['pixel_rgb_color'] = { + init: function() { + this.appendValueInput("R") + .setCheck("Number") + .appendField("R"); + this.appendValueInput("G") + .setCheck("Number") + .appendField("G"); + this.appendValueInput("B") + .setCheck("Number") + .appendField("B"); + this.setInputsInline(true); + this.setPreviousStatement(true, "get_pixel_pos_setting"); + this.setNextStatement(true, "get_pixel_pos_setting"); + this.setColour("#E8A0A0"); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + + +Blockly.Blocks['get_pixel_pos'] = { + init: function() { + this.appendStatementInput("get_pixel_pos_setting") + .setCheck("get_pixel_pos_setting") + .appendField("偵測像素"); + this.appendDummyInput() + .appendField("將獲得的座標紀錄至變數(") + .appendField(new Blockly.FieldVariable("圖片像素X"), "pos_x") + .appendField(",") + .appendField(new Blockly.FieldVariable("圖片像素Y"), "pos_y") + .appendField(")"); + this.appendStatementInput("DO") + .setCheck("action") + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("找到像素時"); + this.appendStatementInput("ELSE_DO") + .setCheck("action") + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("找不到時"); + this.setInputsInline(true); + this.setPreviousStatement(true, "action"); + this.setNextStatement(true, "action"); + this.setColour("#E8A0A0"); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['get_picture_pos_ver200419'] = { + init: function() { + this.appendStatementInput("get_picture_pos_setting") + .setCheck("get_picture_pos_setting") + .appendField("偵測圖片"); + this.appendDummyInput() + .appendField("將獲得的座標紀錄至變數(") + .appendField(new Blockly.FieldVariable("圖片座標X"), "pos_x") + .appendField(",") + .appendField(new Blockly.FieldVariable("圖片座標Y"), "pos_y") + .appendField(")"); + this.appendStatementInput("DO") + .setCheck("action") + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("找到圖片時"); + this.appendStatementInput("ELSE_DO") + .setCheck("action") + .setAlign(Blockly.ALIGN_RIGHT) + .appendField("找不到時"); + this.setInputsInline(true); + this.setPreviousStatement(true, "action"); + this.setNextStatement(true, "action"); + this.setColour("#DB7093"); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + Blockly.Blocks['get_picture_pos_ver200406'] = { init: function() { this.appendValueInput("image_filepath") @@ -14621,6 +14773,7 @@ ["Google搜尋", "google"], ["Youtube搜尋", "youtube"], ["WIKI搜尋", "wiki"], + ["百度搜尋", "baidu"], ["Google地圖搜尋", "google_map"], ["Google搜尋趨勢", "google_trend"], ["Gooogle翻譯", "google_translate"], @@ -14682,6 +14835,37 @@ } }; +Blockly.Blocks['key_down'] = { + init: function() { + this.appendValueInput("NAME") + .setCheck(["special_key", "normal_key"]) + .appendField("按著"); + this.appendDummyInput() + .appendField("不放"); + this.setInputsInline(true); + this.setPreviousStatement(true, "action"); + this.setNextStatement(true, "action"); + this.setColour(260); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['key_up'] = { + init: function() { + this.appendValueInput("NAME") + .setCheck(["special_key", "normal_key"]) + .appendField("釋放"); + this.setInputsInline(true); + this.setPreviousStatement(true, "action"); + this.setNextStatement(true, "action"); + this.setColour(260); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + + Blockly.Blocks['key_wait'] = { init: function() { @@ -14954,6 +15138,8 @@ } }; + + Blockly.Blocks['set_clipboard'] = { init: function() { this.appendValueInput("NAME") @@ -15027,6 +15213,7 @@ ["Google網頁", "google"], ["Youtube網頁", "youtube"], ["Facebook網頁", "facebook"], + ["百度搜尋", "baidu"], ["Wikipedia網頁", "wikipedia"], ["PChome網頁", "pchome"], ["Yahoo網頁", "yahoo"], @@ -15555,7 +15742,50 @@ this.setTooltip(""); this.setHelpUrl(""); } -} +} + +Blockly.Blocks['traytip'] = { + init: function() { + this.appendValueInput("NAME") + .setCheck(null) + .appendField("桌面通知"); + this.setPreviousStatement(true, "action"); + this.setNextStatement(true, "action"); + this.setColour(160); + this.setTooltip(""); + this.setHelpUrl(""); + } +} + +Blockly.Blocks['system_info_num'] = { + init: function() { + this.appendDummyInput() + .setAlign(Blockly.ALIGN_CENTRE) + .appendField(new Blockly.FieldDropdown([ + ["本螢幕寬度", "screen_width"], + ["本螢幕高度", "screen_height"], + ]), "NAME"); + this.setOutput(true, "Number"); + this.setColour(230); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +Blockly.Blocks['system_info_str'] = { + init: function() { + this.appendDummyInput() + .setAlign(Blockly.ALIGN_CENTRE) + .appendField(new Blockly.FieldDropdown([ + ["本用戶名稱", "user_name"], + ["本電腦名稱", "computer_name"], + ]), "NAME"); + this.setOutput(true, "Number"); + this.setColour(160); + this.setTooltip(""); + this.setHelpUrl(""); + } +};