WinCC flexible VBScript FTP File Transfer from SIMOTION to OP277

David Krause13 min read
HMI / SCADASiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview: FTP File Transfer from SIMOTION to OP277 HMI

Production cells that combine a SIMOTION motion controller with an OP277 operator panel frequently need to move inspection bitmaps (.bmp) captured by a connected camera from the controller's flash file system to the HMI for operator visualization. The naive assumption that the same WinCC flexible VBScript that runs on the engineering PC will also run on the OP277 is the source of most failed implementations. The OP277 executes a constrained Windows CE 5.0 scripting runtime that does not expose the same COM object surface as the PC runtime. This reference documents the working field-proven paths for moving image files from SIMOTION to OP277, the underlying VBScript object model differences between PC and CE targets, the GetObject UNC share technique, and the HTML browser preview fallback for panels that do not have Internet Explorer components installed.

System Context and Component Reference

The implementation discussed here targets the following Siemens hardware and software versions, all of which must be cross-checked against the project hardware catalog:

Component Designation Firmware / Build Role
Motion controller SIMOTION D435 FW V4.2 or later FTP server, file storage, image capture trigger
HMI panel OP277 6" / OP277 10" WinCC flexible 2008 SP3 image Operator visualization, runtime host
Engineering software SIMOTION SCOUT V4.4 SIMOTION project configuration, FTP user setup
HMI engineering WinCC flexible 2008 SP3 HF7 recommended VBScript authoring, panel image build
Network Industrial Ethernet TCP/IP, PROFINET-compatible switch FTP transport layer

The SIMOTION D4x5 series exposes an integrated FTP server through its Ethernet interface. Default credentials and root paths are configured in SCOUT under the controller's Web server / FTP settings. Bitmaps saved by the application program to the user file system (\USER\ or \CARD\) become available at the corresponding FTP URL, for example ftp://192.168.1.24/USER/capture.bmp.

Network Topology and IP Planning

A successful FTP workflow requires both endpoints to share an IP subnet and to permit the FTP control channel (TCP/21) plus data channel (TCP/20 in active mode, dynamic in passive mode). The OP277 implementation discussed here used the following fixed addressing scheme:

SIMOTION D435    : 192.168.1.24  / 255.255.255.0
OP277 10"        : 192.168.1.20  / 255.255.255.0
Engineering PG/PC: 192.168.1.10  / 255.255.255.0
Default gateway   : 192.168.1.1
SIMOTION controllers ship with FTP in passive mode by default. If the OP277 sits behind a stateful inspection firewall or a managed switch performing deep packet inspection, explicitly pin the FTP mode in SCOUT and verify that data-channel ephemeral ports are not blocked.

VBScript Object Model: PC Runtime vs WinCE Panel

The Windows Script Host on a desktop operating system exposes the full WScript object hierarchy, including the ability to instantiate arbitrary COM classes via CreateObject("progid"). The WinCC flexible Runtime on the OP277 runs on Windows CE 5.0 with a deliberately trimmed VBScript engine. The relevant differences are:

VBScript feature WinCC flexible PC Runtime OP277 / CE Runtime
CreateObject on arbitrary progids Supported Not supported (returns "can't create object")
GetObject on shell namespace items Supported Limited support for known file-system objects
FileSystemObject Available via CreateObject Not directly available; CE exposes its own file APIs
WinHttp.WinHttpRequest Available Not available on stock image
WScript.Shell Available Not available
HTML rendering Internet Explorer component Not present unless explicitly added to image

A script that calls CreateObject("Scripting.FileSystemObject") on the engineering PC runs without warning. The identical script deployed to the OP277 fails at runtime with a Windows CE error dialog stating that the object cannot be created. The root cause is not project configuration; it is the absence of the COM registration in the CE runtime image.

Native FTP Transfer Script for PC Runtime

On the engineering PG/PC or any panel that runs WinCC flexible Runtime with full Windows scripting support, a working download script can use the Windows native FTP command-line client driven by a pre-generated script file. The technique below was confirmed in production environments and is included here as the baseline before describing the panel-side limitations.

Script: FTP_Download_PCRuntime

