Отправка команды на com port #616158


#0 by babiy
Здраствуйте. Мне нужно отправить команду на компорт (оборудование)из 1С 8.1. Как это можно реализовать? Напрямую через 1С или ВК?
#1 by palpetrovich
сам как думаешь?
#2 by Kreont
Как вариант:
#3 by Jaap Vduul
#4 by Jaap Vduul
- это на чтение На запись: com1 = fso.OpenTextFile("com1:", 2, Ложь, 0);
#5 by palpetrovich
что, правда прокатит?
#6 by Jaap Vduul
Про DOS слышал?
#7 by palpetrovich
а то
#8 by palpetrovich
+7 проверил на ХР, действительно, в лоб файл com1 не создать :) ...хотя умельцы умеют
#9 by babiy
Извините, а можна подробней о параметрах: у меня в отладке: com1.AtEndOfLine = Ошибка чтения значения com1.AtEndOfStream = Ошибка чтения значения com1.Column = 1 я з 1С недолга работаю и с ком-портом первый раз.
#10 by mikecool
а тупо бат формировать с "copy file com1" или как там в досе было?
#11 by babiy
Подробней о OpenTextFile: Description Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file. object.OpenTextFile(filename[, iomode[, create[, format]]]) The OpenTextFile method has these parts: Part Description object Required. Always the name of a FileSystemObject. filename Required. String expression that identifies the file to open. iomode Optional. Indicates input/output mode. Can be one of three constants: ForReading, ForWriting, or ForAppending. create Optional. Boolean value that indicates whether a new file can be created if the specified filename doesn't exist. The value is True if a new file is created; False if it isn't created. The default is False. format Optional. One of three Tristate values used to indicate the format of the opened file. If omitted, the file is opened as ASCII.   Settings The iomode argument can have either of the following settings: Constant Value Description ForReading 1 Open a file for reading only. You can't write to this file. ForWriting 2 Open a file for writing only. You can't read from this file. ForAppending 8 Open a file and write to the end of the file. The format argument can have any of the following settings: Constant Value Description TristateUseDefault -2 Opens the file using the system default. TristateTrue -1 Opens the file as Unicode. TristateFalse  0 Opens the file as ASCII. Remarks The following code illustrates the use of the OpenTextFile method to open a file for writing text:  f.Close End Sub" Microsoft® Visual Basic® Scripting Edition
#12 by babiy
Но здесь указываеться файл .txt, а как указать ком-порт?
#13 by Shurjk
С точки зрения системы когда она пишет в файл который называется COM1 она пишет в ком порт.
#14 by smaharbA
восьмерка может это делать и объектом ТекстовыйДокумент вот пути правильно таковые \.com1
#15 by Shurjk
Вообще все равно как это делать. Вот только с чтением этот вариант врят ли поможет. Ком порт он ведь не стоит и не ждет пока ты его прочитаешь, он отправил данные и все твоя задача успеть их поймать.
#16 by Shurjk
+ Короче надо по любому писать ВК или найти уже готовое, которое будет уметь слушать ком порт.
#17 by babiy
Мне читать ненужно, мне толька подавать команды и писать. Всем большое спасибо!!! Буду тестировать. Щас нету просто возможности увидить попадает в компорт или нет.
#18 by babiy
Здраствуйте. В ком нечего не попадает. Вот код который я использую: В чем может быть проблема?
Тэги: 1С 8
Ответить:
Комментарии доступны только авторизированным пользователям

В этой группе 1С