Salvando o resultado da execução do applescript no arquivo de texto

1

No meu script, obtenho as propriedades do elemento da interface do usuário de um aplicativo e ele é salvo na forma de uma lista em uma variável. Eu quero salvar essa variável em um arquivo de texto. Como faço isso?

    
por Sakshi Goyal 09.12.2014 / 12:34

2 respostas

0

Você pode tentar algo como:

-- Example elements
tell application "System Events" to tell process "Finder"
    set uiElements to (get UI elements)
end tell


set uiTextList to {}
repeat with uiE in uiElements
    try
        set uiText to uiE as text
        set end of uiTextList to uiText
    on error errMsg
        set {TID, text item delimiters} to {text item delimiters, {"Can’t make ", " into type text."}}
        set end of uiTextList to text item 2 of errMsg
        set text item delimiters to TID
    end try
end repeat

do shell script "echo " & quoted form of (uiTextList as text) & " > " & quoted form of POSIX path of (path to desktop as text) & "log.txt"
    
por 09.12.2014 / 16:28
0

Tente desta maneira:

set the textFile to ((path to desktop) as text) & "filename.txt"
open for access file the textFile with write permission
write ("Whatever you want to write" & return) to file the textFile starting at eof
close access file the textFile
    
por 09.12.2014 / 13:10