File tree Expand file tree Collapse file tree 8 files changed +27
-0
lines changed
Expand file tree Collapse file tree 8 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 33
44在 AutoControl 裡,Callback function 是由 Callback Executor 提供支援,
55以下是簡易的使用 Callback Executor 的範例,
6+
67.. code-block :: python
8+
79 from je_auto_control import callback_executor
810 # trigger_function will first to execute, but return value need to wait everything done
911 # so this test will first print("test") then print(size_function_return_value)
3436例如 time.sleep 會變成 time_sleep
3537
3638.. code-block :: python
39+
3740 from je_auto_control import package_manager
3841 package_manager.add_package_to_callback_executor(" time" )
3942
4043 如果你需要查看被更新的 event_dict 可以使用
4144
4245.. code-block :: python
46+
4347 from je_auto_control import callback_executor
4448 print (callback_executor.event_dict)
Original file line number Diff line number Diff line change 1010( 注意! 如果修改這個範例必須極度小心。 )
1111
1212.. code-block :: python
13+
1314 import sys
1415
1516 from je_auto_control import AutoControlMouseException
Original file line number Diff line number Diff line change 99以下範例是定位所有圖片
1010
1111.. code-block :: python
12+
1213 import time
1314
1415 from je_auto_control import locate_all_image
2526 以下範例是定位並點擊圖片
2627
2728.. code-block :: python
29+
2830 import time
2931
3032 from je_auto_control import locate_and_click
4042 以下範例是定位圖片
4143
4244.. code-block :: python
45+
4346 import time
4447
4548 from je_auto_control import locate_image_center
Original file line number Diff line number Diff line change 99* keys_table 是所有可以使用的按鍵
1010
1111.. code-block :: python
12+
1213 from je_auto_control import keys_table, get_special_table
1314
1415 print (keys_table)
1819 以下範例是按著鍵盤的某個按鍵,並在一秒後釋放
1920
2021.. code-block :: python
22+
2123 from time import sleep
2224 from je_auto_control import press_key, release_key
2325
2830 以下範例是按下與釋放按鍵
2931
3032.. code-block :: python
33+
3134 from je_auto_control import type_key
3235
3336 type_key(" a" )
3437
3538 以下範例是檢查鍵盤 a 鍵是否按著
3639
3740.. code-block :: python
41+
3842 from je_auto_control import check_key_is_press
3943
4044 check_key_is_press(" a" )
4145
4246 以下範例是按下與放開一串按鍵
4347
4448.. code-block :: python
49+
4550 from je_auto_control import write
4651
4752 write(" abcdefg" )
4853
4954 以下範例是按下按鍵並相反的釋放
5055
5156.. code-block :: python
57+
5258 import sys
5359
5460 from je_auto_control import hotkey
Original file line number Diff line number Diff line change 66* Keyword 的格式是以下範例,且在 JSON 檔案裡面使用一樣格式。
77
88.. code-block :: python
9+
910 [
1011 [" function_name_in_event_dict" : {" param_name" : param_value}],
1112 [" function_name_in_event_dict" : {" param_name" : param_value}],
2122例如 time.sleep 會變成 time_sleep
2223
2324.. code-block :: python
25+
2426 from je_auto_control import package_manager
2527 package_manager.add_package_to_executor(" time" )
2628
2931 如果你需要查看被更新的 event_dict 可以使用
3032
3133.. code-block :: python
34+
3235 from je_auto_control import executor
3336 print (executor.event_dict)
3437
3538 如果我們想要執行 JSON 檔案
3639
3740.. code-block :: python
41+
3842 from je_auto_control import execute_action, read_action_json
3943 execute_action(read_action_json(file_path))
4044
4145 如果我們想要執行資料夾裡所有 JSON 檔案
4246
4347.. code-block :: python
48+
4449 from je_auto_control import execute_files, get_dir_files_as_list
4550 execute_files(get_dir_files_as_list(dir_path))
Original file line number Diff line number Diff line change 88* mouse_table 是所有可以使用的按鍵
99
1010.. code-block :: python
11+
1112 from je_auto_control import mouse_table
1213
1314 print (mouse_table)
1415
1516 以下範例是按著滑鼠,一秒後釋放滑鼠
1617
1718.. code-block :: python
19+
1820 from time import sleep
1921
2022 from je_auto_control import press_mouse, release_mouse
2527 以下範例是點擊並放開滑鼠
2628
2729.. code-block :: python
30+
2831 from je_auto_control import click_mouse
2932
3033 click_mouse(" mouse_right" )
3134
3235 以下範例是檢查滑鼠位置並改變滑鼠位置
3336
3437.. code-block :: python
38+
3539 from je_auto_control import position, set_position
3640
3741 print (position)
4044 以下範例是3秒後滑鼠會往上 scroll
4145
4246.. code-block :: python
47+
4348 from time import sleep
4449 from je_auto_control import scroll
4550
Original file line number Diff line number Diff line change 77以下是範例如何使用
88
99.. code-block :: python
10+
1011 from time import sleep
1112
1213 from je_auto_control import execute_action
Original file line number Diff line number Diff line change 66以下範例是截圖
77
88.. code-block :: python
9+
910 from je_auto_control import screenshot
1011
1112 screenshot()
1213
1314 以下範例是取得螢幕尺寸
1415
1516.. code-block :: python
17+
1618 from je_auto_control import size
1719
1820 print (size())
You can’t perform that action at this time.
0 commit comments