Esto tiene que ser bastante sencillo. Estoy usando Applescript con Pashua: Diálogos nativos de MacOS para lenguajes de scripting . Lo que estoy tratando de hacer es introducir datos en un campo de texto en un cuadro de diálogo, y luego copiar ese campo de texto en el portapapeles cuando el cuadro de diálogo se cierra. Simplemente estableciendo el portapapeles a la variable tf
no funciona.
Cómo puedo conseguir que este script copie el contenido de tf
al portapapeles? La ventana de resultados de Applescript muestra {tf:"testme"}
para una entrada de testme
, pero no quiero la marca de salida, sólo el texto testme
copiado en el portapapeles.
La parte relevante del script está en la parte inferior del script completo:
-- Get the path to the folder containing this script
tell application "Finder"
set thisFolder to (container of (path to me)) as string
if "Pashua.app:" exists then
-- Looks like the Pashua disk image is mounted. Run from there.
set customLocation to "Pashua:"
else
-- Search for Pashua in the standard locations
set customLocation to ""
end if
end tell
try
set thePath to alias (thisFolder & "Pashua.scpt")
set pashuaBinding to load script thePath
tell pashuaBinding
-- Display the dialog
try
set pashuaLocation to getPashuaPath(customLocation)
set dialogConfiguration to my getDialogConfiguration(pashuaLocation)
set theResult to showDialog(dialogConfiguration, customLocation)
on error errorMessage
display alert "An error occurred" message errorMessage as warning
end try
end tell
on error errStr number errorNumber
display dialog errStr
end try
-- Returns the configuration string for an example dialog
on getDialogConfiguration(pashuaLocation)
if pashuaLocation is not "" then
end if
return "
# Set window title
*.title = Page Settings
# Add a text field
tf.type = textfield
tf.label = Example textfield
tf.width = 310
"
set the clipboard to tf -- how do I set this variable to the clipboard?
end getDialogConfiguration
0 votos
do shell script “‘abcd’ | pbcopy”
. A ver si puedes conseguir la variable en lugar de la cadena abcd0 votos
El shell script no tiene acceso a las variables Pashua.