3/23/2012 11:07 AM | |
Joined: 4/29/2010 Last visit: 1/20/2025 Posts: 1557 Rating: (161)
|
Hello, have you considered that a panel have got a WinCE OS and needs other comands then a XP pc? best regards |
3/23/2012 5:54 PM | |
Joined: 1/30/2006 Last visit: 1/8/2025 Posts: 104 Rating: (16) |
Selamidal, The attached PDF file contains my edits to your script. I have tested this on an MP377, the closest thing I have to your MP277 at the moment. Both are CE operating systems. Therevised script now does work withoutthrowing an error. Problem #1here is that VBScript file handling differs between the CE and Windows PC operating environments. This distinction is not always clearly noted in the WinCC Flex help files, but if you look in the Help File contents under the following help path, Working with WinCC flexible --> Reference -->VBScript for Windows CE, you will find a good list of the supported file properties and methods for when you need to code for a CE-based panel. Problem #2 is that what you write for one system (e.g. CE, MP277), you cannot really debug test on the other (e.g. PC, Windows Runtime). With this problem, I know of no help unless you have both systems readily available. Some items to note: 1) For CE panels, your CreateObject statements should look something like this: Set fso = CreateObject("filectl.filesystem") Set fo = CreateObject("filectl.file") Of course, your object names are up to you, but what is in quotes must be followed. The fso (File System Object) is needed onlyfor scanning the directory (folder) to see whether a file already exists.Its methods differ from the PC implementation, which brings me to the next point. 2) In the CE panels, FileExists is not a legitimate function of the file system object. Instead, we can write If fso.dir(file_Path_Name) = "" Then . . . Notice that I do not use the SmartTag object in the parenthesis, but instead use a declared script variable to store the file path and name. For whatever reason, the SmartTag object was not gracefully handled in my system. The string value is, nevertheless, the same in both the SmartTag and in the script variable. 3) There is no text stream object in CE. Instead we simply open the fo (File Object) and, after reading or writing, close it like this: fo.Open SmartTags("file"), f_Output ... 'Some file write stuff here fo.Close Notice that the SmartTag object works fine here. Also, notice the f_Output variable. This is defined a part of a list of file options in my edited version of the script at the beginning according to information in the VBScript CE help file. That list is f_Input = 1 f_Output = 2 f_Random = 4 f_Append = 8 f_Binary = 32 4) Lastly, CE does not support the WriteLine method. Instead use the following: fo.LinePrint DataSet Hopefully, that info will be of use. If you have further questions, feel free to post again. However, the real key here is to focus on the VBScript examples in the CE reference section of the help file. Kind regards The Captive Engineer AttachmentSelamidal_Script.pdf (2152 Downloads) |
This contribution was helpful to4 thankful Users |
Follow us on