New answers tagged

1

QuickTime Player doesn't have a Preferences... menu command like other applications do, nor does it have a com.apple.quicktime.plist file to manipulate. Therefore there isn't anything you can do directly, however here is a workaround of sorts. Note that this workaround requires changing the default application for file types, e.g. .mov, you'd normally open ...


1

Using the file pathname from your question, here is the AppleScript code that should work. tell application "Finder" set fileName to name of (POSIX file "/Users/mainuser/Desktop/Test/shot.png" as alias) display dialog fileName end tell A more direct way of the above scenario is: Syntax: set fileName to name of (info for "/path/to/file") display ...


0

Use random number from __ to __ and ifs. For example: repeat if random number from 0 to 100 = 0 then #do thing end if delay 60 end repeat


3

You could write a folder action script which would parse your downloaded files metadata and move them into folders based on kMDItemWhereFroms metadata attribute value. Or just use Downloads Router Chrome Extension with predefined location rules.


1

I know two products that do near the same thing as you want: Hazel (14-Day Trial): You can write rules to do actions when events are occurred. SafariStand (Open Source): If you use OS X older that 10.11 it can be used. Although you can install SafariStand only on Safari and it organized downloaded files according to the date of download. You can use the ...


0

I'm late to the party, but this should work for you: -- Set user_project_path to the folder that contains this AppleScript set user_project_path to POSIX path of ((path to me as string) & "::") -- Assuming your images are contained in user_project_path directory inside an images folder set images_directory to user_project_path & "images/" as string ...


0

