### duckyScript: Open a Webpage Example Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html An example of a multi-line duckyScript to open a webpage. It simulates pressing the Windows key + R, delays for 500ms, types a URL, and presses Enter. This demonstrates basic command sequencing and timing. ```duckyScript WINDOWS r DELAY 500 STRING https://youtu.be/dQw4w9WgXcQ ENTER ``` -------------------------------- ### Mathematical Operations Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Provides examples of basic arithmetic operations using variables and constants. ```duckyScript spam = 2+3 spam = eggs * 10 ``` -------------------------------- ### Random Generation Commands Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Examples of using random generation commands and the REPEAT loop construct. ```duckyScript RANDOM_NUMBER REPEAT 7 // types 8 random numbers ``` -------------------------------- ### duckyScript: STRING Command Example Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Illustrates the 'STRING' command in duckyScript, which types out the provided text literally. This is the most basic way to input text via the script. ```duckyScript STRING Hello world! // types out "Hello world!" ``` -------------------------------- ### duckyScript: STRINGLN_BLOCK Example Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates the 'STRINGLN_BLOCK' and 'END_STRINGLN' commands for typing multi-line text. Each line within the block is typed out, followed by an Enter key press. ```duckyScript STRINGLN_BLOCK According to all known laws of aviation, there is no way a bee should be able to fly. END_STRINGLN ``` -------------------------------- ### duckyScript: Basic Comment Example Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates the C-style single-line comment in duckyScript. Any text following '//' on a line is ignored by the interpreter. This is useful for adding explanations to scripts. ```duckyScript // This is a comment ``` -------------------------------- ### Low-level Memory and Random Functions Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Provides examples of using built-in memory access (POKE) and random number generation functions. ```duckyScript POKE8(0xf400, 'c') POKE32(0xf410, 0xabcd) VAR value = RANDINT(-100, 100) VAR value = RANDUINT(3000000000, 4000000000) ``` -------------------------------- ### Recursive Function Implementation Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Shows the syntax for defining a recursive function in duckyScript, using a factorial calculation as an example. ```duckyScript FUN factorial(n) IF n <= 1 RETURN 1 END_IF RETURN n * factorial(n - 1) END_FUN VAR fact = factorial(5) ``` -------------------------------- ### duckyScript: Comment Block Example Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Shows how to create multi-line comments in duckyScript using 'REM_BLOCK' and 'END_REM'. All content between these two commands is ignored, allowing for extensive annotations. ```duckyScript REM_BLOCK Put as much comment here as you want! END_REM ``` -------------------------------- ### Reserved Variables Usage Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Illustrates accessing built-in reserved variables (starting with an underscore) to read system states or adjust device settings. ```duckyScript VAR status = _IS_NUMLOCK_ON _CHARJITTER = 10 ``` -------------------------------- ### Manage Real-time Clock (RTC) Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Shows how to validate the RTC state before reading time variables. Includes an example of formatting date and time components using zero-padded specifiers. ```duckyPad Script IF _RTC_IS_VALID == 0 HALT END_IF STRING $_RTC_YEAR%04d-$_RTC_MONTH%02d-$_RTC_DAY%02d $_RTC_HOUR%02d:$_RTC_MINUTE%02d:$_RTC_SECOND%02d ``` -------------------------------- ### Switching Profiles Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates how to navigate between different device profiles using the GOTO_PROFILE command. ```duckyScript GOTO_PROFILE NumPad ``` -------------------------------- ### Standard Library Usage Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Demonstrates how to import the duckyPad standard library using USE_STDLIB and utilize helper functions like WAITKEY and MAX. ```duckyScript USE_STDLIB STRINGLN Press Key 3 to continue... WAITKEY(3) VAR high_score = MAX(100, 500) STRINGLN The high score is: $high_score ``` -------------------------------- ### Launch Apps on macOS via Spotlight - DuckyScript Source: https://dekunukem.github.io/duckyPad-Pro/doc/getting_started.html This snippet illustrates how to launch applications on macOS using Spotlight. It involves pressing Command + Space, delaying briefly, typing the application name, and pressing Enter. ```duckyscript COMMAND SPACE DELAY 500 STRING firefox ENTER ``` -------------------------------- ### Define Constants Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates the use of the DEFINE command to create constants that are replaced as-is during preprocessing, similar to C-style macros. ```duckyScript DEFINE MY_EMAIL example@gmail.com STRING My email is MY_EMAIL! ``` -------------------------------- ### Launch Apps on Windows via Shortcuts - DuckyScript Source: https://dekunukem.github.io/duckyPad-Pro/doc/getting_started.html This snippet shows how to launch any file or application on Windows by assigning a hotkey to a created shortcut. The DuckyScript code reflects the hotkey combination defined in the shortcut's properties. ```duckyscript CONTROL ALT D ``` -------------------------------- ### Numerical Padding in Output Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Illustrates how to apply width and leading-zero padding to numerical output using format specifiers. ```duckyScript VAR $foo = 5 STRING I have $foo%10d apples! STRING I have $foo%010d apples! ``` -------------------------------- ### Format and Print Variables Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates how to print variables using the $ prefix and apply C-style format specifiers for decimal, hex, and padding adjustments. Padding supports both space-filling and leading-zero formatting. ```duckyPad Script VAR foo = -10 STRING Value is: $foo%d STRING Value is: $foo%u STRING Value is: $foo%x STRING Value is: $foo%X VAR bar = 5 STRING I have $bar%10d apples! STRING I have $bar%010d apples! ``` -------------------------------- ### Function Definitions and Usage Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Explains how to define, call, and pass arguments to functions in duckyScript to improve code modularity. ```duckyScript FUN print_addr() STRINGLN 123 Ducky Lane STRINGLN Pond City, QU 12345 END_FUN print_addr() FUN add_number(a, b) RETURN a + b END_FUN VAR total = add_number(10, 20) ``` -------------------------------- ### Using Special Keys and Shortcuts Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates how to trigger individual special keys or combine them to create keyboard shortcuts. Keys are processed in sequence from left-to-right and released in reverse order. ```duckyScript WINDOWS WINDOWS s WINDOWS SHIFT s ``` -------------------------------- ### Variable Scoping and Recursion Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates local versus global variable scoping and the implementation of recursive functions. ```duckyScript VAR x = 10 VAR y = 20 FUN scope_demo() VAR x = 5 x = x + y STRINGLN Local x is: $x END_FUN FUN factorial(n) IF n <= 1 RETURN 1 END_IF RETURN n * factorial(n - 1) END_FUN VAR fact = factorial(5) ``` -------------------------------- ### Advanced Function Definitions Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Demonstrates the new function syntax supporting arguments, return values, and function calls. ```duckyScript FUN print_addr() STRINGLN 123 Ducky Lane STRINGLN Pond City, QU 12345 END_FUN print_addr() // call it FUN add_number(a, b) RETURN a + b END_FUN VAR total = add_number(10, 20) ``` -------------------------------- ### Control Flow: Loops Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates the use of LBREAK to exit a loop and CONTINUE to skip to the next iteration in duckyScript. ```duckyScript VAR i = 0 WHILE 1 STRINGLN Counter is $i! i = i + 1 IF i == 3 LBREAK END_IF END_WHILE VAR i = 0 WHILE i < 5 i = i + 1 IF i == 3 CONTINUE END_IF STRINGLN Counter is $i! END_WHILE ``` -------------------------------- ### Launch Apps on Windows via Task Bar - DuckyScript Source: https://dekunukem.github.io/duckyPad-Pro/doc/getting_started.html This snippet demonstrates how to launch applications on Windows using the taskbar shortcut method with DuckyScript. It assumes applications are pinned to the taskbar and uses the WIN key combined with a number to launch them. ```duckyscript WINDOWS 1 WINDOWS 2 ``` -------------------------------- ### Implementing Cyclic Actions with LOOP Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html The LOOP command allows assigning multiple actions to a single key, cycling through them sequentially upon each press. ```duckyScript LOOP0: STRINGLN first action LOOP1: STRINGLN second action LOOP2: STRINGLN third action ``` -------------------------------- ### Variable Declaration and Assignment Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Shows how to declare and assign values to signed 32-bit integer variables using decimal, hexadecimal, or character literals. ```duckyScript // Declaration VAR spam = 42 VAR eggs = 0xff VAR foo = 'a' // Assignment spam = 20 eggs = spam*2 ``` -------------------------------- ### Variable Assignment and Syntax Improvements Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Demonstrates the updated variable assignment syntax, including the removal of the '$' prefix for non-printing operations and the use of augmented assignment operators and inline comments. ```duckyScript VAR foo = 100 foo += 5 STRING Value is: $foo IF !foo DELAY 100 // only if foo is 0 END_IF ``` -------------------------------- ### Looping Structures Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Demonstrates the use of the WHILE loop to repeat actions until a specific condition is met. The loop continues as long as the expression evaluates to non-zero. ```duckyPad Script VAR i = 0 WHILE i < 3 STRINGLN Counter is $i! i = i + 1 END_WHILE ``` -------------------------------- ### Configuring Script Timing and Delays Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Controls execution speed using DELAY for pauses, DEFAULTDELAY for non-letter actions, and DEFAULTCHARDELAY for typing speed. ```duckyScript WINDOWS r DELAY 1000 STRING cmd DEFAULTDELAY 50 CTRL ALT DELETE DEFAULTCHARDELAY 10 STRING Hello World! ``` -------------------------------- ### Variable Scoping and Shadowing Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Demonstrates how variables defined inside functions take local scope and shadow global variables of the same name. ```duckyScript // Both global scope VAR x = 10 VAR y = 20 FUN scope_demo() VAR x = 5 // This x is local, will shadow the global x. x = x + y STRINGLN Local x is: $x END_FUN ``` -------------------------------- ### Print Format Specifiers Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Shows how to use C-style format specifiers to control the output format of variables, including signed/unsigned decimal and hexadecimal representations. ```duckyScript VAR $foo = -10 STRING Value is: $foo%d STRING Value is: $foo%u STRING Value is: $foo%x STRING Value is: $foo%X ``` -------------------------------- ### Built-in System Functions Source: https://dekunukem.github.io/duckyPad-Pro/doc/beta_test.html Lists common low-level built-in functions available for direct use in scripts. ```duckyScript PUTS() RANDINT() RANDCHR() HIDTX() RANDUINT() ``` -------------------------------- ### Repeating Script Lines Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html The REPEAT command executes the immediately preceding line a specified number of times. ```duckyScript STRING Hello world REPEAT 10 ``` -------------------------------- ### Fine-grained Key Control with KEYDOWN and KEYUP Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Uses KEYDOWN and KEYUP to manually hold and release keys, enabling complex sequences like Alt Codes for special characters. ```duckyScript // types out ΒΌ KEYDOWN ALT KP_1 KP_7 KP_2 KEYUP ALT ``` -------------------------------- ### Send Raw HID Message (Media Keys) Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Sends a raw HID media key message by writing 9 bytes to scratch memory and calling HIDTX. The message includes key status bits for various media functions. ```General POKE8(addr, 9, [2, Key Status Bitfield, Reserved, 0, 0, 0, 0, 0, 0]) // Example for Next Track: // POKE8(addr, 9, [2, 1, 0, 0, 0, 0, 0, 0, 0]) // Key Status Bit 0 (Next Track) is 1 // HIDTX(addr) // delay(10-20ms) // POKE8(addr, 9, [2, 0, 0, 0, 0, 0, 0, 0, 0]) // Release ``` -------------------------------- ### Send Raw HID Message (Mouse) Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Sends a raw HID mouse message by writing 9 bytes to scratch memory and calling HIDTX. This includes button states, X/Y movement, and scroll wheel data. ```General POKE8(addr, 9, [3, Button Status, X Movement, Y Movement, Vertical Scroll, Horizontal Scroll, Reserved, Reserved, 0]) // Example for Left Click and move right: // POKE8(addr, 9, [3, 1, 10, 0, 0, 0, 0, 0, 0]) // Button Status Bit 0 (Left) is 1, X Movement is 10 // HIDTX(addr) // delay(10-20ms) // POKE8(addr, 9, [3, 0, 0, 0, 0, 0, 0, 0, 0]) // Release ``` -------------------------------- ### Send Raw HID Message (Keyboard) Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Sends a raw HID keyboard message by writing 9 bytes to scratch memory and calling HIDTX. Ensure to release keys by setting bytes 1-8 to 0. ```General POKE8(addr, 9, [Usage ID, Modifier, Reserved, Scan Code 1, Scan Code 2, Scan Code 3, Scan Code 4, Scan Code 5, Scan Code 6]) // Example for pressing 'A' with Left Shift: // POKE8(addr, 9, [1, 2, 0, 30, 0, 0, 0, 0, 0]) // Modifier bit 1 (Left Shift) is 2 // HIDTX(addr) // delay(10-20ms) // POKE8(addr, 9, [0, 0, 0, 0, 0, 0, 0, 0, 0]) // Release keys ``` -------------------------------- ### Generate Random Integer Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Generates a random integer within a specified inclusive range using the RANDINT function. The result is stored in a variable. ```General VAR value = RANDINT(0, 1000) ``` -------------------------------- ### Switch Status Bitfield Read Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Reads the reserved variable _SW_BITFIELD, which returns immediately with a bitfield representing the status of all keys. Each bit corresponds to a key's pressed state. ```General // Check if key with ID 5 is pressed: // IF (_SW_BITFIELD & (1 << 4)) != 0 // // Key 5 is pressed // END_IF ``` -------------------------------- ### Perform Unsigned Operations Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Built-in functions for performing unsigned arithmetic and bitwise operations on variables. These functions handle unsigned comparisons, division, modulo, and logical right shifts. ```duckyPad Script ULT(lhs, rhs) ULTE(lhs, rhs) UGT(lhs, rhs) UGTE(lhs, rhs) UDIV(val, n) UMOD(val, n) LSR(val, n) ``` -------------------------------- ### Conditional Execution Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Implements conditional logic using IF, ELSE IF, and ELSE blocks. Code within these blocks executes based on the evaluation of the provided expression. ```duckyPad Script VAR temp = 25 IF temp > 30 STRING It's very hot! ELSE IF temp > 18 STRING It's a pleasant day. ELSE STRING It's quite chilly! END_IF ``` -------------------------------- ### Clear Keypress Event Queue Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Clears the internal keypress event queue using the BCLR command. This is useful at the end of scripts or before reading button status to ensure only new presses are registered. ```General BCLR ``` -------------------------------- ### Non-Blocking Key Read Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Reads the reserved variable _READKEY, which returns immediately with the pressed key's ID or 0 if no key is pressed. This is typically used in a loop for continuous monitoring. ```General WHILE TRUE VAR this_key = _READKEY IF this_key == 1 // handling button press END_IF // otherwise do work here END_WHILE ``` -------------------------------- ### Blocking Key Read Source: https://dekunukem.github.io/duckyPad-Pro/doc/duckyscript_info.html Reads the reserved variable _BLOCKING_READKEY, which pauses script execution until a key is pressed. The pressed key's ID is then stored. ```General VAR this_key = _BLOCKING_READKEY // Blocks here until a key is pressed IF this_key == 1 // do something here ELSE IF this_key == 2 // do something else END_IF ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.