Click Here Design
 
  About
  Services
  Software
      CubicNavigator
           Tutorials
           FAQ
      CubicConverter
      CubicConnector
  Samples
  Contact
  Downloads

sml-cubicnav-icon.jpg  AppleScript

Introduction

Using

Samples

 

Introduction

CubicNavigator can be controlled through AppleScript, which allows many possibilities: having a slideshow start when the computer starts, controlling the VR view from another app for training purposes, opening VR scenes in response to help requests, and so on.

 

Using

AppleScript is powerful and generally easy to use, but sometimes its syntax can encourage silly errors, even for experienced scripters. Often, the best way of piecing together a useful script is to cut and paste lines from an existing working script.

Below are listed a number of scripted examples which CubicNavigator understands. Most of these blocks can simply be cut and pasted into Script Editor, then further adapted as required.

For a list of commands and properties in AppleScript parlance, open CubicNavigator's AppleScript dictionary by going to Script Editor's File > Open Dictionary menu command and select "CubicNavigator" from the alphabetical list which appears.

scripteditordictionary.jpg

Scripting CubicNavigator is straightforward, there are just one or two notes to watch out for:

Commands can be sent to, and properties set for, both windows and the application itself. In version 1.0 of CubicNavigator only one window is allowed (so as to reduce the impact on OpenGL VRAM use), so these have the same meaning. For example, "set URL to..." is the same as "set URL of window 1 to..." It is thus easier to script the application directly rather than referring to a window.

 

Samples

 

(* setting a web address to view *)
tell application "CubicNavigator"
      activate
      set URL to "http://www.apple.com/quicktime/gallery/cubicvr/grand_central.html"
end tell

 

(* setting a local file to view *)
tell application "CubicNavigator"
      activate
      set URL to "/Users/michaelb/VR/Sample Tour.mov"
end tell


 

(* emptying the VR view *)
tell application "CubicNavigator"
      activate
      set URL to ""
end tell

 

(* testing the current pan/tilt/zoom of the view *)
tell application "CubicNavigator"
      activate
      get pan
end tell

 

(* setting the "pan" or "tilt" or "zoom" of the view *)
tell application "CubicNavigator"
      activate
      set pan to 45.0
end tell

 

(* setting pan/tilt/zoom all at once *)
tell application "CubicNavigator"
      activate
      change view to pan 45.0 tilt 10.0 zoom 55.0
end tell

 

(* starting and stopping a slideshow *)
tell application "CubicNavigator"
      activate

      -- starting a slideshow
      start slideshow kind "bookmarks" with randomize and repeat

      -- pausing an AppleScript for x seconds
      delay 20

      -- stopping a slideshow
      stop slideshow

      -- testing if a slideshow is running
      get isSlideshowRunning

end tell

 

(* going into fullscreen mode *)
tell application "CubicNavigator"
      activate

      -- entering fullscreen mode
      set isFullscreen to true

      -- pausing an AppleScript for x seconds
      delay 10

      -- exiting fullscreen mode
      set isFullscreen to false

      -- testing if fullscreen mode is active
      get isFullscreen

end tell

 

(* loading and playing a recording of a panning sequence *)
tell application "CubicNavigator"
      activate

      load recording "/Users/michaelb/Desktop/test.cnrecording"

      play recording

end tell

 

(* getting the duration of a recording (seconds) *)
tell application "CubicNavigator"
      activate

      load recording "/Users/michaelb/Desktop/test.cnrecording"

      get duration

end tell

 

(* loading the current page into Safari *)
tell application "CubicNavigator"

      show page in browser

end tell

 

(* opening an existing bookmark *)
tell application "CubicNavigator"

      set bookmark to "times square" -- not case sensitive

end tell

 

(* hiding/showing the cursor *)
tell application "CubicNavigator"

      hide cursor

      -- pausing an AppleScript for x seconds
      delay 5

      show cursor

end tell

 

(* hiding/showing keywords *)
tell application "CubicNavigator"

      show keywords

      -- pausing an AppleScript for x seconds
      delay 5

      hide keywords

end tell

 

(* panning by small amounts *)
tell application "CubicNavigator"

      pan right -- choice of right/left/up/down

end tell

 

(* panning continously *)
tell application "CubicNavigator"

      start panning right -- choice of right/left/up/down

      -- pausing an AppleScript for x seconds
      delay 5

      stop panning

end tell

 

(Return to List of Tutorials)