Your variable originalDateString got coerced to a list in your bigger script.
from "Mon 22nd April" to {"M", "o", "n", " ", "2", "2", "n", "d", " ", "A", "p", "r", "i", "l"}
so, text item 3 in the list is "n".
place in your code, before setting the text item delimiter
set originalDateString to originalDateString as text
.
Text item delimiter.
I don't bother to save it to a variable "tid". I just set it back to it's default "", an empty string. Text item delimiters only changes when we temporarily need it. By saving it to a variable you might backup an uncorrect tid and restore this mistake. So, set it to it's default "".
handler based on your example
set originalDateString to items of "Mon 22nd April" -- 'items of' to test with a list
set dateItems to my getDateItems(originalDateString) -- 'dateItems', list of 3 items
-- or declare 3 variables at once
set {dayOfWeekAbbrev, dayOfMonth, monthName} to my getDateItems(originalDateString)
on getDateItems(someText as text)
try
set AppleScript's text item delimiters to " "
set {ti1, ti2, ti3} to {text item 1, text item 2, text item 3} of someText
set AppleScript's text item delimiters to ""
return {ti1, ti2, ti3}
on error errorMessage number errorNumber
set AppleScript's text item delimiters to ""
error ((name of me) & linefeed & "....> getDateItems()" & linefeed & linefeed & errorMessage) number errorNumber
end try
end getDateItems
Post
Replies
Boosts
Views
Activity
tell application "System Events" to tell process "NotificationCenter"
if not (window "Notification Center" exists) then return
tell button 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Notification Center"
set {theAction} to get name of every action whose name contains "close" or name contains "Clear All"
perform action theAction
end tell
end tell
use the following in your .plist instead
<key>LSBackgroundOnly</key>
<integer>1</integer>
And check Notification Center settings specifically for your applet. While editing your applet, de editor is the one sending the notifications. While running the applet, it's the applet who sends the notifications. So, maybe that's why it works while editing but not when you run the applet.
short answer: NO
Long answer: Possible, but you will have to learn javascript.
This is the same for every browser, they offer commands and classes to manipulate the window and tabs and only one command to manipulate HTML through javascript.
For Google Chrome that's the command "execute". With this command you can do what ever javascript can do, but you have to know/learn the language.
Warning, while I'm familiar with AppleScript, not so with scripting Word.
I checked the dictionary and oh boy, the number of commands and classes is quite overwhelming. I'm impressed by the extent that Microsoft made Word scriptable. But for a beginner maybe the worst application to start scripting.
The command you use, print out, is deprecated and Microsoft recommends to use the Standard Suite command print, which is the standard print command for most applications.
Nonetheless I tried both commands. Only with the Standard Suite command 'print' I could print. But only after I saved the document first. With a new unsaved document it does not work.
That said, GUI scripting is a the rescue for such cases. Also for cases where the application is not scriptable and has no dictionary! GUI scripting is done through the application 'System Events'.
We have 2 commands availble, keystroke and click.
Keystroke, as the name implies, simulates a keystroke. The only requirement is to make sure the application is frontmost.
tell application "System Events"
tell application process "Word"
set frontmost to true -- to make sure the next command, keystroke, is send to Word
keystroke "p" using {command down}
end tell
end tell
Click a menu item, File > Print ...
tell application "System Events" to tell application process "Word" to click menu item "Print..." of menu 1 of menu bar item "File" of menu bar 1
hope this helps
I interpret the error in a different way.
Can't load Perl Encode.bundle ... trie another ... failure ... ... trie another ... failure, can't find the other ... trie another ... failure
and each time (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
I read this as, tried to open Perl encode.bundle, it's a mach-o file and you have 64 while this file needs x86_64.
Looks like a Perl issue not a AppleScript issue. Don't know the script and thus don't know how you make the call to Perl.