
Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
|
10.12.2003, 14:23
|
|||
|---|---|---|---|
Работа с текстовым файлом |
|||
|
#18+
Наткнулся случайно в Access XP (дурацкая там все-таки справка по сравнению с 97!!!) на интересный способ работы с текстовыми файлами. Нужно подключить библиотеку Microsoft Scripting Runtime, после чего становятся доступны такие объекты как FileSystemObject, TextStream...: На мой взгляд - это удобнее чем использование Open "TESTFILE" For Random As #1... Dim fs As FileSystemObject Dim a As TextStream dim source as string, str as string source = "c:\MyText.txt" Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.OpenTextFile(Source, ForReading, False) Do While Not a.AtEndOfStream str = a.ReadLine() Debug.Print str 'a.SkipLine Loop a.Close Самое интересное, что первоначальное назначение библиотеки - кодирование скриптов в веб-страницах для защиты от их незаконного копирования Вот пример, взятый с сайта microsoft Public Sub EncodePage() ' Sample encoder ' Andrew Clinick Jan 1999 ' Obviously this code could do with some error trapping etc ' but it should give you the basics to get started Dim strHTML As String ' Get the Frontpage document Dim mydoc As FPHTMLDocument ' Create a new instance of the scripting.encoder object Dim myEncoder As New Scripting.Encoder ' Get the current active document Set mydoc = ActiveDocument ' Get the HTML for the active document strHTML = mydoc.DocumentHTML ' Call the encodescriptfile method with the HTML strHTML = myEncoder.EncodeScriptFile(".htm", strHTML, 0, "") ' Set the documentHTML to be the return HTML with encoded script mydoc.DocumentHTML = strHTML ' We're done! End Sub ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|

start [/forum/topic.php?fid=45&mobile=1&tid=1677731]: |
0ms |
get settings: |
11ms |
get forum list: |
20ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
62ms |
get topic data: |
14ms |
get forum data: |
4ms |
get page messages: |
42ms |
get tp. blocked users: |
2ms |
| others: | 240ms |
| total: | 403ms |

| 0 / 0 |
