Tag Info

New answers tagged

0

You cannot assign keyboard shortcuts to AppleScripts out of the box. However, you can: use a launcher that supports setting global hot keys and executing AppleScripts (Alfred, Keyboard Maestro, FastScripts - whatever takes your fancy), or put the script into a Run AppleScript action inside an Automator service. Note it has to be a service, not an ...


0

You can go to System Preferences -> Keyboard -> Shortcuts -> add a new shortcut. You can then select your script. https://support.apple.com/kb/PH18418?locale=en_US


3

Single quotes ('') suppress parameter expansion so you have to use double quotes: v() { osascript -e "set volume output $1" }


0

I noticed this when I have a Time Machine disk attached that has not been used in a while. If the disk is asleep and I right-click, I see "Fetching" in the contextual menu. Then I hear the HDD wake up, spin for a second, and the "Open With" menu is finally populated. When I don't have the external drive attached, I don't see this behavior.


2

Here is the solution. The script that generates the link, generats a url that starts with a custom googledrive:// and then the path to the file in the Google Drive folder. I then set lincastor to trigger the following script for urls beginning with googledrive:// on handle_url(args) set theUnixPath to |URL_PATH| of args set theUnixPath to (POSIX ...


0

I found the script, which is in your Mac: /Library/Scripts/Script Editor Scripts/Comment Tags.scpt


1

I found the settings file by using the terminal command opensnoop to monitor all files accessed by any programm and found that the file that stores the underscan setting is here: /var/db/.com.apple.iokit.graphics


-1

I don't know - but I do use the free EasyFind (by DevonTech) that will search everything on your machine, every aspect of search.


0

While I have accepted @markhunte's question because it works in the general case, it did not work for me. That is why I post my own solution as an alternative. Create a shellscript that launches the applescript By having the launchagent run a shellscript that simply calls to the applescript (.scpt) the shellscript needs to be allowed access to assistive ...


0

A simple fix is to save the script as a text file instead. At the top of the script add the osascript shebang #!/usr/bin/osascript example: #!/usr/bin/osascript say "hello" tell application "Safari" to activate tell application "System Events" delay 2 keystroke "p" using command down tell application process "Safari" tell ...


0

You will always see the gear in the menu bar if you are using Automator. If you want it to exit quickly, create a wrapper that forks off your android script into another process, and exits.


0

Here's a simple toggle Bluetooth script that uses blueutil (available via Homebrew), no UI scripting. Adjust the blueutil variable as needed to point to the blueutil binary if you're not installing via Homebrew. This is based loosely on an old script I had lying around which included Growl notifications and was probably originally from http://macosxhints.com ...


3

The question itself isn't exact too, because the OP talks about: files names like ABC 123456 (without extension), but in the example code using *.txt extension add a dash between two blocks (e.g. where is the space) like ABC - 123456, but in the next taking about counting to 4 and count 3, e.g. not exacltly clear what the script should do for example if ...


2

If your file names are "ABC 123456" with single space between the first 3 and the following, then you are trying to replace the space with a character (or dash or something), so to look like ABC-123456. I found this article that explains how to do that. Example: Note that the following command will only replace spaces with hyphens. If you need a different ...


0

Applescripts aren't just plain text files. That's likely why this isn't working. Open Script Editor in your /Applications/Utilities folder, create a new document, and paste your applescript code into there. Save it as a regular .scpt file, and then you should be able to launch that from terminal using the osascript command you mentioned.


0

@2oh1, you have the right basic idea in your answer, but here's a complete and correct answer: The only reasonable way to work around this is to invoke "delay" within a loop that ensures the desired duration elapses before continuing. The best way to do this is to override "delay" with a custom handler: on delay duration set endTime to (current date) + ...


0

Try searching for and adding a Get Specified Finder Items action before your Get Folder Contents actions. This allows you to select the folder of which you would like to get and sort the contents. Hope this helps!


0

I need to do some more research to get this right. I feel like its close, but applescript still doesn't like it. Maybe it will give you some ideas until I get back here to give it another shot. Btw this is going to be so much easier when you are using the choose file dialog. heres my non-working (yet) attempt. If you don't be me to it ill try to finish ...


0

I don't know if one exists specifically for that case, but as a general rule of thumb, if it can be done, it will be on Doug's Applescripts


0

Update: I originally had this using a Table. But have now changed it to a Text Object. Here is you start then. Save this Applescript as a Stay Open Application. on idle tell application "Pages" set ActualCount to count words of body text of document 1 set calculation to ActualCount * 0.02 set object text of text item 1 of ...


