1

I've created a very simple AppleScript app which currently, when run, displays a different image from the desktop depending on which day of the week it is as seen below:

set currentDay to weekday of (get current date)

if currentDay = Monday then
    do shell script "open ~/Desktop/Mon.png"
end if

if currentDay = Tuesday then
    do shell script "open ~/Desktop/Tue.png"
end if

if currentDay = Wednesday then
    do shell script "open ~/Desktop/Wed.png"
end if

if currentDay = Thursday then
    do shell script "open ~/Desktop/Thu.png"
end if

if currentDay = Friday then
    do shell script "open ~/Desktop/Fri.png"
end if

if currentDay = Saturday then
    do shell script "open ~/Desktop/Sat.png"
end if

if currentDay = Sunday then
    do shell script "open ~/Desktop/Sun.png"
end if

However, my real question is whether it is possible for an AppleScript to handle a Quick Look request. I.e. when I press spacebar on the app, is there a way for it to display the image rather than the details about the app?

I understand that once an AppleScript has been run, it can use this Quick Look feature by running the shell script qlmanage -p /path/to/thefile and this will display a Quick Look image of the specified file. However, this is not what I need, I would like it so that this can be done by simply pressing the spacebar on the app itself and not actually running it.

Is this possible to do?

Thank you in advance for any help,

Kind regards, Tom

  • Just a note: your script can be boiled down to these two lines: set currentDay to text 1 thru 3 of (weekday of (get current date) as text) followed by do shell script "open ~/Desktop/" & currentDay & ".png". – CJK Jul 14 '18 at 6:17
  • How To Write A QuickLook Plugin – CJK Jul 14 '18 at 6:22
  • @CJK Thanks for your reply! I've had a quick look over the guide you've linked. Any more specific advice you could give on how to integrate this with an AppleScript script? I realise that the script is extremely inefficient but I made it purely just as a way to portray my question to people on the forum. Thanks for the advice anyway! – Tom Jul 14 '18 at 14:02
  • Honestly, I don't see how it would be possible with AppleScript. – CJK Jul 14 '18 at 14:04

You must log in to answer this question.

Browse other questions tagged .