Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

1

Restarting the Mac fixed the issue for me. I can now set the screen brightness alright. Apparently it's a mysterious bug in macOS.


1

You need to use a different name for your repeat statement’s loop variable - the term name is an AppleScript property and is also in System Events scripting dictionary. Your usage isn’t generating a syntax error, but it is probably causing more confusion than usual and is winding up targeting the wrong item (welcome to AppleScript). You can use pipes ...


-1

tell application "System Events" to return the ¬ bundle identifier of every process ¬ whose visible = true


0

I haven't tested this, but it looks like you have too many levels of quotes there. You manually put double-quotes around the command to be run over ssh (in the set fn to "\"/usr/bin/open ... & "\"" line), and then use quoted form of fn, which adds another level of quotes. It looks fine when you echo it, but that's because the shell parses & removes ...


2

Save whatever script you wish to a file and when you change the extension to .command Finder will robustly make a command line window that’s new to run that command / script. This works for whatever #!/bin/whatever shell or script you start the text file. AppleScript can open documents just like when Finder clicks on them to open, this should be a fairly ...


1

found this on Macscripter.net I think it is what you are looking for: tell application "Microsoft Excel" tell active sheet select used range end tell end tell


1

If you have: set Q to {"a", "b", "c"} You can then do: set Q to (Q as string) as list (Q as string) coerces the Q list {"a", "b", "c"} into a string, "abc", and as list turns the string into a list item assigned to Q. Not necessary, but if you also add: return Q Just to see what it returns, it will return: {"abc"} Which is what you wanted.


1

I'd look into what can be done with applescript using the scripting dictionary. script editor > file > open scripting dictionary I do not know the details of what you are doing but here are some coloring options.


0

I finally got an error message which answered my question: com.automator.runner.xpc is not allowed to send keystrokes.


0

The following script works but it needs to open (and close) a Finder window. Save this to maccopy: #!/usr/bin/osascript on run args set theFile to (POSIX file (first item of args)) as alias tell application "Finder" reopen activate set selection to {} reveal theFile end tell delay 1 tell app "System Events" keystroke ...


1

The following works for me: set SuperSleep to (do shell script "pmset -g | awk '/SleepDisabled/{print $2}'") if SuperSleep is equal to "0" then do shell script "pmset -a disablesleep 1" with administrator privileges else do shell script "pmset -a disablesleep 0" with administrator privileges end if NOTE: Do not use sudo in a do shell script ...


-1

If you just need to copy modification date to creation date on same files you can use my modified script: #!/bin/bash for f in *; do cDate="$(GetFileInfo -d "$f")" mDate="$(GetFileInfo -m "$f")" SetFile -d "$mDate" "$f" done


1

I'm not sure I understand your question exactly. But, if all of the tables are on one sheet, and all of the tables need to get the same new column and the same column title, this will work. Screenshot of Numbers document with three tables on the sheet, before running the script. Screenshot of Numbers document with three tables on the sheet, with column ...


4

Objective: To process an AppleScript list of strings so that each string is filtered to remove any non-digit character followed by all leading zeroes. Resultant empty strings are discarded. property digits : "0123456789" property text item delimiters : {} set L to {"abc", "qwerty.24", "01 abc23xyz", "123abc456", "2.1abc", "20"} repeat with textItem in L ...


2

Submitting a separate answer, as it is entirely distinct from my first in that it solves the issue at hand. Credit goes to @user3439894 who pointed the OP and I to a link (Toggle caps lock programmatically) that features some source code written in C that can programmatically toggle/set the state of the caps lock. Thus credit goes also to the original ...


1

Yes. You could use this: tell application "Microsoft Word" set theDoc to document 1 return document property "Number of words" of theDoc end tell Since you asked for the word count of "the currently open Microsoft Word® document" this does it. This script works ONLY in the case where you have a single Word document open. It works for Word 2011 ...


1

Though not exactly the same thing, a similar action might be to simulate the shift key being held down. You can command System Events to keep the shift key down until you command it to be reset: tell application "System Events" to key down shift To reset: tell application "System Events" to key up shift It has obvious differences to activating caps lock,...


2

Here's an alternative implementation that will be faster and is a lot more compact: set L to {"1", "", "", "apple", "acda", "", "3454", "ImportantStuff", ¬ "important1", "important2", "NotImportantStuff", "2", "", "efrg"} set {i, j} to {1, -1} tell L repeat until item i = "ImportantStuff" set i to i + 1 end repeat repeat until item ...


1

