Writing Files on a Mobile Device using FILECTL

If you want to write files on a mobile device, this can be easily accomplished using a little VBScript.

I was trying to use the FileSystemObject component to write files. However, the file storage component is managed differently on PocketPC 2002/03, Windows CE 4.2 (and above) devices such as the HP iPAQ, Symbol 9090 etc. Instead of FileSystemObject, the FILECTL component needs to be called. FileCtl is the FSO equivalent for Windows CE.

Following is the VBScript code:

Dim objTextFile, strText
strText = “This is my string of data”

‘ objTextFile.Open needs the following Const values:
‘ ForAppending, fsAccessWrite, fsLockReadWrite
Const ForAppending = 8
Const fsAccessWrite = 2
Const fsLockReadWrite = 0

Const objFilePath = “\Temp\MyFile.txt”

Set objTextFile = CreateObject(“FILECTL.File”)
objTextFile.Open objFilePath, ForAppending, fsAccessWrite, fsLockReadWrite

‘ Writes strText every time you run this VBScript
objTextFile.LinePrint(strText)

objTextFile.Close
set objTextFile = nothing

For reference, you can go to:  http://msdn2.microsoft.com/en-us/library/ms860108.aspx

If you know of a better way accomplishing this, feel free to share!

Related Posts

1 Comment so far

  1. [...] for Windows CE Hope this helps: http://www.sandboxm.com/enabling-filectl-on-devices/ « DeviceIOControl,Sending video buffer address from [...]

Leave a reply