This should do the trick: property parentfolder : path to home folder set theFiles to choose file default location (POSIX path of parentfolder) with multiple selections allowed repeat with theFile in theFiles set the_tags to paragraphs of (do shell script "mdls -raw -name kMDItemUserTags " & quoted form of POSIX path of theFile & " |sed ...


1

For a single script, it is no possible to create a unique icon that's sits near the clock such as the wifi icon for example. There may be unique AppleScript plugins that enable this, but I'm not aware of any. If you need one icon from which you can run a bunch of different scripts, there are tools like FastScripts that enable this. OS X also enables ...


1

You appear to be using git as a file system back-up. Have you considered git-annex? Learning git git can be tricky to learn and debug. Consider mastering the steps you want via Terminal.app – with the help of the Git Book. BitBucket support provides a wealth of examples and workflows to try and to learn from. Once you trust that process, automating via ...


0

Actually, it IS possible for your first script to write a second script and run the second script 'inside the other' thus allowing you to write keys 'on-the-fly'. Here's a fun demo that toys around with the concept. I hope it helps! --WRITE KEYS TO 'ASOCIATIVE ARRAYS' on theFLY!!!! (a.k.a. applescript 'records') --THIS SCRIPT RANDOMLY GETS A KEY TO EXTRACT ...


0

To address the last point in your post, "Can I toggle the option in the Keyboard preference pane with a script?", here is the AppleScript code that will toggle the state of the "Use all F1, F2, etc. keys as standard function keys" checkbox on the Keyboard tab of the Keyboard System Preferences. tell application "System Preferences" activate set the ...


0

Whatever opens MAILTO:// links is set from within the Mail.app itself Go to Mail > Preferences > General and the top pop-up menu lets you set any installed application that the OS recognizes as being able to respond to those links as the default email application. There used to be hacks that let a web browser with a webmail client open respond to mailto ...


1

open folder then run script tell application "Finder" to set cwd to POSIX path of (insertion location as alias) tell application "VLC" OpenURL "file://" & cwd & "" play end tell


1

You can embed your shell script within AppleScript calling bash with a heredoc. do shell script "/bin/bash -s <<'EOF' cd /Users/myusername/Git/myproject/ /usr/bin/git remote remove orig EOF"


2

To not get that error, you need to make myShellScript.sh executable. In a Terminal, use the following command: chmod u+x /path/to/file/myShellScript.sh Also, you should add a shebang to the top of the script. Example: #!/bin/bash Note: Use the appropriate shebang for the shell you want to process your script. If you do not want to make the script ...


0

This is not necessarily meant to be a complete answer and is too much as a comment. Because the Mail AppleScript Dictionary lacks some verbs, e.g. send again, one therefore needs to workaround any shortcomings. The code below could be incorporated into your script. It uses System Events to manipulate menu commands to send composed messages from the ...


1

Basically you can use do shell script "cd my-directory && git init" do shell script "cd my-directory && git add README.md" ...


0

Somebody wrote a customdisplayprofiles command (in Python) for changing display profiles from the command line. I haven't tried it out, though.


0

So apparently I had to disable rootless system integrity protection just to move the workflow file between folders. I still hope someone finds a better way of installing services in the mail app in el capitian, because having to do multiple reboots and disabling low level security features seems excessive when I'm just trying to pull data from two basic ...


0

As was noted in the comments, brightness cannot go below a setting of 0. If you use the brightness keys on your mac, you'll note that if you keep going, you hit screen off, which entirely turns off the screen backlight. From experience, I would assume this is zero. Below zero would mean your screen is actively attracting light from it's surroundings. You can ...


0

It's ugly but it works... try set marker to 1 -- do stuff set marker to 2 -- do stuff set marker to 3 1 / 0 set marker to 4 on error errMsg number errNum tell application "SystemUIServer" display alert (marker & space & errMsg & return & return & "Error number " & errNum as text) buttons ...


0

Your syntax isn't quite right. First, you don't need to "tell" anything. Leave the "tell" and "end tell" off. Dates are not specific to any particular app so you don't need to "tell." This may be the entire problem. Second, if you do something like this: set a to current date You will get a result like this (not exactly like this, because it is ...


0

Try: set dateString to "Tuesday, April 12, 2016 at 12:00:00 AM" set dateReference to date dateString tell current application -- insert commands here end tell Another approach: set y to 2001 set m to 6 set d to 12 set h to 12 set min to 12 set s to 12 set cd to current date tell cd set its year to y set its month to m set its day to d ...


1

To programmatically add a Desktop in Mission Control the code below can be used as an AppleScript or a BASH Script in conjunction with an Automator Service using Run AppleScript or Run Shell Script, respectively, and a key sequence assigned to the Service in System Preferences in Keyboard Shortcuts. AppleScript Code: do shell script "open -a 'Mission ...


0

set whichUrl to 0 set theStartDate to the date "Tuesday, June 21, 2016 at 00:00:00" set theEndDate to theStartDate + (60 * 60 * 24 * 365) --365 normally set theDate to theStartDate repeat until theDate ≥ theEndDate if whichUrl ≥ 19997 and whichUrl ≤ 40000 then --In case I just want a range. set theURL to "http://siteaddress?iso=" set ...


0

I would use Spark to program the F15 key to do what you want. It is free (although donations are accepted). The website for Spark says "Mac OS 10.9" but I find it works with 10.11.4 here. Here is what Spark looks like on my Mac. You create a new hotkey from the File menu. In your case, you'll be making a new "Keyboard" type of hotkey. I am including a ...


0

This is a simple way to do similar it uses text expansion. Go to System Preferences->Keyboard and choose the Text tab. Then hit + and enter a short form and the full email address. Then when you type the short form and a space Cocoa text spelling check will show you the full email address and replace the short form.


0

Here's a script that takes the current time and makes it HHMM as you asked. -- preserve the current text item delimiters so we can put them back set oldDelims to AppleScript's text item delimiters set right_now to current date set the_time to time string of right_now -- something like "4:20:56 PM" set am_pm to characters -2 thru -1 of the_time as string -- ...


0

You could use a script like this: --Select some files in the Finder first. Then run this script. set oldDelims to AppleScript's text item delimiters set the_strings_to_strip to {"ee", "shot", "Z", "at"} tell application "Finder" set the_files to the selection -- repeat with a_file in the_files set the_name to name of a_file ...


0

You could use an AppleScript like this, saved as an application: tell application "Mail" set my_message to make new outgoing message set subject of my_message to "I restarted." set content of my_message to "Not sure why it happened..." set sender of my_message to "macman@christianboyce.com" -- tell my_message make new to ...


6

There is a feature in the Applescript editor called the Library. it can be accessed through Window > Library on the top navbar, or with the shortcut Shift+Command+L. You can double click on the applications there, and you will see all functions, variables, etc. The windows looks like this. Double clicking shows a new window with all possible functions, ...


0

to export an an application, do File -> Export and set the drop-down list to "Application"


3

This AppleScript ask you to choose some files, after that, it set the comment of each file to the file name. set input to choose file with prompt "Select files (to put the file name into the Spotlight Comment)" with multiple selections allowed tell application "Finder" repeat with i in input tell item i to try set tName to (get name) ...


2

You can do this with an AppleScript. Use the Script Editor in the Utilities folder. Here is a script I wrote for you just now. It works on one folder at a time-- not the top level folder, but the one in your example that is 3587915. When you run this script it asks you to choose a folder. In this example you would open 3587915 and then click "Choose." Very ...


1

Open Automator and create a new service: Choose: Service receives selected text in Safari like in the screenshot below. Then add an item Run AppleScript with the content: on run {input} -- create folder from text display dialog " —Create folder from chosen text— This AppleScript will create a folder from text you specify." set destination to ...


0

Solved my problem by changing the do shell to: do shell script "/usr/local/bin/python3 /path/to/script.py $@" and letting the shebang stay as: #!/usr/bin/env python3


2

A way to do it with Chrome's built in scripting: tell application "Google Chrome" to set URL of active tab of window 1 to "http://example.com" And to expand your script to press return: tell application "Google Chrome" tell application "System Events" tell application process "Google Chrome" set (text field 1 of toolbar 1 of ...


0

This script works with the latest Power Manager, once the first line is changed to read: tell application "Power Manager" See Power Manager's AppleScript documentation for more examples. If you need help with Power Manager, please contact support@dssw.co.uk. We are be better able to help via e-mail.



Top 50 recent answers are included