Metin Dosyasını Okuma İçin Aç
Komut: openTextReader
Yolu, paylaşım iznini ve daha sonra dosyayı değiştirebilecek kodlamayı kullanarak okunabilir bir metin dosyası açar.
Sözdizimi
openTextReader --share(AutomationFileShare) --path(String) --encoding(EncodingType) (TextFileReader)=value
Girişler
| Komut Dosyası | Tasarımcı | Zorunlu | AcceptedTypes | Açıklama |
|---|---|---|---|---|
| -- paylaş | Paylaşım Seçenekleri | Zorunlu | AutomationFilePaylaşımı | Dosya açıkken dosya içinde işlem gerçekleştirmenize olanak tanıyan seçenek: |
| -- yol | Yol | Zorunlu | Metin | Okunması gereken metin dosyasının tam yolu. |
| -- kodlama | Kodlama | Zorunlu | EncodingType | Metin dosyasını okumak için kullanılan karakter kodlaması: |
Çıkışlar
| Komut Dosyası | Tasarımcı | AcceptedTypes | Açıklama |
|---|---|---|---|
| değer | Metin Okuyucu | Metin Dosyası Okuyucu | Metin dosyası okumak için açıldı. |
Örnek
Okunmak üzere Metin Dosyasını Aç komutu girilen metin dosyasını açar ve ardından Metin Dosyası Satırını Al komutu, dosyanın ilk satırının içeriğini döndürür.
defVar --name textReader --type TextFileReader
defVar --name displayedText --type String
// In this excerpt, the statement finds the text file and stores it open for reading in a variable named "readerText".
// Download the following file to execute the command.
openTextReader --share "Read" --path "fileText.txt" --encoding "Default" textReader=value
textReadLine --linenumber 1 --file ${textReader} displayedText=value
logMessage --message "${displayedText}" --type "Info"
// The example displays the first line of text from the given file.
For the correct operation of the script above, it is necessary to download the file and enter its path in the Yol parameter of the Metin Dosyasını Okumak İçin Aç command.
Notlar
The output variable Metin Okuyucu stores the text file that can be opened by commands such as Metin Dosyası Satırını Al, allowing only the changes selected in the Paylaşım Seçenekleri parameter.