Automator mac "Take Screenshot" issue - automator

I need to automate a screenshot task, so I thought why not use automator? I found the "Take Screenshot" Action and started to play with it. The problem is is that is sets the file name and when the workflow is ran again it overwrites the prior screenshot. I tried selecting this and renaming it but it wont work. Essentially what I want is the normal function of command + shift + 3 where it will date-stamp it or something, anything but overwrite!! Any ideas?

I managed to use screencapture and date to do something similar:
fdate=$(date +"$m$d$Y") #I formatted time as mmddyyyy. You can use other formats, add dashes, etc.
screencapture -iW ~/$fdate.png #outputs file at ~/mmddyyyy.png
or something like that. You could wrap this into a shell workflow, or put it in the popular wrapper for OSX, Platypus. I'd seriously like to know how to do that, since I've never been able to understand Platypus.

I took the answer from #user8259 and made it more like the built-in screen capture that you normally see:
# We'll use the default format for the time-stamp
# This could be improved to be more like the Mac's built-in
# screen-shot with yyyy-mm-dd at hh.mm.ss AM/PM
# you would just have to figure out the date-time formatting
# in this shell script.
theTime=`date`
# create the file name for the screen-shot
theFileName="$HOME/Desktop/Screenshot $theTime.png"
#outputs file on the Desktop with a timestamp
screencapture "${theFileName}"
My version of the code includes a time-stamp in addition to the date-stamp to make it less likely that a screen-shot will overwrite a previous screen shot.
You can add this code to an Automator action called the "Run Shell Script" action instead of using the "Take Screenshot" action.

Related

Powershell Formating inconsistency

OK, this may seem extremely silly but....
I use VSCode as a notepad and and terminal window. I created a myFunctions.ps1 file and placed all of my frequently used functions in that file. I call that file from my profile.ps1 so they are available.
I created a function that works properly. Even the predective tab-complete finds the function in the terminal window. All of my other functions format properly. For somer eason, it won't appear color-formatted (in green) like the other funcrtions do. Here is what it looks like. The top frame is a file called PowerShellCmdletLibrary.ps1. Basically a notepad of all my commonly used one liners and such. Notice in the text, my list of functions, all fuinctions are formatted Green except Replicate-AllDomainController
Does anyone know what that might be? Silly and petty I know but just a tad annoying (killing my OCD, lol)
Tony enter image description hereenter image description here

VIM folding for ERB files?

Vim noob here. I have code folding working in most places, via indent mode, but for some reason I cannot get Vim to fold .html.erb files in ruby... even with indents.
Here's the relevant region of my vimrc. Is there something else I need to do to make Vim aware of the erb files? Is it possible to customize my folding per file type?
I'm running all the Janus plugins, so have rails.vim, etc. all installed.
let ruby_fold=1
set foldmethod=indent
set foldcolumn=0
set foldlevel=99
nnoremap <space> za<cr>
It's a difficult question, because there's probably something in your vim configuration that inhibits folding and I, for example, can't reproduce it. But I can suggest a few things you could try.
First of all, check what the values of those settings are in the actual buffer. Meaning, open up an erb file and check if the settings are correct. In order to do that, you can type, for example, set foldmethod, which will echo the current value of foldmethod to the screen. If one of the settings doesn't match the ones in your .vimrc, then that might be the problem.
Also, see if the file really does have the "eruby" filetype. If it's not displayed in your statusline, you could check that with set filetype.
Most importantly, one way of customizing settings per filetype is by creating a file with the filetype's name inside the ~/.vim/ftplugin directory. In your case, you can create the file ~/.vim/ftplugin/eruby.vim and put any filetype-specific settings in it. Setting them with setlocal instead of set will keep them local to the file. If it turns out the settings for erb are off, you can "fix" them by putting the values you want there.

Open video file by clicking on cell

I have a spreadsheet that has a list of video filenames in one column.
I'd like for a video player to open when I click on a filename.
Is there a simple way to do this?
There's a hack that lets you call external applications using the HYPERLINK command:
=HYPERLINK("mplayer", "foo")
This opens up mplayer (or whatever you tell it to). However, if I try to pass a command-line argument to the executable using:
=HYPERLINK("mplayer ~/Desktop/foo.mpeg", "foo")
then I get the error: "OpenOffice could not find a web browser on your system". It's probably attempting to parse the first argument and tripping over a space.
Does anybody know of a way I can achieve what I want? Perhaps there's a way to do this with macros?
The list of filenames is auto-generated (hundreds) so I don't want to do anything manual.
You might try using %20 instead of the space, though I don't expect it to work.
Does your player have anything like a play-list provision? It seems that it would be more direct to compile a play list in whatever format that is, than attempt to force HYPERLINK( ) to work here.
The other possibiity is to see if there is a URL scheme registered on your system that will invoke the player, rather than a command line. Or just use the file: scheme and see if you can launch the mpeg that way. You may have to monkey with the file path to get it right. You may also have to %-escape the '~' if you have any of those.

Filemaker: exporting a PLIST (for iOS)

I have a database which I want to export as an iOS compatible PLIST.
The work around I have come up with is to create a calculated field which adds the tagged padding and header and creates a report using these fields. I then export the preview of the report as a PDF, open the PDF in Acrobat Reader, select all text, copy and paste into XCode which recognises the PLIST format and all works as expected.
Is there a better way of doing this? (This seems a really convoluted way of doing things, high chance of error, etc.) The Export as XML option looks promising but I can't seem to join the dots.
Two ways that I can think of to do what you're trying to do. The most elegant way is probably the XML with XSLT export which you suggest. If you don't already know XSLT, though, you might try the following -- it sounds like with the calculated XML line you've already created, like this would be a simple change to your database:
Create a single new global field, say outputXML
Create a script, say plistCreator
In the plistCreator script:
Set outputXML to ""
Go to the first record you want to export
Loop through every record putting your calculated XML line into outputXML (set field outputXML to outputXML & ΒΆ & calculatedXMLLine)
Go to next record, exit after last
Export Field Contents (note that this is a different command than Export) for outputXML
The cleanest solution is to use the export XML with an XSLT for transforming the output. You'll need to know a little XSLT to do this, or at least be able to customize the examples from FileMaker.

How to display line numbers by default in SciTE?

I am using the lightweight SciTE Text editor and I like it very much.
I would like to configure it in order to see the line numbers displayed when I open it.
I don't want to check the "View\Line Number" menu every time.
I think that I can do it but I don't see the entry in my global options file. Does anybody know how to do it?
Try this in SciTEGlobal.properties:
# Sizes and visibility in edit pane
line.margin.visible=1
line.margin.width=5
# Sizes and visibility in edit pane
line.margin.visible=1
line.margin.width=2+ # + will expand if needed
Having seen the other answers i would say it is more "clean" to save to User options file, because it is a user setting and you might also transfer this setting together with your home directory f.e. when you migrate or copy it for other reason. Also in this cases your scite would still behave like YOU (and possibly other users) expect.
add this line to User options file ".SciTEUser.properties":
line.margin.visible=1
line.margin.width=0+ # + will expand if needed
additional comment:
for my taste the font of scite in linux is too small and therefore i also added these lines to .SciTEUser.properties:
magnification=1
output.magnification=1

Resources