Show many images fast

Often i need to watch thru about 100 pictures very fast.

I would like to see normal window or growl type of window, which shows first image then second then third… very fast. Maybe 0.1 seconds per image.

What ways i have to do this in AppleScript Editor?

Hello!

Try this, I found that a delay of 0.4 seconds was appropriate, at least for me, if the image is to be rendered before it disappears.

You can adjust the timing by setting another value for the sleep command.


-- Works on a selection of a finder window, if first item is a folder, the contents of that folder is selected
” © McUsr and put in public domain, you may not post this elsewhere, or put it in a public accessible repository
” but refer to this post! http://macscripter.net/post.php?tid=39516
script GanderFolder
	on run
		local fl, alilist
		set fl to {}
		tell application "Finder"
			set alilist to selection as alias list
			if alilist = {} then error number -128
			if (count alilist) = 1 and class of item (item 1 of alilist) is folder then
				set fl to every file of item 1 of alilist as alias list
			end if
			repeat with analias in alilist
				if not class of item analias is folder then set end of fl to analias
			end repeat
		end tell
		gander(fl)
	end run
	
	on gander(_files)
		try
			repeat with _file in _files
				do shell script "{ sleep 0.4 ; killall qlmanage ; } & qlmanage -p " & quoted form of POSIX path of _file
			end repeat
		on error e number n
			if n ≠ -128 then display dialog e & " : " & n
		end try
	end gander
end script
tell GanderFolder to run

Edit
Added a couple of tests, and corrected the avoidance of folders.

Hello!

This just shows thumbnails of images in the folder, all at once!

But you have to click the button to see all the thumnails at once, since this process really insists on being in foreground, and I have found no way to uiscript it from within the same script while it has the focus.



-- works on a selection of a finder window, if first item is a folder, the contents of that folder is selected
” Shows thumbnails of the contents of the folder, after user have pushed the lower right button.
” © McUsr and put in public domain, you may not post this elsewhere, or put it in a public accessible repository
” but refer to this post! http://macscripter.net/post.php?tid=39516
script thumbnailsOfFolder
	on run
		local fl, alilist
		set fl to {}
		tell application "Finder"
			set alilist to selection as alias list
			if alilist = {} then error number -128
			if (count alilist) = 1 and class of item (item 1 of alilist) is folder then
				set fl to every file of item 1 of alilist as alias list
			end if
			repeat with analias in alilist
				if not class of item analias is folder then set end of fl to analias
			end repeat
		end tell
		ganderThumbnails(fl)
	end run
on ganderThumbnails(theFiles)
		local pxPaths
		set pxPaths to ""
		repeat with aFile in theFiles
			tell me to set pxPaths to pxPaths & " " & (quoted form of POSIX path of (aFile))
		end repeat
		
		set _script to "qlmanage -p " & pxPaths 
		
		try
			do shell script _script
		on error e number n
			if n ≠ -128 then display dialog e & " : " & n
		end try
	end ganderThumbnails
end script
tell thumbnailsOfFolder to run

Thanks for your scripts.

I tried first script and it don’t work. I even tried this row alone:

do shell script "{ sleep 0.4 ; killall qlmanage ; } & qlmanage -p " & quoted form of POSIX path of hard_coded_path

But it fails too.

Thanks

I’m sorry that it doesn’t work for you.

Could you please try to enter which qlmanage in a terminal window, and which sleep, and which killall too?

Edit:

If all the commands are there, then you maybe should try to increase the time for the sleep command, because maybe your configuration is such that the qlmanage command gets killed before it gets to show the image.

Try starting with 2 secs for good measure. :wink:

Hello McUsr

I tested the script posted in message #3.
Here, under 10.8.2 it behaves quite flawlessly.
I wrote quite because, if the selected files are borrowed from a folder which wasn’t open by double clicking it but an alias of it, I don’t get the pictures but the alias icon with its name, class, size and last mod date.

The log report says :
“Testing Quick Look preview with files:
/Users//Desktop/tempo”
which is the path to the alias of the folder.

As I am busy I have no time available to edit the code to take care of this case.

Yvan KOENIG (VALLAURIS, France) samedi 22 septembre 2012 17:43:07

Curious !

from time to time, when the folder is opened thru an alias, it behaves as described above and other times it behaves well.

Hi,

the scrpt works on my machine, perhaps cirno is prior 10.5¿

Other question:
Would have been nice to use finders ‘flow view’, but how to set the heigth of the showing tab?
It’s not part of window properties.

Hello.

I am sorry, but I don’t use Mountain Lion yet, and I am not sure how to translate Yvan’s log report.

I have the same problem with Coverflow as well Hans. :rolleyes:

Here is a script that maximizes a Finder window in flow view and restores it to its size again, next time the script is executed, (for those of you how would like such a window) , you still have to drag the “flow view bar” to get the size you want. (You’ll have to hardcode the bounds of your screen.) If a window doesn’t seem to be minimized, then you have to make it small manually, because you have run it on a maximized window.

global scriptpath

set scriptpath to (path to temporary items folder from user domain as text) & "net.mcusr.coverflowvals"
try
	set flow_window to load script alias scriptpath
on error
	script coverflowVals
		property original_bounds : missing value
		property original_view : missing value
	end script
	set flow_window to coverflowVals
end try

if my flow_window's original_bounds = missing value then
	my expand_window()
else
	my revert_window()
end if
store script flow_window in scriptpath replacing yes

on expand_window()
	tell application "Finder"
		activate
		try
			if class of window 1 is not Finder window then return
			tell Finder window 1
				set my flow_window's original_bounds to (get bounds)
				set my flow_window's original_view to (get current view)
				
				set bounds to {0, 44, 1680, 1050}
				set current view to flow view
			end tell
		end try
	end tell
