New answers tagged

0

This project in Github does what you are looking for - look in there to see how he is doing it. https://github.com/paulbhart/toggleairport He watches these three files to determine that the network status has changed: /private/var/run/resolv.conf /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist /Library/Preferences/SystemConfiguration/com....


1

Using the Ask Question button that's in the upper right hand corner of the page, like in this question, and having multiple windows each with multiple tabs to a Ask Different web page, as well as some non-related pages... The following example AppleScript code clicks the Ask Question button on every page having the button. It doesn't matter what window or ...


0

I will also answer this question with an alternative method I worked out: set exportedNote to "Example note exported from Apple. <ul> <li>Indent</li> <ul> <li>*Further* indent</li> <ul> <li>Even **further **indent. With a [link](https://duck.com).</li> </ul> </ul> ...


0

I still need to find a way to do that on every window but otherwise for a single window I found this : tell application "Safari" repeat repeat with i from (count of tabs of window 1) to 1 by -1 set thisTab to tab i of window 1 set current tab of window 1 to thisTab tell application "Safari" ...


1

The following example AppleScript code, as coded, is intended to work with bulleted list HTML code as shown in the OP, meaning that what is passed in the variable is just the relevant code to define the bulleted list and not other arbitrary HTML code. As coded, it will produce the appropriate output for variations of bulleted list HTML code as well, not just ...


2

Here is one example: set htmlString to "This is a link: <a href=\"https://duck.com\">link</a>" set mdString to do shell script "/usr/bin/sed -E -e 's|<a href=\"|[link](|g' -e 's|\">link</a>|)|g' <<< " & htmlString's quoted form Result: "This is a link: [link](https://duck.com)...


2

As the parent process of osascript is 'bash', that suggests that a command line script is calling AppleScript. /Library/Scripts/WIS/tmp/Scripts/startup.sh is very likely the culprit. Have you installed anything that this might relate to? If not, I would delete it, and download Malwarebytes to check for malware.


0

If you've set up an Automator workflow as a Folder Action and have added a Run Shell Script action, you'd set Shell: [/bin/bash] and Pass input: [as arguments] and use the following example shell script code: for f in "$@" do xattr -rd com.apple.quarantine "$f" done Note: You should not need to use sudo as you've shown in your OP. ...


2

I'm not quite sure what you're doing to affect the italics. Changing one aspect should not change any other. Select all text. Multi-style selections will show as Multiple in the style box. In the Text tab click the size button… all else is retained except the font size. Window shrunk to only show relevant area… If your text already has multiple font sizes, ...


0

set theWorkbookFile to choose file with prompt "Please select an Excel workbook file:" set theWorkbookName to name of (info for theWorkbookFile) tell application "Microsoft Excel" open theWorkbookFile set theWorkbook to workbook theWorkbookName set peremail to value of used range of active sheet end tell --This is the part that I am stuck ...


1

If you are just trying to set the value of the tab index of item 1 of t to a variable, then is there some reason you can not just use set theTabNumber to index of item 1 of t instead of set theTabNumber to item 1 of t? -- This code, set theTabNumber to index of item 1 of t returns an integer, representing the r/o index of the tab, ordered left to right in ...


-1

I found the issue which is "set clickBreak to click" Removing "set clickBreak" resolve the issue.


3

Your If statement isn't checking out. Change "is equal to" to "contains", it should catch it. if selectedoption contains "demo one" then notification() end if


0

The following example AppleScript code assumes there is only one account in Contacts > Preferences… > Accounts and will only click the Enable this account checkbox if it's not checked, and then closes the preferences window: Note: The example AppleScript code was tested under macOS High Sierra and may need to be modified for earlier/later versions of ...


0