2

It's probably a bug, but there's a strange workaround. After highlighting the Eyedropper icon, click and drag on the color next to it on the left.


0

I made a solution for you. Its got a few pieces, it might have taken me forever to come up with, and could probably use some polishing but its pretty darn close to what you wanted. The only thing I cannot see us being able to accomplish is holding the mouse down to do it. I couldn't find anything that would allow us to use the mouseup to turn off our ...


0

tell application "Mail" set theSubject to "Subject" -- the subject set theContent to "Content" -- the content set theAddress to "xxx@163.com" -- the receiver set theSignatureName to "signature_name"-- the signature name set theAttachmentFile to "Macintosh HD:Users:moligaloo:Downloads:attachment.pdf" -- the attachment path set msg to make new ...


3

The answer to this is surprisingly simple: $ osacompile -o output.app input.applescript This works for both plaintext .applescript files and the .scpt files that Script Editor makes. You can use a pipe too, e.g. if you have the script on your clipboard: $ pbpaste | osacompile -o output.app Or -e, like the osascript command can use: $ osacompile -o ...


1

The app is called LinCastor. (It can also be installed with homebrew cask if you have it.) First click "add new scheme" in the bottom left of the main window, then change the title to whatever you like and the "scheme(s)" to x-applescript-runner. Change the "handler" below from AppleScript to Shell, and paste this code in: #!/usr/bin/env python ...


1

tell application "Numbers" activate end tell


1

I only got a partial solution, which works apart from a few small issues. First of all, you can not store the URL in the filename (due to slashes and special characters) so you'd need to specify the Website name. But more importantly, so far the CSV import is not implemented. Is CSV really a hard requirement, or could you get the list of URLs in a ...


0

Came up with this solution with help of above script which works just fine: set downloadPath to path to downloads folder from user domain as string set posixPath to quoted form of POSIX path of downloadPath --Date to search for: set dateStart to text returned of (display dialog "Enter search date in form 'MM/DD/YYYY'" default answer "02/03/2015") --date ...


3

The way I've solved this is in the past is by bundling the contents of the virtualenv directory into Platypus and then activating the bundled Python interpreter with a script. Here's a screencap of the Platypus interface to show you what I mean: You'll notice that I've bundled the entire venv directory (which was created with the virtualenv command), and ...


0

Try this: tell application "Terminal" if not (exists window 1) then reopen else do script "" end if end tell


1

If you go to System preferences -- Accessibility-- Speakable items In settings turn on speakable items, and you can provide a keyword. After saying the keyword you can say commands.


1

You're embedding RandomNumA inside a literal (double-quoted) string, so it's treated as part of the literal rather than as a variable reference. To get it interpreted as a variable, you have to do the same thing you do in the do shell script command at the end -- use & to append a quoted literal, a variable reference, and another quoted literal. ...


0

The following code does what you want. I found it here, http://macscripter.net/viewtopic.php?id=32855 You may want to adjust the query to filter things further but it did work properly when I tested it quickly... set parentfolder to path to downloads folder from user domain as string set ppath to quoted form of POSIX path of parentfolder # date for ...


1

You can use the following script to show the idle seconds ticking up, from Inactivity and Idle Time on OS X: #!/usr/bin/env perl my $idle_seconds_command = 'echo $((`ioreg -c IOHIDSystem | sed -e \'/HIDIdleTime/ !{ d\' -e \'t\' -e \'}\' -e \'s/.* = //g\' -e \'q\'` / 1000000000))'; print "Counting seconds of inactivity... Command + Period (.) to quit\n\n"; ...


0

You can use an application like Power Manager to automate the launching of iTunes and subsequent quitting at 5am. Launching iTunes Launching an application can be achieved with the built-in Launch an application daily task: Quitting iTunes For quitting iTunes at 5:00, I would use the Run a script daily task to perform the following AppleScript snippet: ...


0

This is the correct method: tell application "Terminal" if not (exists window 1) then reopen activate -- insert your code here end tell EDIT You can open new windows with do script tell application "Terminal" do script "" end tell


1

tell application "Terminal" activate tell application "System Events" to keystroke "n" using {command down} end tell Should do the job.


0

Try: set searchText to text returned of (display dialog "Enter your search text:" default answer "") set matchText to paragraphs of (do shell script "mdfind \"kMDItemTextContent == " & quoted form of searchText & "\"") if matchText ≠ {} then set targetMatch to (choose from list matchText) as string if targetMatch ≠ "false" then tell ...



Top 50 recent answers are included