Sunday, February 23, 2020

#1 2020-02-09 06:25:37 am

Fredrik71
Member
Registered: 2019-10-23
Posts: 84

Get content as (POSIX path) of different kind to quicklook

Apple's Quicklook is wonderful in so many way.

Lets say, we are in need to display a file of any kind.

1. We know the path to it.

Maybe some will use finder to get it and if the file is hidden we maybe change finder to display hidden files. We then right click on file to send to our favourite application for display.

Other maybe use terminal with cd, more, cat... and so on.

But is there other way... I think so and thats why I made this simple script.

Regards.
Fredrik

Applescript:

(*
   Description:
       Get content as (POSIX path) of different kind to quicklook
*)

on run
   set thisContent to (display dialog "Type the path as (POSIX path) to the content" default answer "~/.bash_history")'s text returned
   if thisContent = "" then
       beep 1
   else
       return do shell script "qlmanage -p " & quoted form of thisContent
   end if
end run

Last edited by Fredrik71 (2020-02-09 06:38:33 am)

Offline

 

#2 2020-02-09 06:28:44 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11668
Website

Re: Get content as (POSIX path) of different kind to quicklook

It's highly recommended to always quote paths in do shell script lines because spaces in paths will break the functionality.

Applescript:

do shell script "qlmanage -p " & quoted form of thisContent

Last edited by StefanK (2020-02-09 06:28:57 am)


regards

Stefan

Offline

 

#3 2020-02-09 06:37:53 am

Fredrik71
Member
Registered: 2019-10-23
Posts: 84

Re: Get content as (POSIX path) of different kind to quicklook

You are right...Stefan thanks,

I will update, to be honest I always do but this time I forgot, I will also include return.

StefanK wrote:

It's highly recommended to always quote paths in do shell script lines because spaces in paths will break the functionality.

Applescript:

do shell script "qlmanage -p " & quoted form of thisContent

Last edited by Fredrik71 (2020-02-09 06:43:20 am)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)