PalmSens MethodSCRIPT
Language support for PalmSens MethodSCRIPT™ - the scripting language designed for integrating PalmSens electrochemistry instruments and modules into your applications.
About MethodSCRIPT
MethodSCRIPT™ is a powerful scripting language that gives you full control over PalmSens potentiostats and electrochemistry modules. It allows you to customize and combine measurement techniques, perform data analysis, and control external peripherals - all without requiring DLLs or code libraries.
Learn more: PalmSens MethodSCRIPT | MethodSCRIPT Manual | Code Examples
Features
Language Support
- Syntax Highlighting: Color-coded display of commands, keywords, variables, and comments
- Intelligent Code Completion:
- Command suggestions with parameter hints
- Variable name completion
- VarType completions for measurement configuration
- Context-aware suggestions based on cursor position
- Real-time Validation:
- Instant error detection as you type
- Variable declaration checking
- SI prefix validation
- Parameter type validation
- Duplicate variable detection
- Code Formatting: Automatic indentation and formatting
- Quick Fixes: Automatic variable declaration suggestions
- Hover Documentation: Detailed command information on hover
Device Communication
- Serial Port Connection: Connect to PalmSens devices via USB/Serial
- Send Scripts to Device: Send your MethodSCRIPT code directly to connected devices
- Live Communication View: Monitor data sent to and received from devices
- Color-coded messages (blue for sent, green for received)
- Timestamps for each message
- Auto-scroll to latest messages
- Click to copy messages
- Export communication log
- Status Bar Integration: See connection status at a glance
- Auto-connect: Optionally reconnect to last used device on startup
- Send-on-Save: Optionally send scripts automatically when saving files
Commands
- Connect to Device: Browse and connect to available serial ports
- Disconnect from Device: Disconnect from current device
- Send Script to Device: Send the active MethodSCRIPT file (Ctrl+Shift+U / Cmd+Shift+U)
- Show Device Communication: Open the communication view panel
- Refresh Device List: Rescan for available devices
Configuration
Device Communication Settings
Configure device communication in VS Code settings (File → Preferences → Settings):
{
"methodscript.device.baudRate": 115200,
"methodscript.device.dataBits": 8,
"methodscript.device.stopBits": 1,
"methodscript.device.parity": "none",
"methodscript.device.autoConnect": false,
"methodscript.device.sendOnSave": false,
"methodscript.device.timeout": 5000
}
Settings Details:
baudRate: Serial port baud rate (default: 115200)
dataBits: Number of data bits (7 or 8, default: 8)
stopBits: Number of stop bits (1 or 2, default: 1)
parity: Parity setting ("none", "even", or "odd", default: "none")
autoConnect: Automatically reconnect to last device on startup (default: false)
sendOnSave: Automatically send script when file is saved (default: false)
timeout: Communication timeout in milliseconds (default: 5000)
Windows:
- Devices typically appear as
COM1, COM2, etc.
- May require driver installation for some devices
- Admin rights might be needed for first connection
macOS:
- Devices appear as
/dev/tty.usbserial-* or /dev/cu.*
- May need to approve extension in Security preferences
- No admin rights typically required
Linux:
- Devices appear as
/dev/ttyUSB* or /dev/ttyACM*
- User must be in
dialout group: sudo usermod -a -G dialout $USER
- May need udev rules for specific devices
- Logout/login required after adding to dialout group
Language Features
Supported File Extensions
.mscr - MethodSCRIPT files
.mscript - MethodSCRIPT files
Bracket Matching
The extension supports bracket matching for:
if / endif
loop / endloop
meas_loop_* / endloop
Validation Rules
The extension validates:
- Variable declarations: Variables must be declared before use
- SI prefixes: Must be valid single characters (a,f,p,n,u,m,k,M,G,T,P,E)
- Measurement loops: First two parameters must be variables, not literals
- Duplicate variables: Output parameters must be different
- pck_add: Can only reference declared variables
| |