Post

Replies

Boosts

Views

Activity

Reply to i've noticed many times that applescript doesn't take this syntax
Make a note to post actual code, never pictures of code - you aren’t going to get many replies when people have to type in your script or debug formatting errors from the text recognition framework. The error is from trying to use Reminders to get the start date of a Calendar event. You need to target the appropriate application to use its terminology, for example: -- Set the names of your calendar and reminders set calendarName to "appts" set remindersName to "appts" -- Get the current date and time set currentDate to current date -- Get the events from the calendar tell application "Calendar" set calendarEvents to every event of calendar calendarName whose start date is greater than currentDate repeat with theEvent in calendarEvents set eventTitle to summary of theEvent set eventStartDate to start date of theEvent set eventNotes to description of theEvent if eventNotes is missing value then set eventNotes to "(no notes)" -- Create a new reminder with the event details tell application "Reminders" to tell list remindersName make new reminder with properties {name:eventTitle, due date:eventStartDate, body:eventNotes} end tell end repeat end tell
May ’23
Reply to Click Drag function. Need Help with this Script I get Syntax Errors.
You get errors from stuff like declaring a handler in a tell statement, missing handlers or applications that perform commands such as mouse up, mouse move, and get mouse location, bad syntax for several if statements, and just bad formatting in general.  This script has no chance of running - where did you get it or the commands you are trying to use?
Feb ’23
Reply to Applescripting multi strings into one
To make sure a string is defined, you can initially declare it as an empty string, then replace the value as needed. Also, instead of 10 different variables, just use a list - that is what they are for. Since the strings are in a fixed order, items in a list can be assigned according to the selections, then the list coerced to a string, which will add them all together (selected or not): set stringsList to {"", "", "", "", "", "", "", "", "", ""} -- 10 items set the choices to {"Music Sharing", "Remove Network Icons", "Dual - Galley & Active", "HD video", "Hide Menu", "Hide Reactions", "Remove All Overlays", "Dual - Galley x2", "Remove Names", "Other"} set the response to (choose from list choices with prompt "Select Advanced Dial String Command(s). Use Command (⌘) to select multiple." with multiple selections allowed and empty selection allowed) if the response is not false then repeat with anItem in the response if contents of anItem is "Music Sharing" then set item 1 of stringsList to "306" if contents of anItem is "Remove Network Icons" then set item 2 of stringsList to "307" if contents of anItem is "Dual - Galley & Active" then set item 3 of stringsList to "308" if contents of anItem is "HD video" then set item 4 of stringsList to "309" if contents of anItem is "Hide Menu" then set item 5 of stringsList to "504" if contents of anItem is "Hide Reactions" then set item 6 of stringsList to "508" if contents of anItem is "Remove All Overlays" then set item 7 of stringsList to "606" if contents of anItem is "Dual - Galley x2" then set item 8 of stringsList to "608" if contents of anItem is "Remove Names" then set item 9 of stringsList to "102" if contents of anItem is "Other" then set item 10 of stringsList to text returned of (display dialog "Enter other advanced string command(s)" default answer "") end repeat return the stringsList as string
Jul ’22
Reply to Seeking suggestions - how to have versions of an Automator service workflow
If all you are doing is reading the XML file, I'm not sure what would corrupt it, but an idea similar to the AppleScript comment would be to add a variable to the workflow (both would be in the file). In a workflow's bundle, the /Contents/document.wflow file is a property list that declares the various actions with their settings (such as the script for the Run AppleScript action), action connections, workflow metadata, and any variables. By adding a variable for a version number to the workflow, your script can just look for the variable name and get its value instead of adding a file to the bundle - System Events includes a Property List Suite, so you can do something like: on run -- example set plistFile to (choose file with showing package contents) -- get the document.wflow file set variables to getPlistElement from {plistFile, "variables"} if variables is not missing value then repeat with anItem in variables -- multiple variables if |name| of anItem is "Version" then -- or whatever return first item of value of anItem -- the value is a list end if end repeat return missing value -- not found end run to getPlistElement from plistItems -- get specified element from plist structure by name or index try if (count plistItems) < 2 then error "item list contains too few items" tell application "System Events" set element to property list file ((first item of plistItems) as text) -- root element repeat with anItem in rest of plistItems -- add on the sub items set anItem to contents of anItem try -- handle an index number set anItem to anItem as integer end try set element to (get property list item anItem of element) end repeat return value of element end tell on error errmess number errnum -- not found, etc log "getPlistElement error: " & errmess & " (" & errnum & ")" -- or pass it on return missing value end try end getPlistElement
Feb ’22
Reply to Any Other way to access Textfield in UI scritping
Other key forms (name, range, ID, filter reference (whose/where), etc) can be used, but index is typical since the UI elements are grouped in lists. Note that there is not a consistent way to access the same element between application (or OS) versions, since the developer can rearrange and/or change things at will.
Replies
Boosts
Views
Activity
Jun ’23
Reply to i've noticed many times that applescript doesn't take this syntax
Make a note to post actual code, never pictures of code - you aren’t going to get many replies when people have to type in your script or debug formatting errors from the text recognition framework. The error is from trying to use Reminders to get the start date of a Calendar event. You need to target the appropriate application to use its terminology, for example: -- Set the names of your calendar and reminders set calendarName to "appts" set remindersName to "appts" -- Get the current date and time set currentDate to current date -- Get the events from the calendar tell application "Calendar" set calendarEvents to every event of calendar calendarName whose start date is greater than currentDate repeat with theEvent in calendarEvents set eventTitle to summary of theEvent set eventStartDate to start date of theEvent set eventNotes to description of theEvent if eventNotes is missing value then set eventNotes to "(no notes)" -- Create a new reminder with the event details tell application "Reminders" to tell list remindersName make new reminder with properties {name:eventTitle, due date:eventStartDate, body:eventNotes} end tell end repeat end tell
Replies
Boosts
Views
Activity
May ’23
Reply to File type and size checking?
You don’t necessarily need to use AppleScript if you are familiar with something else - the Cocoa API and various other scripting languages (Ruby, Python, shell, etc) provide methods that will do all that.
Replies
Boosts
Views
Activity
May ’23
Reply to AppleScript Photos
Works for me, but check your path - I’m guessing home was supposed to be Users.
Replies
Boosts
Views
Activity
Feb ’23
Reply to core audio API library
Are you including the AudioToolbox framework, or CoreAudio?
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to Click Drag function. Need Help with this Script I get Syntax Errors.
You get errors from stuff like declaring a handler in a tell statement, missing handlers or applications that perform commands such as mouse up, mouse move, and get mouse location, bad syntax for several if statements, and just bad formatting in general.  This script has no chance of running - where did you get it or the commands you are trying to use?
Replies
Boosts
Views
Activity
Feb ’23
Reply to Apple Script: File Renaming
Please don’t post a picture of a script, post the actual script - most aren’t going to bother typing it in. The main issue I see is that you are using statements of the form set someVariable to item x, which isn’t working the way you think it does.
Replies
Boosts
Views
Activity
Nov ’22
Reply to Applescript - Search Folders/Files based on string and display in new FINDER WINDOW
To get search results in a Finder window you are going to need to use the Finder to do the search.
Replies
Boosts
Views
Activity
Aug ’22
Reply to Applescripting multi strings into one
To make sure a string is defined, you can initially declare it as an empty string, then replace the value as needed. Also, instead of 10 different variables, just use a list - that is what they are for. Since the strings are in a fixed order, items in a list can be assigned according to the selections, then the list coerced to a string, which will add them all together (selected or not): set stringsList to {"", "", "", "", "", "", "", "", "", ""} -- 10 items set the choices to {"Music Sharing", "Remove Network Icons", "Dual - Galley & Active", "HD video", "Hide Menu", "Hide Reactions", "Remove All Overlays", "Dual - Galley x2", "Remove Names", "Other"} set the response to (choose from list choices with prompt "Select Advanced Dial String Command(s). Use Command (⌘) to select multiple." with multiple selections allowed and empty selection allowed) if the response is not false then repeat with anItem in the response if contents of anItem is "Music Sharing" then set item 1 of stringsList to "306" if contents of anItem is "Remove Network Icons" then set item 2 of stringsList to "307" if contents of anItem is "Dual - Galley & Active" then set item 3 of stringsList to "308" if contents of anItem is "HD video" then set item 4 of stringsList to "309" if contents of anItem is "Hide Menu" then set item 5 of stringsList to "504" if contents of anItem is "Hide Reactions" then set item 6 of stringsList to "508" if contents of anItem is "Remove All Overlays" then set item 7 of stringsList to "606" if contents of anItem is "Dual - Galley x2" then set item 8 of stringsList to "608" if contents of anItem is "Remove Names" then set item 9 of stringsList to "102" if contents of anItem is "Other" then set item 10 of stringsList to text returned of (display dialog "Enter other advanced string command(s)" default answer "") end repeat return the stringsList as string
Replies
Boosts
Views
Activity
Jul ’22
Reply to Seeking suggestions - how to have versions of an Automator service workflow
If all you are doing is reading the XML file, I'm not sure what would corrupt it, but an idea similar to the AppleScript comment would be to add a variable to the workflow (both would be in the file). In a workflow's bundle, the /Contents/document.wflow file is a property list that declares the various actions with their settings (such as the script for the Run AppleScript action), action connections, workflow metadata, and any variables. By adding a variable for a version number to the workflow, your script can just look for the variable name and get its value instead of adding a file to the bundle - System Events includes a Property List Suite, so you can do something like: on run -- example set plistFile to (choose file with showing package contents) -- get the document.wflow file set variables to getPlistElement from {plistFile, "variables"} if variables is not missing value then repeat with anItem in variables -- multiple variables if |name| of anItem is "Version" then -- or whatever return first item of value of anItem -- the value is a list end if end repeat return missing value -- not found end run to getPlistElement from plistItems -- get specified element from plist structure by name or index try if (count plistItems) < 2 then error "item list contains too few items" tell application "System Events" set element to property list file ((first item of plistItems) as text) -- root element repeat with anItem in rest of plistItems -- add on the sub items set anItem to contents of anItem try -- handle an index number set anItem to anItem as integer end try set element to (get property list item anItem of element) end repeat return value of element end tell on error errmess number errnum -- not found, etc log "getPlistElement error: " & errmess & " (" & errnum & ")" -- or pass it on return missing value end try end getPlistElement
Replies
Boosts
Views
Activity
Feb ’22
Reply to Seeking suggestions - how to have versions of an Automator service workflow
Idea three (or reading a workflow variable) isn't all that different from four - what are you doing that risks corrupting the workflow declaration file?
Replies
Boosts
Views
Activity
Feb ’22
Reply to What certificate should be created for an AppleScript application?
For distribution in the App Store (and to keep Gatekeeper happy), the code-signing certificate needs to be from Apple, so you can use the one for your Developer Account. AppleScript apps are allowed in the App Store, the limiting factor would be what it wants to access, the same as pretty much any other app.
Replies
Boosts
Views
Activity
Jan ’22
Reply to [MacOS] How to find if Antivirus is installed programmatically
There are a variety of ways to scan for malware, and more than a few products, so you would need to look for each app or its agent or daemon. What are you actually trying to do?
Replies
Boosts
Views
Activity
Dec ’21
Reply to How to re-grant access to an updated AppleScript ap?
Are the permission issues related to running the application again? Are you code-signing or otherwise making the script read only?
Replies
Boosts
Views
Activity
Dec ’21
Reply to Formula text treated as variable in AppleScript problem
I can’t tell what you are trying to do, but the escape character is a backslash - \. You also need to pay attention where the ampersand & is used - in a string (between the quotes) it is just another character, between strings it is the concatenation operator.
Replies
Boosts
Views
Activity
Nov ’21