Control page URL to access a folder of images?

Posted on
Fri Jan 16, 2015 2:02 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Control page URL to access a folder of images?

Hello All,

Is it possible to create a Control Page URL to access a folder of images located on the desktop?

I already have a working URL in a Control Page that can access individual images on the desktop.
Code: Select all
file:///Users/macmini/Desktop/Mailbox.jpg


T.I.A

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Fri Jan 16, 2015 5:06 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Control page URL to access a folder of images?

What is your use-case?

A slideshow of photos?

Posted on
Fri Jan 16, 2015 5:22 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Control page URL to access a folder of images?

Hello,

I have a camera that takes an image whenever the mailbox is triggered.
Code: Select all
tell application "Finder"
   activate
   if file "Macintosh HD:Users:macmini:Desktop:Mailbox.jpg" exists then
      delete file "Macintosh HD:Users:macmini:Desktop:Mailbox.jpg"
   end if
   delay 5
end tell


I would like to have a script relocate older Mail.jpg to a folder called "PreviousImages".
When I click on the Mail.jpg image from within the ControlPage I would like it to be able to access the previous image located in "PreviousImages" folder.

Possibly a slideshow if the above cannot be configured.

Thanks you.

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Fri Jan 16, 2015 5:45 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Control page URL to access a folder of images?

I know others would do this differently, but I'd have 4-5 separate control pages for this (or possibly popup controls, but I haven't used/researched those yet).

Each would have a large URL-refresh image in the middle, for Mail1.jpg, Mail2.jpg, ... plus a forward/ back button, and a close button (which returns you to your main control page).

When you click your mailbox on the main control page, it switches to the control page for mail1.jpg

You'd just need a script to delete mail5, rename 4-5, 3-4, 2-3, 1-2, mail to mail1, and save the new captured image as mail.jpg

This then gives you your 5 most recent events.

Actually, a better script would involve a pointer variable; save mail.jpg as mail<variable_value>.jpg and increase the variable by 1. This saves renaming the files, but might involve a bit more thinking about the first link from the main control page. (The 1pixel image trick should help here)

Perer

Posted on
Fri Jan 16, 2015 5:50 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Control page URL to access a folder of images?

Perer,

Thank you, that’s a good setup idea!

Sadly my Apple scripting these days is very poor at best.
:oops:

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Sat Jan 17, 2015 2:04 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Control page URL to access a folder of images?

Python would be a better language to do the script in, and there's many more Python scripters on here that can help.

I don't know how Python interacts with the Apple file system though; I'm from windows, so someone else would be better to help with this aspect. Pop a thread in the scripting subforum referencing this thread.

Posted on
Sat Jan 17, 2015 2:05 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Control page URL to access a folder of images?

(Oh, and I'm Peter - I mistyped my name on the earlier post!)

Posted on
Sat Jan 17, 2015 4:34 am
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Control page URL to access a folder of images?

Hello and thank you Peter for the responses.
Will start the research on how a Python script vs Apple script can be used.

Much appreciated. :)

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Mon Jan 19, 2015 4:01 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Control page URL to access a folder of images?

Hello again,

I created a very basic setup that allows be to view the last two security images via a control page using this script:

Code: Select all
tell application "Finder"
   activate
   if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" exists then
      move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives" with replacing
   end if
   delay 5
end tell

tell application "SecuritySpy 3.4.2"
   capture image camera number 0 as "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
end tell


This works fine, but now I want to access the last 3 security images via a control page. So I cooked up this script:

Code: Select all
tell application "Finder"
   activate
   if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" exists then
      move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives"
      if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailbox.jpg" exists then
         move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mail.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailboxarchives2" with replacing
      end if
      delay 5
   else
      
      tell application "SecuritySpy 3.4.2"
         capture image camera number 0 as "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
      end tell
   end if
end tell


Sadly if is giving an error and I am not sure about the proper appleScript logic/syntax
Would someone please have a look and tell me how to correct this?

I have three folders:
Mailbox: for newest image
Mailboxarchives: for previous image
Mailboxarchives2: for the oldest image


T.I.A.

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Mon Jan 19, 2015 7:11 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Control page URL to access a folder of images?

Still trying to make this work. If I use this script:
Code: Select all
tell application "Finder"
   activate
   if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" exists then
      move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives" with replacing
   else
      if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailbox.jpg" exists then
         move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailbox.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailboxarchives2" with replacing
      end if
   end if
   delay 5
end tell
tell application "SecuritySpy 3.4.2"
   capture image camera number 0 as "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
end tell

The result is I get files added to:
Mailbox: yes
Mailboxarchives: yes
Mailboxarchives2: no

If I use remove the word "else" than result is I get files added to:
Mailbox: yes
Mailboxarchives: no
Mailboxarchives2: yes

I am going in a circle, as I know the solution is only a few clicks away.
Any one please?

T.I.A.

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Mon Jan 19, 2015 9:04 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Control page URL to access a folder of images?

You need to go "backwards" to avoid moving a file and losing the next older... So if you have 3 files, Archive1, Archive2 and Archive3, you need to do this:
  1. If Archive2 exists, move it to Archive3
  2. If Archive exists, move it to Archive2
  3. Capture new Archive image

I hate AppleScript so can't really code it up for you with confidence, but that is the logic you need to follow, I think you are close, just do your checks/moves in that order and you should have it.

Adam

Posted on
Mon Jan 19, 2015 9:24 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Control page URL to access a folder of images?

Hi Adam,

Thanks for the response.
I took your advice and now the code looks like this:
Code: Select all
tell application "Finder"
   activate
   if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailbox.jpg" exists then
      move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailbox.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives2" with replacing
   else
      if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" exists then
         move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives" with replacing
      end if
   end if
   delay 5
end tell
tell application "SecuritySpy 3.4.2"
   capture image camera number 0 as "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
end tell


The result is I get files added to:
Mailbox: yes
Mailboxarchives: yes
Mailboxarchives2: no

The error message is "Finder got an error: AppleEvent handler failed." number -10000

So close and yet so far.

T.I.A.

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Mon Jan 19, 2015 9:34 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Control page URL to access a folder of images?

Code: Select all
tell application "Finder"
   activate
   if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailboxarchives.jpg" exists then
      move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives:Mailboxarchives.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives2.jpg" with replacing
   end if
   if file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" exists then
         move file "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailbox.jpg" to "Macintosh HD:Users:macmini:Desktop:Mailbox:Mailboxarchives.jpg" with replacing
   end if
   delay 5
end tell
tell application "SecuritySpy 3.4.2"
   capture image camera number 0 as "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
end tell


I don't think you quite had my logic coded up... See if the above works.

Adam

Posted on
Mon Jan 19, 2015 9:41 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Control page URL to access a folder of images?

Thanks Adam,
Thats not it either. Almost
Attachments
Screen Shot 2015-01-19 at 10.36.47 PM.png
Screen Shot 2015-01-19 at 10.36.47 PM.png (122.58 KiB) Viewed 3988 times

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Mon Jan 19, 2015 9:48 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Control page URL to access a folder of images?

There is either an extra Mailboxarchives in the first check or missing ones in the others (I think), but that probably isn't your issue. I'm not very good with AppleScript, so hopefully someone else can chime in on that; I think your logical flow is now correct, just need to get the syntax down and working.

Who is online

Users browsing this forum: No registered users and 2 guests