Thanks to the tip by @user3439894, I found an answer (you need ripgrep and https://github.com/myshov/xkbswitch-macosx installed): ec() print -r -- "$@" ecerr() { ec "$@" 1>&2 } function input-lang-set-darwin() { # https://github.com/myshov/xkbswitch-macosx # `hyperfine --warmup 5 'xkbswitch -s 3' 'xkbswitch -s 0' '...


0

I don’t know anything about Hazel. However, this following AppleScript code will remove everything to the left of and including the 1st “_” from the names of the selected files in Finder and rename the selected files accordingly. tell application "Finder" set theFiles to (get selection) repeat with i from 1 to count of theFiles set ...


0

The renaming didn't help, and the "no input" as well. However the any application did the trick for me. I was sending the service strictly to Final Cut Pro, and for whatever reason it simply would not show up in the services menu. Changing it for any application solved the issue. The only problem is now the service is showing up everywhere, which ...


0

The Applescript-native way to rename files is: tell application "Finder" set theFile to (choose file) set name of theFile to "Yay" end tell If you wanted to rename every file in a folder, I'd put the files into a list and use a Repeat block on each one: tell application "Finder" set theFolder to (choose folder) ...


0

In macOS High Sierra, I do the following to automate the clicking of the Load Remote Content button in Mail. Using an Automator Service with setting Service receives [no input] in [Mail] and a Run AppleScript action replacing the default code with the following example AppleScript code and setting a keyboard shortcut in System Preferences > Keyboard > ...


0

The only (ugly) solution to date seems to be: tell application "System Events" click at {x, y} end tell — where x and y are coordinates of the mouse over the button to simulate a click (You can easily find these coordinates by doing a screenshot, i.e. cmd+shift+4) Note: This will only work for the first message in a conversation since the ...


-1

Keystroke means it will send a "C" to the program and not actually press the C key. Try using key code 8 using command down. Also, you may want to add a line with activate after the "tell Excel" command to ensure the program is the frontmost application. Finally, use delay 0.5 between commands, so the program has enough time to process ...


0

This following AppleScript code should work if you save it as a “stay open” application. Just set the property values for scriptToRun and lookForThisText and it should be good to go. Don’t forget to grant permissions in System Preferences for your new stay open application to control your computer property scriptToRun : (path to desktop as text) & "...


1

Your set ping to statement should have the closing quote after the IP address In general you are missing a number of end statements. Each try should have a corresponding end try, each tell should have an end tell, each if should have an end if. The try statements should surround the script action, not inside them. So move them before the tell statements. ...


0

The application EasyRes (free in the Apple app store) did it for me. I had spent an hour resetting the NVRAM, trying frantically to get my 2006-vintage 30" Apple Cinema display back to full resolution, to no avail. I must have rebooted 25 times. EasyRes took care of it. Thank you EasyRes, I was going nuts! Update: this is not "sticky" -- when ...


0

You can define custom keyboard shortcuts for pretty much erverything via System Preferences. Open the "System Preferences" app ➔ "Keyboard" preferences ➔ "Shortcuts" pref pane ➔ App Shortcuts. Click the Plus (+) button. Choose Keynote from the "Application:" list. Enter the name of the menu title, in this case "...


0

The spaces mess things up. Try: do shell script "open -n " & quoted form of "/Applications/Game Capture HD.app" Essentially, 'quoted form' is for passing text to 'do shell script'. Both the Script Editor and the shell will be interpreting the text and 'quoted form' helps manage that. For more information, refer to the Applescript ...


2

do JavaScript is for Safari. execute javascript is for Google Chrome, e.g.: tell application "Google Chrome" to tell active tab of front window to ¬ execute javascript "document.getElementsByClassName('magnifier')[0].click();" That said, where you have it placed in the script may not be where you really want it. Here is some example ...


1

The following example AppleScript code combines the three Automator actions shown in your OP into one Run AppleScript action. Selecting the first Chinese character, from the link in your OP, and running the Automator Service/Quick Action it worked for me by opening a new tab to the target URL. Note that as coded it assumes Google Chrome is already running ...


Top 50 recent answers are included