### Dynamic Data Calculation in C# Source: https://getquicker.net/KC/Help/Doc/customwindow Demonstrates how to dynamically calculate a value based on other data items within a custom window's data context. This example shows updating a 'total' field by summing 'number1' and 'number2'. ```C# total:$= Convert.ToInt32(number1) + Convert.ToInt32(number2) ``` -------------------------------- ### GET /http-server/status Source: https://getquicker.net/KC/Help/Doc/httpserver 查询指定HTTP服务的运行状态或获取所有运行中的服务列表。 ```APIDOC ## GET /http-server/status ### Description 用于获取某个http服务是否在运行中,或得到所有当前运行中的web服务。 ### Method GET ### Parameters #### Query Parameters - **服务ID** (string) - Optional - 要查询的服务标识,不传则返回所有服务。 ``` -------------------------------- ### POST /http-server/create Source: https://getquicker.net/KC/Help/Doc/httpserver 创建一个临时的HTTP服务器,用于文件浏览、传输或自定义请求处理。 ```APIDOC ## POST /http-server/create ### Description 对指定的目录开启一个网页服务器,可用于浏览或下载目录中的内容或向目录中上传文件。 ### Method POST ### Parameters #### Request Body - **端口号** (int) - Required - 网页服务的端口号 (1-65535),设为0则自动分配。 - **启用HTTPS** (bool) - Optional - 是否开启https访问。 - **文件夹路径** (string) - Required - web服务的根目录。 - **默认文档** (string) - Optional - 设置默认文档,如“index.html”。 - **基础验证密码** (string) - Optional - Basic Authentication密码(账号固定为quicker)。 - **服务id** (string) - Required - 为服务设定一个唯一标识。 - **闲置自动关闭** (int) - Optional - 无请求时自动关闭的秒数。 ### Response #### Success Response (200) - **服务地址** (string) - 用于访问此Web服务的网址。 - **带账号的地址** (string) - 包含账号密码的完整访问地址。 ``` -------------------------------- ### Example API URLs for Specific Services Source: https://getquicker.net/KC/Help/Doc/ai Illustrates specific API URL configurations for services like SiliconFlow and Ollama. These examples show how to integrate with these platforms by providing their respective base URLs and endpoint structures. ```text https://api.siliconflow.cn/v1/{1} ``` ```text http://127.0.0.1:11434/v1/{1} ``` -------------------------------- ### 使用 _context 对象操作动作上下文 Source: https://getquicker.net/KC/Help/Doc/expression-adv 演示如何利用内置的 _context 对象在表达式中获取或更新变量值,以及访问动作元数据。 ```csharp // 获取变量值 $= _context.GetVarValue("myVariableName"); // 更新变量值 $= _context.SetVarValue("myVariableName", "newValue"); // 获取动作标题 $= _context.ActionTitle; // 获取搜索触发前的活动窗口句柄 $= _context.ExtraData?.ActiveWindowBeforeSearch ``` -------------------------------- ### Get All URLs in Current Window (Callback) Source: https://getquicker.net/KC/Help/Doc/chromecontrol This JavaScript snippet retrieves all URLs from the tabs within the current focused window using the callback-based approach. It employs `chrome.windows.getLastFocused` to get the window object, then maps over its tabs to extract the URLs. The list of URLs is returned to Quicker via `sendReplyToQuicker`. ```javascript //.js 获取当前窗口的所有网址。动作网址: chrome.windows.getLastFocused({populate:true}, function(win){ var urlList = win.tabs.map(x=>x.url); sendReplyToQuicker(true, "ok", urlList, qk_msg_serial) }); ``` -------------------------------- ### 使用 _context 对象操作变量 Source: https://getquicker.net/kc/help/doc/expression-adv 通过 _context 内置对象在表达式中动态获取或更新动作变量值,适用于需要程序化控制动作状态的场景。 ```csharp // 获取变量值 var val = _context.GetVarValue("变量名"); // 更新变量值 _context.SetVarValue("变量名", "新值"); // 获取搜索触发前的活动窗口句柄 var handle = _context.ExtraData?.ActiveWindowBeforeSearch; ``` -------------------------------- ### Image Processing Command Format - GetQuicker Source: https://getquicker.net/KC/Help/Doc/imgprocess Defines the syntax for specifying image processing commands and their parameters. Each command is on a new line, starting with the command word followed by a colon, and then parameters separated by semicolons. Lines starting with '//' are treated as comments. ```text CommandWord:Parameter1;Parameter2;... ``` -------------------------------- ### POST /excel/open Source: https://getquicker.net/KC/Help/Doc/excelobjects Opens a specified Excel file and returns the application and workbook context. ```APIDOC ## POST /excel/open ### Description Opens an Excel file from the provided path with optional configuration parameters. ### Method POST ### Request Body - **filePath** (string) - Required - Full path to the Excel file - **parameters** (string) - Optional - Configuration lines (e.g., Visible=true, Password=xxx, Readonly=false) ### Response #### Success Response (200) - **activeWorkbook** (object) - The opened Workbook object - **activeWorksheet** (object) - The active WorkSheet - **applicationObject** (object) - The Excel Application instance ``` -------------------------------- ### Quicker 'If/Else' Module - Conditional Logic Examples Source: https://getquicker.net/kc/help/doc/if Demonstrates how to set up conditional logic in Quicker using 'If' and 'If/Else' modules. Conditions can be based on boolean variables or expressions. Examples cover numerical, text, and boolean comparisons, as well as combining multiple conditions with AND/OR operators. ```Quicker $ = {数字变量} == 3 $ = {数字变量} != 3 $ = {数字变量} > 3 $ = {数字变量} >= 0 $ = {数字变量} < 0 $ = {数字变量} >= 0 && {数字变量} <= 100 $ = {文本变量} == "" $ = String.IsNullOrEmpty({文本变量}) $ = {文本变量} != "" $ = !String.IsNullOrEmpty({文本变量}) $ = {文本变量} == "值" $ = {文本变量}.Contains("值") $ = {文本变量}.Length > 10 $ = !{布尔变量} $ = {布尔变量} == false $ = 条件1 && 条件2 && 条件3 $ = 条件1 || 条件2 || 条件3 $ = (条件1 && 条件2) || (条件3 && 条件4) $ = !条件 $ = !(条件1 && 条件2) ``` -------------------------------- ### C# 运行C#代码 - 基础示例 Source: https://getquicker.net/KC/Help/Doc/csscript 演示如何使用C#代码模块执行基本操作,如读取和设置动作变量,并弹出消息框。代码中必须包含一个接受`IStepContext`参数的`Exec`静态函数。 ```csharp // 引用必要的命名空间 using System.Windows.Forms; // Quicker将会调用的函数 public static void Exec(Quicker.Public.IStepContext context){ var oldValue = context.GetVarValue("varName"); // 读取动作里的变量值 MessageBox.Show(oldValue as string); context.SetVarValue("varName", "从脚本输出的内容。"); // 向变量里输出值 } ``` -------------------------------- ### Get Current Tab Cookies (MV3 Async/Await) Source: https://getquicker.net/KC/Help/Doc/chromecontrol This snippet shows how to get cookies for the current active tab using the MV3 version of the Quicker extension with asynchronous programming (`async/await`). It simplifies the process by directly returning the result of `chrome.cookies.getAll` after querying for the active tab. This method is recommended for MV3 extensions and requires Quicker version 1.44.12+. ```javascript //.js const tabs = await chrome.tabs.query({ lastFocusedWindow: true, active: true }); if (tabs.length < 1) { throw new Error('未找到当前页'); } const url = tabs[0].url; // 获取cookies return await chrome.cookies.getAll({ url: url }); ``` -------------------------------- ### Get Current Tab Cookies (MV2 Callback) Source: https://getquicker.net/KC/Help/Doc/chromecontrol This snippet demonstrates how to retrieve cookies for the current active tab using the MV2 version of the Quicker extension. It utilizes callback functions to interact with Chrome APIs, specifically `chrome.tabs.query` to get the active tab and `chrome.cookies.getAll` to fetch its cookies. The result is then sent back to Quicker using `sendReplyToQuicker`. ```javascript chrome.tabs.query({ lastFocusedWindow: true, active: true }, function (tabs) { if (tabs.length < 1) { sendReplyToQuicker(false, '未找到当前页', {}, qk_msg_serial) } var url = tabs[0].url; chrome.cookies.getAll({ url: url }, function (cookies) { sendReplyToQuicker(true, 'ok', cookies, qk_msg_serial) }); }); ``` -------------------------------- ### C# Scripts with User Interfaces (WPF/Winforms) Source: https://getquicker.net/KC/Help/Doc/csscript Guidelines for using WPF and Winforms within C# scripts, including thread management and modal window behavior. ```APIDOC ## C# Scripts with User Interfaces ### Description Considerations when using UI frameworks like WPF and Winforms within C# scripts executed by Quicker. ### WPF Forms - **Threading Model**: Scripts using WPF forms should run on the **Foreground Thread** (STA - Single-Threaded Apartment). - **Modal Windows**: Using `ShowDialog()` to display WPF forms modally will temporarily block interaction with other Quicker windows. ### Winforms Forms - **Threading Model**: Scripts using Winforms forms should run on the **Background Thread** (MTA - Multi-Threaded Apartment). - **Foreground Thread Issues**: Running Winforms on the foreground thread may lead to unexpected behavior, such as input fields not accepting Chinese characters. ### Threading Options Recent updates (e.g., 20231130) have introduced STA options for execution threads to address compatibility issues that may arise when the action thread model changes from MTA to STA. ``` -------------------------------- ### Initialize CommonOperationItem List Source: https://getquicker.net/KC/Help/Doc/showmenu Example of how to instantiate and nest CommonOperationItem objects to create complex menus with separators and sub-menus. ```csharp var items = new List() { new CommonOperationItem() { Title = "Ping baidu", Data = "ping baidu.com", Icon = "fa:Light_Pen", Operation = "run", Description = "屏Ping百度" }, new CommonOperationItem() { IsSeparator = true }, new CommonOperationItem() { Title = "多级菜单", Children = new List() { new CommonOperationItem() { Title = "Ping baidu", Operation = "run" } } } }; ``` -------------------------------- ### 定义窗口控件类型枚举 Source: https://getquicker.net/KC/Help/Doc/uiautomation 定义了用于识别 Windows UI 自动化控件类型的枚举映射。此结构可用于在自动化脚本中动态传递控件类型参数,确保在名称相同但类型不同时能精确筛选目标控件。 ```csharp internal enum ControlTypes { Button = 50000, Calendar = 50001, CheckBox = 50002, ComboBox = 50003, Edit = 50004, Hyperlink = 50005, Image = 50006, ListItem = 50007, List = 50008, Menu = 50009, MenuBar = 50010, MenuItem = 50011, ProgressBar = 50012, RadioButton = 50013, ScrollBar = 50014, Slider = 50015, Spinner = 50016, StatusBar = 50017, Tab = 50018, TabItem = 50019, Text = 50020, ToolBar = 50021, ToolTip = 50022, Tree = 50023, TreeItem = 50024, Custom = 50025, Group = 50026, Thumb = 50027, DataGrid = 50028, DataItem = 50029, Document = 50030, SplitButton = 50031, Window = 50032, Pane = 50033, Header = 50034, HeaderItem = 50035, Table = 50036, TitleBar = 50037, Separator = 50038, SemanticZoom = 50039, AppBar = 50040 } ``` -------------------------------- ### Add Index to List Items with Lambda Expressions (C#) Source: https://getquicker.net/KC/Help/Doc/expression This example shows how to add a sequential index to each item in a list. It uses a C# lambda expression with multiple parameters `(x, index)` to access both the item and its index. The code transforms each item to uppercase and trims whitespace before prepending the index. ```csharp $= {list} .Select((x,index) => { var temp = x.ToUpper().Trim(); temp = index.ToString() + ": " + temp; return temp; }) .ToList() ``` -------------------------------- ### GET /excel/info Source: https://getquicker.net/KC/Help/Doc/excelobjects Retrieves information about the currently active Excel application instance managed by Quicker. ```APIDOC ## GET /excel/info ### Description Retrieves details about the currently active Excel application window. Note: Only workbooks opened via Quicker modules are accessible. ### Method GET ### Endpoint /excel/info ### Response #### Success Response (200) - **isSuccess** (boolean) - Operation success status - **activeWorkbook** (object) - Current active Workbook object - **activeWorksheet** (object) - Current active WorkSheet object - **worksheets** (array) - List of WorkSheet objects - **filePath** (string) - Full path of the active workbook - **applicationObject** (object) - The underlying Excel Application object ``` -------------------------------- ### Manipulate Word Selection Source: https://getquicker.net/KC/Help/Doc/officehelper Provides examples for modifying the current selection in Word, including style application, clearing formatting, and setting highlight colors. ```VBA selection .style = "标题 1" Selection .ClearFormatting: selection .Range.HighlightColorIndex = wdYellow ``` -------------------------------- ### Third-Party Cloud Storage/Image Hosting API Source: https://getquicker.net/KC/Help/Doc/cloud_oss This module allows you to upload files, images, and text data to cloud storage services like Aliyun OSS, Tencent Cloud COS, and Qiniu Cloud Kodo. Ensure you have the necessary account credentials and have set up your storage bucket. ```APIDOC ## POST /cloud-storage/upload ### Description Uploads files, images, or text content to a specified cloud storage service. ### Method POST ### Endpoint /cloud-storage/upload ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **operationType** (string) - Required - The type of operation, currently only 'upload' is supported. - **provider** (string) - Required - The cloud service provider (e.g., 'Aliyun', 'TencentCloud', 'Qiniu'). - **providerParams** (object) - Required - Parameters specific to the selected provider. See 'Provider-Specific Parameters' section below. - **objectName** (string) - Required - The name/path of the file on the server. Do not start with '/'. - **uploadContent** (string | object) - Required - Can be a file path, an image variable, or other text content. - **customDomain** (string) - Optional - Custom domain or CDN URL (e.g., 'https://files.example.com'). - **extraHeaders** (string) - Optional - Additional HTTP headers, one per line in 'name:value' format. Supported by Aliyun and Tencent Cloud. - **timeout** (integer) - Optional - Request timeout in seconds. ### Request Example ```json { "operationType": "upload", "provider": "Aliyun", "providerParams": { "Endpoint": "https://oss-cn-beijing.aliyuncs.com", "AccessKey": "YOUR_ACCESS_KEY", "AccessKeySecret": "YOUR_ACCESS_KEY_SECRET", "BucketName": "your-bucket-name" }, "objectName": "_sitefiles/home/abc.png", "uploadContent": "/path/to/local/file.png", "customDomain": "https://files.example.com" } ``` ### Response #### Success Response (200) - **providerUrl** (string) - The URL generated by the service provider. - **customDomainUrl** (string) - The URL generated using the custom domain. #### Response Example ```json { "providerUrl": "https://your-bucket-name.oss-cn-beijing.aliyuncs.com/_sitefiles/home/abc.png", "customDomainUrl": "https://files.example.com/_sitefiles/home/abc.png" } ``` #### Error Response (e.g., 400, 500) - **errorMessage** (string) - Description of the error. ### Provider-Specific Parameters #### Aliyun - **Endpoint** (string) - Service node URL (e.g., 'https://oss-cn-beijing.aliyuncs.com'). - **AccessKey** (string) - Your AccessKey. - **AccessKeySecret** (string) - Your AccessKeySecret. - **BucketName** (string) - Your Bucket name. #### Tencent Cloud - **BucketName** (string) - Bucket name (e.g., 'test-13005123456'). - **Region** (string) - Node name (e.g., 'ap-beijing'). - **AppId** (string) - Account AppID (can be empty). - **SecretId** (string) - Account SecretId. - **SecretKey** (string) - Account SecretKey. #### Qiniu Cloud - **Zone** (string) - Storage area ID (e.g., 'z2'). - **UseHttps** (boolean) - Whether to use HTTPS for upload (true/false). - **UseCdnDomains** (boolean) - Whether to use CDN acceleration for upload (true/false). - **AccessKey** (string) - Your AccessKey. - **SecretKey** (string) - Your AccessSecret. - **Bucket** (string) - Bucket name (e.g., 'quicker-test'). - **AccessUrl** (string) - Custom domain (e.g., 'http://qiniutest.getquicker.cn'). ```