' VBScript executed under WinCC flexible PC Runtime
' Source: SIMOTION FTP root, Target: local PC path

Dim sFTPHost, sUser, sPass, sRemoteFile, sLocalFile
Dim sCmdFile, sCmdPath, oFS, oShell, iRet

sFTPHost    = "192.168.1.24"
sUser       = "simotion"
sPass       = "simotion"
sRemoteFile = "/USER/capture.bmp"
sLocalFile  = "C:\Temp\capture.bmp"
sCmdPath    = "C:\Temp\ftp_script.txt"

Set oFS = CreateObject("Scripting.FileSystemObject")
Set oTs = oFS.CreateTextFile(sCmdPath, True)
oTs.WriteLine "open " & sFTPHost
oTs.WriteLine sUser
oTs.WriteLine sPass
oTs.WriteLine "binary"
oTs.WriteLine "get " & sRemoteFile & " " & sLocalFile
oTs.WriteLine "bye"
oTs.Close

Set oShell = CreateObject("WScript.Shell")
iRet = oShell.Run("ftp -n -s:""" & sCmdPath & """", 0, True)

If iRet = 0 Then
    HMIRuntime.Trace "FTP download OK: " & sLocalFile
Else
    HMIRuntime.Trace "FTP download FAILED, code=" & iRet
End If
The above pattern depends on CreateObject and on the FTP.EXE utility being present on the host. Neither is reliably present on a stock OP277 image, so this script is the reference baseline only.

GetObject Network Share Approach

The first technique that survives the move from PC runtime to OP277 runtime is the GetObject call against a UNC path. The CE engine on the panel handles a small set of shell-namespace objects, and a Bitmap file referenced by a UNC path is one of them. The syntax confirmed in field use is:

Script: GetObjectBMP_OP277

' VBScript executed under WinCC flexible on OP277
Dim MyObject
Set MyObject = GetObject("\\192.168.1.24\Sheard\2.bmp")
' MyObject now references the BMP file as a shell-namespace item

The UNC path \\192.168.1.24\Sheard\ in this example maps to a shared folder exposed either by the SIMOTION controller's SMB/CIFS share or by a Windows PC on the same subnet acting as a file relay. The 2.bmp portion is the bitmap that the camera wrote to the SIMOTION file system and that has been either mirrored or directly shared from that path.

Two structural requirements must be met for this to work on the OP277:

  1. The remote host serving the share must publish the folder over SMB/CIFS using a security model compatible with the CE runtime's authentication handler. Plain-text LM/NTLM authentication is acceptable on CE; NTLMv2-only configurations will reject the connection.
  2. The OP277 must be able to resolve the host name and reach port TCP/445. Verify with a ping from the OP277 service desktop (accessible via the panel's start menu on developer image builds).
A reference design pattern is to place a small industrial PC (for example an IPC227G or a SIMATIC Box PC) between the SIMOTION controller and the OP277. SIMOTION drops the bitmap into a local folder via FTP; the IPC continuously mirrors that folder and exposes it as a Windows share; the OP277 pulls the file by UNC path through GetObject. This topology avoids putting a fragile Windows share on the SIMOTION controller itself.

HTML Browser as a Display Workaround

Once the bitmap has been referenced as a GetObject handle, the next engineering question is how to display it inside a WinCC flexible screen. The OP277's "Enhanced" graphic objects cannot render arbitrary bitmaps loaded at runtime — they only display bitmaps that were imported into the project at compile time and assigned by name. Loading a file-system bitmap into a graphic view requires either (a) the HTML browser activeX control, or (b) a custom C-script extension that calls the panel's native draw APIs.

The HTML browser control accepts an HTML page that contains an <img src="..."> tag. The source can be:

  • A static HTML page stored on the panel's flash, pointing at a network path that the browser can resolve
  • An FTP URL: <img src="ftp://user:[email protected]/USER/capture.bmp">
  • An HTTP URL served by an IPC or by the SIMOTION's web server

The advantage of this approach is that the file does not have to be copied to the panel at all. The browser fetches it directly over the network, renders it, and disposes of the temporary cache automatically when the screen changes. The disadvantage is the prerequisite: the OP277 must host a usable HTML browser component.

Enabling Internet Explorer Components on the OP277

Stock OP277 images historically shipped without an HTML browser activeX. The runtime can host an HTML view only after the corresponding CE component has been added to the OS image by the ProTool / WinCC flexible image builder. To add the browser:

  1. Open the panel image configuration in ProTool / WinCC flexible ES.
  2. Open the "Operating System" tab and select the target version (WinCC flexible 2008 SP3 or later).
  3. Locate the optional component "Internet Explorer" or "HTML Browser" in the add-on list.
  4. Add the component and rebuild the panel image. A full image rebuild typically takes 8 to 20 minutes depending on the host PC.
  5. Transfer the new image to the OP277 via the standard image update procedure (Ethernet or serial using ProSave).
  6. Reboot the panel. Confirm the HTML browser is now listed under the start menu's "Programs" folder.
Once Internet Explorer is present, the SIMOTION FTP URL becomes directly addressable from the panel's start menu as well as from inside WinCC flexible Runtime. Test by opening ftp://192.168.1.24/USER/ in the panel browser before adding the runtime HTML view to the project.

Display Constraints in Graphic View and Enhanced Objects

Even when a GetObject handle resolves successfully and an HTML browser is present, the bitmap cannot simply be assigned to a WinCC flexible "Graphic View" object. The graphic view is designed for static, project-time imports. The supported runtime image-display mechanisms on the OP277 are:

Display mechanism Runtime image support? Notes
Graphic IO field (static) Yes Image is set at compile time only
Graphic View (enhanced) Limited Supports animation but not runtime file load
HTML Browser control Yes (if installed) Recommended path for runtime bitmaps
ActiveX via C-script extension Project-specific Requires custom DLL, not portable
WinCC flexible Trend/Picture (Camera) No Different feature, unrelated

Alternative: Direct FTP Preview Without File Copy

Once the OP277 has the HTML browser control installed, the simplest production pattern is to embed an HTML page in the project that points at the SIMOTION FTP share directly. The page is stored in the project under \Project\Pictures\preview.htm and the browser control's URL property is set to that local file. The HTML references the SIMOTION FTP URL for the bitmap:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="refresh" content="5">
  </head>
  <body style="margin:0;background:black;">
    <img src="ftp://simotion:[email protected]/USER/capture.bmp"
         style="width:100%;height:auto;">
  </body>
</html>

The five-second refresh forces the browser to refetch the bitmap. The camera application on SIMOTION overwrites capture.bmp at its capture cadence, so the operator sees a near-live preview without any explicit copy operation. This pattern avoids the panel-side scripting limitations entirely because the file transport is handled inside the browser engine, not inside the VBScript host.

SFTP Alternatives for Modern Deployments

Where the application must use SFTP (for example, because the receiving host is a hardened Linux server or because the security policy prohibits plaintext FTP), the OP277's CE runtime cannot host an SFTP client natively. Two practical options exist:

  1. Place an industrial gateway PC running WinSCP or OpenSSH on the network. SIMOTION writes bitmaps to a local share; the gateway pushes them via SFTP using a scheduled winscp.com /script=... job. The OP277 continues to display via HTTP URL pointing at the gateway's web server.
  2. Use the WinSCP COM interface from a WinCC flexible script running on the PC runtime (not on the OP277). CreateObject("WinSCP.Session") is fully supported on desktop Windows and is documented in the WinSCP scripting guide; for VBScript-specific guidance see the Microsoft Q&A discussion on SFTP file transfer using VBScript. The same pattern cannot be moved to the OP277 because the WinSCP COM is not registered on the CE image.

Troubleshooting Matrix

Symptom Likely root cause Diagnostic step Remediation
"Can't create object" on OP277 VBScript tried to instantiate a COM class not in the CE image Trace the failing line with HMIRuntime.Trace Replace with HTML browser or move the script to PC runtime
GetObject returns Nothing UNC share not reachable, name resolution failure, NTLMv2-only Test \<ip>\<share> from a desktop machine first Enable LM/NTLM on the share, verify TCP/445
HTML browser displays blank Browser component not installed on panel image Check Programs menu on OP277 Rebuild panel image with HTML browser component
FTP URL shows 550 error in browser SIMOTION FTP user lacks read permission for the path Test the URL from a desktop FTP client Adjust the FTP user rights in SCOUT
Bitmap loads but graphic view stays empty Graphic view does not support runtime file load Inspect object properties in the editor Use HTML browser control instead
Refresh of the preview stalls after a few minutes FTP session pool exhausted on SIMOTION Check SIMOTION web/FTP diagnostics Restart the FTP service or set the HTML meta-refresh longer
Network share intermittent on a managed switch Spanning-tree or storm control dropping SMB Verify port counters on the switch Set the panel port to edge / fast-forward

Verification and Commissioning Procedure

  1. Confirm the SIMOTION FTP server is reachable from the engineering PC: ftp 192.168.1.24 with the configured user and password, then dir /USER. The captured bitmap should appear.
  2. Copy the bitmap manually to the engineering PC desktop using get /USER/capture.bmp. Open it in a viewer to confirm a valid image.
  3. On the OP277, open the service desktop and verify ping 192.168.1.24 succeeds with sub-3 ms latency.
  4. If the panel image includes the HTML browser, open it from the Programs menu and navigate to ftp://192.168.1.24/USER/capture.bmp. The image should render.
  5. Deploy the WinCC flexible project containing the HTML browser control. Trigger the camera capture from the SIMOTION program and verify the preview updates in the runtime screen.
  6. Force a panel reboot and confirm the FTP preview resumes without manual intervention. The refresh meta-tag should drive the recovery.
  7. Document the FTP credentials, paths, and refresh interval in the project Functional Specification so that subsequent maintenance does not require re-derivation.

Engineering Recommendations

When the choice between transferring the file versus referencing it directly is open, prefer referencing it directly. The direct-reference pattern (HTML browser pointing at the SIMOTION FTP URL or at an IPC-hosted HTTP mirror) has the lowest panel-side resource footprint, requires no VBScript, and survives panel firmware updates cleanly. Copying the file into the panel's MMC is justified only when the panel must operate fully disconnected from the network — an unusual requirement for cells where the SIMOTION is the data source anyway.

If a runtime VBScript copy is unavoidable, deploy it on the engineering PC or on an IPC, never on the OP277 itself. The CE runtime's VBScript host is intentionally minimal and adding the missing components requires a full OS image rebuild, which most production environments cannot accommodate on a live panel.

FAQ

Can the OP277 run a WinCC flexible VBScript that calls CreateObject?

No. The OP277's Windows CE 5.0 runtime does not expose arbitrary COM classes through CreateObject. Calls fail at runtime with "can't create object". Move object-creating scripts to the PC runtime or to an IPC, or replace the script with an HTML browser control that fetches the resource directly.

Does GetObject work on the OP277 for BMP files?

Yes, for BMP files reachable via a UNC path on an SMB share that the CE authentication handler accepts. The syntax is GetObject("\\<ip>\<share>\<file>.bmp"). NTLMv2-only shares will not authenticate; LM/NTLM must be enabled on the host.

How do I add an HTML browser to the OP277?

Open the panel image in ProTool / WinCC flexible ES, add the Internet Explorer / HTML Browser component under the OS tab, rebuild the panel image, transfer it via ProSave, and reboot the panel. The browser then appears in the Programs menu and is usable from WinCC flexible Runtime.

Can the OP277 connect to an SFTP server directly?

No, not with the stock WinCC flexible image. There is no SFTP client in the CE runtime. Route SFTP transfers through an IPC running WinSCP or OpenSSH and let the OP277 fetch the result over HTTP.

What is the simplest way to show a live camera bitmap from SIMOTION on the OP277?

Add the HTML browser component to the OP277, embed a small HTML page with <meta http-equiv="refresh" content="5"> and an <img src="ftp://user:[email protected]/USER/capture.bmp"> tag, then place the page in a WinCC flexible HTML browser control. No VBScript is required and no file is copied to the panel.

Back to blog