Is it possible to hide applications and there actions while they are in use by an applescript?
I have an applescript written that requires a few programs to open and close, open new documents, etc. I was wondering if there was any way to hide them while the script is running, so I can continue to use my desktop instead of having windows constantly popping up. I don’t know if I can hide them behind the desktop image or something. Or I might be just dreamin. As usual, thanks in advance guys. You are always most helpful.
What if I want the actions of the program not to appear on screen as well? Such as:
Open Text Edit
Create New Text Doc
Add Text
Save Doc
Quit Text Edit
I have the script to make Text Edit’s Icon not show up in my toolbar when it is running, but the text document still appears on screen while the applescript is completing the actions.
How would this basic code be re-written to create the text document without using text edit?
set theText to "I Hate Cold Weather."
tell application "TextEdit"
if (front document exists) = true then
if (text of the front document) ≠"" then
make new document
end if
else
make new document
end if
set the text of the front document to theText
save the front document in "MacintoshHD:Users:test:desktop:weather opinion.txt"
quit without saving
end tell
set theText to "I Hate Cold Weather."
set theDocument to ((path to desktop as text) & "weather opinion.txt")
try
set ff to open for access file theDocument with write permission
write theText to ff
close access ff
on error
try
close access file theDocument
end try
end try
I have one more question seeing as you are so ridiculously helpful. The next hiccup I have is that this script is supposed to be adding text to a file already created. If the document doesn’t exist, then it should be created. I already wrote the script to check for the file, and as you can see basically create it. My hiccup is that once the script determines that the file exists, I need it to find the last line there is text on, and then insert the newly created text on the next line below. Such as:
Weather Opinion.txt Contents Below:
Text in line 1
Text in line 2
Text in line 3
Text in line 4
(I hate cold Weather)<—New Text Needs to be inserted here