Macintosh Postings - Page 1
|Earliest: June 26, 2003||Latest: July 30, 2021||Total: 411|
Keyboard Maestro Date Macro
Every now and again I need to figure out a simple date calculation. For example, I am writing up a wiki page and want to reference something next Thursday. I don't want to say next Thursday but I want to say the simple date format.
I encounter this enough times, that I decided to write a simple Keyboard Maestro macro. There are three types of date scripts that I wrote:
- Simple Date - Display the date x days from now. Added built in for Tomorrow, 2, 3, 4, 5, 7, 30, 60, 90, 100, 180 days
- Advanced Date - Put a number in the Clipboard and use that to display the date.
- Days Until - Put a date in the Clipboard, and then display the number of Years, Months, days until the event. If its in the past, then show the number of days that has past.
This set of macros are built-in date calculations. Simply by using the generic hotkey: day* and some number I can display that date. So if I wanted tomorrow, I would type in day1. If I wanted 100 days from now I would type in day100.
This macro makes use of the ICUDateTimePlus functionality that is part of Keyboard Maestro.
This single macro makes it easy to put in any number of days. Simply type in a number, copy/paste, and then type in day++. This also makes use of the ICUDateTimePlus function. The return display shows the Month, Day, and Year.
This macro is my date count down. If I want to know how many days until an event, I simply type in a date, copy/paste and then type in the trigger: day+++. The return value will show Years, Months, Days, Hours until the event. This also works for events in the past. So I can see how many days past since I graduated.
The PHP secondsToHumanReadable function, used in this example, can be found at stackoverflow.com.
This week Bare Bones released an update to BBEdit - bring the application to version 14.
It took 9 years to go from version 10 to version 14. So when BBEdit does a major update - it's a big deal. In this update, the big new feature is Notes.
One of the biggest features in this update is a Notes section.
For years BBEdit users would open up a blank document and just type away. When it came to saving the document, if they remembered, they would use the default name "untitled."
With BBEdit Notes, you can simply write away and don't have to worry about saving - it does it automatically! The name of the file is the first few words on the first line.
You can organize your notes into collections. (otherwise called folders) This makes it easy to view your data.
Seven Things I Learned about BBEdit Notes
Filename: While the name of the file displayed in the sidebar is the first few words of the first line. It's actually stored as a Globally Unique Identifier (GUID). The notes are not accessible in the Finder, they are in a package file in the finder in the BBEdit settings library. You can always use a simple trick to view the package file content - but why would you do that?
Emoji Filename - You can have Emojis in your filename! This is a creative way to make your notes stand out.
Dropbox Setup: If you are using BBEdit Dropbox sync configuration, you'll share the same Notes database between Macs. This is pretty useful. The problem is that notes created on a different Mac will show up in the Notes section using the GUID instead of the "friendly name." The workaround is to right-click on the note and select "Rename Note…" and assign a name. This name will carry over to the other Mac.
Collections: The Note collections works great on different Macs. You can nest collections. I setup up the notes to have two collections for the two computers that I use. This makes it easier to focus on the notes that may be important to me on a particular computer.
Search by Name: You can search for notes using the "Open File by Name." Only Noted created on the currently used computer will show up in the listing.
Search by Content: Use the new Notes check box in the Muti-file search dialog box to search through all your notes.
Opening Notes: You can open Notes in any BBEdit window. You don't need to use the Window->Notes feature to view a particular note. I find this useful as I have some reference documents and its great to have them available in the same window. The downside is that there's no indicator in the sidebar of what's a note file type and what's a plain file. I identify any filename that doesn't have an extension as a BBEdit note file.
Markdown: When you create a new Note it uses Markdown by default. If you are not familiar with the format, there is a Markdown Cheat Sheet in the Windows -> Palettes -> Markdown Cheat Sheet. This isn't new in 14, but useful to have when starting with Markdown.
Great Shortcuts to remember
Control - Option - Command - N -> Create a New Note (When you use this a few times, the keyboard combination makes sense.)
Shift - Command - F -> Multi-file search (Find Content in your Notes)
Lots of Other Changes
BBEdit 14 has a lot more changes other than Notes. Here are some other notable changes that I am excited about:
- Remove Blank Lines: One simple menu item to quickly cleanup those blank lines.
- Emmet Support: Simply install the Node.js and you can finally use Emmet within BBEdit.
- Markdown Images: When you drag images to a Markdown document, BBEdit will insert the correct image tag format - like it does for HTML.
- Text Factory: Replace All - Nice to see the history option. This makes it easy to implement a recent search/replace into a Text Factory action.
- Application Icon - Bare Bones has a new icon for BBEdit, but you can change it back to the old style in the Preferences.
- Pattern Playground - You can adjust the Search Pattern section. Now you can see more of crazy search pattern.
Go For the Upgrade!
BBEdit 14 is worth the upgrade. Still not sure? Why not try the the 30-day trial to explore how BBEdit can help you manage text easily.
"there isn't enough free space" error
Have you ever run into this kind of error message:
?There isn?t enough free space?
Usually this occurs when trying to save a change. The weird thing is that when you look at the disk space there?s plenty.
The lack of disk space can?t be the reason.
What?s Going On?
The other reason for the error is when the system clock is not set. Especially if the date is around 1970.
This may happen if your computer battery drained and it?s not connected to the internet.
Quick Easy Solution
Simply fixing the clock will fix the error.
Quickly Put the Computer to Sleep
Sometimes you need to put the computer to sleep without using the mouse. This happens when you're charging the mouse - or the mouse battery died.
Did you know that there?s a keyboard combination shortcut to quickly put your computer to sleep? This is a very useful combination to remember.
Download this graphic and use it as a quick reference to putting your computer to sleep.
Font Awesome Filter
Font Awesome is one of the popular online icon fonts. Web designers use it to make websites a little better.
You can easily search their collection for all sorts of creative icons. There are 7,865 icons in their collection - of that 1,609 are free.
One Bad Thing About Font Awesome Search
There is one downside to the Font Awesome search. When you find an icon, there's only one way to copy the HTML class - by clicking on the name. When you do this you get the whole style prefix not use the class name: Sample:.
That's useful when you want to add it for the first time. What if you only wanted the font class name to replace an existing font awesome style? You would have to paste the content and then delete the remaining class info. This can be a pain if you're replacing a bunch of icons for a redesign.
Keyboard Maestro to the Rescue!
I decided to write a Keyboard Maestro Macro to fix this situation. It's basically a regular expression that filters out everything outside of the quotes.
Here's the Macro:
Regular Expression Used
The nice thing about this Macro is that it can be executed by typing in the keyword: ".awesome " or using the filter menu in the Clipboard Switcher.
So now I can easily replace icons on a page with ones that I find on Font Awesome.
If there's a time when I am doing a lot of icon changes, I can change the macro to be easier to execute.
Not Using Font Awesome?
This is just a tip of how to use Keyboard Maestro for one instance. You may find another use of how this may help you have better copy/paste.
Turn off Notifications
Have you ever gotten those Notifications when you are sharing the screen? Perhaps you are sharing your computer and don't want people to peek into your text message notifications.
There's a simple way to fix that in macOS Big Sur
Big Sur Notifications
Turn Off Notifications
- Open up the System Preferences?
- Select Notification ( Located on the right side of the dialog under Family Sharing.)
Now you can turn off all notifications for a particular durations. Alternatively, you can turn off the notifications for particular apps.
Suggestion: turn off Notifications for Slack, Messages and Mail.
Keyboard Maestro Chrome Macro
Using Keyboard Maestro, I can set up a taskbar menu of various configurations. This makes it easy to launch Chrome with a particular setting whenever I want. I don?t have to memorize commands and I don?t have to launch a terminal editor to run these commands.
I simply select the chrome action that I want and instantly Chrome launches.
Sample Keyboard Maestro Action
Here is an example of one of the macros.
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --incognito
List of Chrome Command line Commands
You can get a list of all the Chrome Command options with some explanation on this site:
Word Count LaunchBar Action
Sometimes I need a way to count a selected group of text. Usually, it?s to see if it?s long enough for a particular field.
If it was on a website, I would copy that text into BBEdit or another text editor. Then I would look at the status bar to see the number of words or length of the copied text.
There has to be a better way,
Using the Action
Now when I need to get the information, I just follow these steps.
- Select the text
- Use the ?Instant Send? keyboard short cut
- Click Tab
- Then type in ?Word? and then click return.
I get instant info on my selected text.
Download the Custom Action
I figured other people may want to use this so I am making it publicly available.
Download the action. After downloading, double-click on the zip file to uncompress it. Then double click on the file to install in LaunchBar
Apple Quicktime has the ability to record video and audio files. This is a quick way to digitalize audio. For example, if you want to send an audio message in an email or a social media post.
There are two settings for audio:
|High||44100 Hz AAC audio|
|Maximum||44100 Hz, uncompressed Linear PCM 24-bit AIFF-C audio|
Four Things I Learned
The output audio is off, by default. You have to adjust the volume to hear the recording.
Shortcut for creating a new audio recording is Shift Command N
The recording settings that Quicktime starts with are the same as the default sound input. This is defined in the System Preferences - select Sound.
When you have the QuickTime Inspector open, it shows you the current settings that you have set up.
Three Reasons to Use Quicktime
- Fast way to record audio. Pretty much hit record and you're on your way.
- Installed on all Macintosh computers. If the computer has Quicktime, you have the ability to record audio. (Seems like a tool that Mission's Impossible's Ethan Hunt might use to record a confession.)
- Apple Script Support! You can write Apple Script or Automator action to record audio based on an action - such as setting up a recording to listen to mystery sounds at the office at midnight.
Three Reasons Not to Use Quicktime
- Limited recording scope. You can't define recording by application. For example if you want to record audio from Safari. This can be done using Audio Hijack.
- No Menu Bar or Dock Record Option. You have to have the App open and then type the keyboard shortcut and then record. Too many steps to record something quickly. Best solution to this is Simple Recorder.
- Limited Audio Configuration - You can only record using two settings High and Maximum. Use apps like Audacity for more configuration options.
Combine Files using BBEdit
Earlier this week I had a bunch of Apache log files that I wanted to combine into a single file. I was trying to figure out the best way to do it. A quick Google search showed me a solution from 2014. The purpose of this post is to say that it still works!
Here are the steps to quickly merge a bunch of files:
- Open up BBEdit
- Create a new Text Document (Command N)
- Go Under Edit menu and select Insert then ?File Contents...?
- Select the files that you wish to add then click Insert
- Open up BBEdit
- Create a new Text Document (Command N)
- In the Finder drag and drop the text files into the BBEdit window
Using the Command Line
Another solution is to use the Cat Unix command in Terminal. Here's a sample of what that would look like:
cat access.log.* >> website.log