I spend an awful lot of time in Opus browsing images and then viewing them in the standalone image viewer. Moving through a lister full of images is not practical as the next image I want to view is probably 120 images away from the last. Scrolling through the lister to find it is much quicker.
It struck me there must be a better way to do this that will keep both the image viewer and the lister in view at all times, whether the image is landscape or portrait.
to this end I created a couple of very simple VB macros to automate the whole process. Basically, the main macro decides whether the image to be viewed is portrait or landscape, and then in accordance with those findings it optimises both the lister size and viewer size to make full use of my 3840 x 2160 screen.
(Of course if your screen is of a different size you will have to make some adjustments to the macro, but it really is very simple to do
to the left double click event in my images group. The result is that If I double click on an image the viewer either opens in landscape or portrait mode in a position of the screen which does not interfere with the use of the lister.
If you wanted that to happen when closing the viewer via the normal X button, you can do that as well. The OnViewerEvent "destroy" event will be called any time a viewer is closed.
That is a nice idea Leo and one I have been trying for several hours to bring off.
The script I have created in the scripts directory so far reads:
option explicit
' ViewerClose
' (c) 2019 Rodger
' This is a script for Directory Opus.
' See https://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.
' Called by Directory Opus to initialize the script
Function OnInit(initData)
initData.name = "ViewerClose"
initData.version = "1.0"
initData.copyright = "(c) 2019 Rodger"
' initData.url = "https://resource.dopus.com/viewforum.php?f=35"
initData.desc = ""
initData.default_enable = true
initData.min_version = "12.0"
End Function
' Called when an event takes place in the standalone viewer
Function OnViewerEvent(viewerEventData)
End Function
Then I am stuck. How do I tell if the closeviewer event has been triggered so that I can put in my code?
Thanks Jon, but that was the first thing I tried and nothing at all happens.
This is the whole script, now:
option explicit
' ViewerClose
' (c) 2019 Rodger
' This is a script for Directory Opus.
' See https://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.
' Called by Directory Opus to initialize the script
Function OnInit(initData)
initData.name = "ViewerClose"
initData.version = "1.0"
initData.copyright = "(c) 2019 Rodger"
' initData.url = "https://resource.dopus.com/viewforum.php?f=35"
initData.desc = "Restire Lister to previous size"
initData.default_enable = true
initData.min_version = "12.0"
End Function
' Called when an event takes place in the standalone viewer
Function OnViewerEvent(viewerEventData)
if viewerEventData.event = "destroy" then
' viewer has been destroyed
ClickData.Func.Command.AddLine("Set LISTERSIZE=2800,1786")
ClickData.Func.Command.AddLine("Set LISTERPOS=100,10")
ClickData.Func.command.Run
end if
End Function
When I run a very similar script on a button on the viewer toolbar, the lister on screen is re-sized. However when I call this script by clicking on the "X" in the viewer window, nothing happens. Am missing something obvious?
I am way outside my vb comfort zone here and I really do appreciate you guys taking the time to help a slow coach like me. This is what I have now:
option explicit
' ViewerClose
' (c) 2019 Rodger
' This is a script for Directory Opus.
' See https://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.
' Called by Directory Opus to initialize the script
Function OnInit(initData)
initData.name = "ViewerClose"
initData.version = "1.0"
initData.copyright = "(c) 2019 Rodger"
' initData.url = "https://resource.dopus.com/viewforum.php?f=35"
initData.desc = "Restire Lister to previous size"
initData.default_enable = true
initData.min_version = "12.0"
End Function
' Called when an event takes place in the standalone viewer
Function OnViewerEvent(viewerEventData)
if viewerEventData.event = "destroy" then
' viewer has been destroyed
set cmd = DOpus.Create.Command()
cmd.SetSourceTab(tab)
cmd.AddLine ("Set LISTERSIZE=2800,1786")
cmd.AddLine ("Set LISTERPOS=100,10")
cmd.Run
end if
End Function
Function OnViewerEvent(viewerEventData)
Dim cmd
if viewerEventData.event = "destroy" then
set cmd = DOpus.Create.Command()
cmd.SetSourceTab viewerEventData.viewer.parenttab
cmd.AddLine "Set LISTERSIZE=2800,1786"
cmd.AddLine "Set LISTERPOS=100,10"
cmd.Run
end if
End Function