end expand_window

on revert_window()
	tell application "Finder"
		activate
		try
			if class of window 1 is Finder window then
				tell Finder window 1
					set bounds to my flow_window's original_bounds
					set current view to my flow_window's original_view
				end tell
			end if
		end try
	end tell
	set my flow_window's original_bounds to missing value
	set my flow_window's original_view to missing value
end revert_window

Hello!

I have never really thought of trying to UI script the height of the frame or the height of the scrollarea or something. Then selecting the first file, and send key down through the filelist, could be another solution, if OP has Leopard and qlmanage isn’t included.

If OP is on Tiger, then there may be some unix tools that are possible to use like I use qlmanage in post #2 of this tread.

I am currently socializing, and writing something else, so I will look back into it :wink:

Hello!

It is so that I found another solution, the second solution requires X11 to be installed, together with the ImageMagick tools. (which display must give a result that should be : /opt/local/bin/display.

The next step is to try to fire up x11, then go to a local terminal window and enter display “posix-path to some image file”

If this works then the next step is to change the script in post #2 to use the display command, which I think you manage by yourself.

If this didn’t work, then the first easy step is to make the folder ~/.MacOsX here you save an empty info.plist file, that you rename to Environment.plist.

You then add a key to it with the key DISPLAY (case!) and value 0:0.

You now have to log out and back in again for those changes to take effect.

if you now start up x11, then open an Mac OsX terminal window, and type xclcock and gets the clock up, then you should be ok to try to run the script modified to use display again, if not, see below! (This is just the preliminaries, as we’ll have to emulate it in a do shell script command.

This is to assure that you can get contact with the X11 window server from your regular terminal window, since we’ll have to use that. And X11 should be configured to be in “normal” and not full screen mode.

You’ll have to paste the code below into your .bashrc or .profile, or whatever init file you use for bash, this just to see that we can make it work manually first.

[code] function get_xserver ()
{
case $TERM in
xterm )
XSERVER=$(who am i | awk ‘{print $NF}’ | tr -d ‘)’‘(’ )
# Ane-Pieter Wieringa suggests the following alternative:
# I_AM=$(who am i)
# SERVER=${I_AM#(}
# SERVER=${SERVER%
)}

         XSERVER=${XSERVER%%:*}
    ;;
aterm | rxvt)
# find some code that works here.....
    ;;
 esac  

}

if [ -z ${DISPLAY:=“”} ]; then
get_xserver
if [[ -z ${XSERVER} || ${XSERVER} == $(hostname) || ${XSERVER} == “unix” ]]; then
DISPLAY=“:0.0” # Display on local host
else
DISPLAY=${XSERVER}:0.0 # Display on remote host
fi
fi

export DISPLAY[/code]
When you have inited with this code in your .bashrc or other init file, (started up a new terminal window from Mac Os X), and you have fired up X11, you should be able to enter xclock in your terminal window and get the xclock up on the screen.

You should have the display command available, and for now you can try to use it on images from the command line, and they should pop up on the screen.

If you got so far in your endavours that you can make the display command work from the normal terminal window, I’d like to hear from you, and how you made it work, (Environment.plist or through the function in your .bashrc file. :slight_smile:

I have all those tools and i increased time and now it works. :smiley:

It is kind of tiring to watch lots of images this way because it flashes so much, it would be nicer if there is window or growl type of window which stays in screen all the time.

I have both Snow Leopard and Mountain Lion machines.

I don’t have X11. Thanks

Flashing is kind of tiring. Have you tried the thumbnail script in post #3?

I have no time to do this now, but I guess if one used sips, or image events, and filled a temporary folder with images scaled to the same size, the images would appear like they were shown in the same window.

I guess this is the step to have them show up uniformly in growl as well.

As for the display command, it shows the images in a normal window, so I guess it will flash a lot as well.

I think that the thumnail script may be something for you, if you maximize the window, the images are scaled up, and you’ll get the possibility to see many at once, without flashing.

If the detail level isn’t too small then.

Using iPhoto and making slideshows is maybe also a possibility, or making slideshows with the screen saver, but I havent investigated those options yet.

It is an optional install, but which are better gotten directly from Mac Os X Forge, but the configuration isn’t easy. And that will give you no better solution than the one with qlmanager

Edit

I will go back and see if I can make a Cover Flow thing to work with UI scripting, because then you also have the file in the vincinity, should you stop the script during the perusal of the pictures. Nor does it flash.

It may be problematic to set up the window correctly though, but I’ll give it a try at my leisure.

Hello the log report :

“Testing Quick Look preview with files:
/Users//Desktop/tempo”
state that the script apply Quick Look Preview to the alias named tempo which is stored on the Desktop.
This alias points to a folder named tempo which contain a lot of picture files.

When I tested the script, I opened the folder by double-clicking the alias then selecting some icons in the folder window.
It seems that the script received the path to the alias, not the paths to the selected picture files.

Yvan KOENIG (VALLAURIS, France) dimanche 23 septembre 2012 11:19:48

Hi,

what about using Safari as Browser¿


set myFolder to (choose folder)
set nameList to list folder myFolder
repeat with i from 1 to count of nameList
	tell application "System Events" to set currURL to URL of disk item ((myFolder as text) & item i of nameList)
	tell application "Safari"
		activate
		set URL of current tab of window 1 to currURL
	end tell
	delay 0.5
end repeat

You may resize previews with images events before …

Hope it’ll work

Hello.

I thought the script in post #3 above to be broken under Mavericks.

Quicklook (qlmanage) still works, the problem was that I had to add a second! for the sleep command, so qlmanage wasn’t killed before it started to display. That second has no practical meaning for the experience of the script, as it feels snappier than ever. You’ll have to adjust it accordingly if it doesn’t seem to work anymore.