Modifying your original attempt: set myList to {"30.00", "30.00"} set myFinalTotal to 0 repeat with x in myList set myFinalTotal to myFinalTotal + x end repeat myFinalTotal And for the joy of learning: Recursive: to sumItems from L as list if L = {} then return 0 (L's first item) + (sumItems from the rest of L) end sumItems Iterative: to ...


1

It's because you are supplying dates in the format dd-mm-yyyy, where you need to be supplying them in the format yyyy-mm-dd. So your creationDate was already in the correct format before your script adjusted it. There's no need to replace slashes with hyphens—the handler is, for the most part, indifferent to the delimiter being used (notable exceptions ...


-1

The AppleScript in the linked page queries Spotlight's metadata to get the page count for each PDF document. (Specifically, the kMDItemNumberOfPages value.) It's up to applications to provide metadata to Spotlight, and MS Word doesn't provide page numbers to Spotlight. So you can't change the script easily, and will need another method.


1

Manual Filter One approach is to manually filter the list with a repeat loop: set theList to {"1", "", "", "apple", "acda", "", "3454", "ImportantStuff", "important1", "important2", "important3", "NotImportantStuff", "2", "", "efrg"} -- put the filtered items into subList set subList to {} -- note when iterating through important items set ...


1

You can schedule shutdown's and restarts directly from within ARD, no scripting needed.


1

If you want to run sudo command with ARD select run command as User and written root. Edit : It doesn't have to go through the osascript to turn it off. A shutdown -h now with root user is enough You can also shutdown the station via the Manage menu


4

You can use random number, e.g.: set timeDelay to random number from 18 to 58 delay timeDelay Or any integer values you wish. For more information about random number click the link. Also have a look at: AppleScript Language Guide


3

You could try converting items in the list to the desired class, and ignore the ones that error: set theNumbers to {} set theList to {"123", "124", "abc", "125", "efgh", "126"} repeat with anItem in theList try if contents of anItem is not "" then set the end of theNumbers to anItem as number on error errmess number errnum -- didn't convert log ...


0

Solved : I'm counting the list first then do my repeat statement set sum to 0 set n to count newTotal repeat with i from 1 to n set sum to sum + (item i of newTotal) end repeat return sum


2

You can't really (or shouldn't) use text items without first defining your text item delimiters. If each field in the formatted text is separated by a tab character, then the task is trivial: set my text item delimiters to tab set cbTotals to {} set cbDates to {} repeat with row in the paragraphs of (the clipboard as text) set the end of cbTotals to ...


0

The above answer for Sierra doesn't work in Mojave. Working code in Mojave to set brightness to 75%: tell application "System Preferences" reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays" end tell tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display" set value of ...


-1

Is it possible? Maybe. First I tried: tell application "QuickTime Player" set current camera to video recording device named "My Name's iPhone" end tell and I got an error that the current camera could not be set to that. I also tried to set it back to "FaceTime HD Camera" and QuickTime Player did not like that either. Next I tried: tell ...


2

The following is an example Automator workflow that achieves the stated goal of your question per its defined hierarchal folder structure. NOTE: While the example bash code used in the Run Shell Script action completed successfully nonetheless, the onus is upon the user to ensure that proper backups exist before using it. I'd even suggest making a small ...


0

If you look at the Keynote AppleScript Dictionary you will see that the "group" element has no property for the boolean "locked". It seems that the only things that can be locked are the individual elements of the slide, but not a group on the slide, nor the slide itself. If you can, I'd suggest going through and ungrouping the groups in your slide, re-run ...


2

See if this works for you: set varSubject to "Hello" set varContent to "GoodBye" set varName to "Jon Snow" set varEmail to "jsnow@castleblack.org" tell application "Microsoft Outlook" set newMail to make new outgoing message with properties {subject:varSubject, plain text content:varContent} make new recipient at newMail with properties {email ...


1

A Combination of AppleScript (or Shell Scripting if you are so inclined), along with a command line tool like id3v2 should do the trick. You can build id3v2 from source: http://id3v2.sourceforge.net Or use MacPorts or HomeBrew to do the building and installation for you. Once you have it installed you can view the help page by typing in "id3v2 ah" from the ...


0

Well, this was easy. I just needed to come at the issue fresh. Apparently, tailing a system log file has to be done as the super user: sudo tail -c +1 -F 2019.05.17.asl | strings - -o | grep "QuartzCore,ScreenSaver" Putting sudo in front allows output to continue to be spit out when the screen is locked.


1

Try this: tell application "Microsoft Outlook" set theAccount to the first exchange account whose name is "Exchange Account" set theInbox to inbox of theAccount set everyFolder to every folder of folder of container of theInbox end tell That will get you the sub folders of every folder. Hope that helps! You can also specify the name of a ...


Top 50 recent answers are included