# S7 200smart

> Use when working with Siemens S7-200 SMART or STEP 7-Micro/WIN SMART V2.8 on Windows, especially to import or export active blocks, compile with keyboard shortcuts, verify output-window results, repair AWL encoding issues, or fix subroutine display-name mismatches such as call errors after import.

- Skill: `haoyuesheng1688/s7-200smart` (Agent Skill, multi-file: 15 files)
- Install (CLI): `npx skillmds@latest add haoyuesheng1688/s7-200smart`
- Raw SKILL.md: https://api.skillmd.com/api/skills/haoyuesheng1688/s7-200smart/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: haoyuesheng1688 (https://skillmd.com/u/haoyuesheng1688)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/haoyuesheng1688/s7-200smart

---


# S7-200 SMART

Use this skill for STEP 7-Micro/WIN SMART V2.8 desktop automation on Windows.

Prefer attaching to an already-open `MWSmart` session instead of launching the software yourself.

## Workflow

1. Run [scripts/find_open_200smart_process.ps1](./scripts/find_open_200smart_process.ps1) to locate the visible V2.8 window.
2. If the user needs a ready-made case, use the bundled AWL in [assets/bag-pulse-dust-collector-4bags-ob1.awl](./assets/bag-pulse-dust-collector-4bags-ob1.awl).
3. If writing or editing AWL, keep it LAD-friendly:
   - wrap OB1 logic in `ORGANIZATION_BLOCK OB1`
   - keep one `NETWORK` to one rung or action
   - split independent `MOV`, `TON`, `S`, `R`, and output assignments into separate networks
4. For V2.8, prefer the verified keyboard flow:
   - `Ctrl+F1` imports into the active block tab
   - `Ctrl+F3` exports the active block tab
   - `Ctrl+F6` compiles the project
5. Treat success as a combination of:
   - import or export output contains a success line
   - compile output contains zero errors
   - visible invalid network count is zero when LAD rendering matters
6. Do not save or overwrite the `.smart` project unless the user explicitly asks.

## Verified V2.8 Rules

- Exported block files are plain `ANSI/GBK`, not UTF-8.
- The active editor tab matters for `Ctrl+F1` and `Ctrl+F3`; tree selection alone is not enough.
- For subroutines, display name mismatches can break callers even when the block number is still `SBR15`.
- If compile shows a missing-subroutine call and the output lists `SBR_15 (SBR15)` instead of the expected Chinese block name, reimport a prepared ANSI file whose subroutine display name matches the intended block name.

## Reusable Commands

Find the open V2.8 process:

```powershell
& "$PSScriptRoot\scripts\find_open_200smart_process.ps1"
```

Capture the current 200SMART window:

```powershell
& "$PSScriptRoot\scripts\capture_200smart_window.ps1" `
  -OutputPath ".\mwsmart_window.png"
```

Read the output window:

```powershell
& "$PSScriptRoot\scripts\read_200smart_output_window.ps1"
```

Prepare an AWL file for V2.8 import using local ANSI/GBK encoding and an optional subroutine display name:

```powershell
& "$PSScriptRoot\scripts\prepare_200smart_awl_file.ps1" `
  -SourcePath "C:\path\to\edited.awl" `
  -BlockDisplayName "脉冲气动" `
  -OutputPath "C:\path\to\脉冲气动.awl"
```

Export the active block with `Ctrl+F3`:

```powershell
& "$PSScriptRoot\scripts\export_active_block_200smart_v28.ps1" `
  -OutputPath "C:\path\to\故障报警.awl"
```

Import the active block with `Ctrl+F1` and compile with `Ctrl+F6`:

```powershell
& "$PSScriptRoot\scripts\import_active_block_and_compile_200smart_v28.ps1" `
  -AwlPath "C:\path\to\脉冲气动.awl" `
  -ScreenshotPath ".\mwsmart_active_block_compile.png"
```

Import the bundled OB1 example and compile it:

```powershell
& "$PSScriptRoot\scripts\import_and_compile_200smart_v28.ps1" `
  -UseBundledBagPulse4 `
  -ScreenshotPath ".\mwsmart_v28_compile.png"
```

Import a custom OB1 AWL and compile it:

```powershell
& "$PSScriptRoot\scripts\import_and_compile_200smart_v28.ps1" `
  -AwlPath "C:\path\to\your.awl" `
  -ScreenshotPath ".\mwsmart_v28_compile.png"
```

## Bundled Case

Use the bundled four-bag pulse dust collector example when the user asks for a default working program.

- AWL: [assets/bag-pulse-dust-collector-4bags-ob1.awl](./assets/bag-pulse-dust-collector-4bags-ob1.awl)
- Address and parameter notes: [references/bag-pulse-dust-collector-4bags.md](./references/bag-pulse-dust-collector-4bags.md)

## Read When Needed

- For the bundled example logic and addresses, read [references/bag-pulse-dust-collector-4bags.md](./references/bag-pulse-dust-collector-4bags.md).
- For encoding issues, block-name drift, active-tab import behavior, save prompts, and invalid networks, read [references/troubleshooting.md](./references/troubleshooting.md).

