revUp - Updates and news for the Revolution community
Issue 96 | July 7th 2010 Contact the Editor | How to Contribute

FusionCharts Import->Export
Temporary path, permanent solution

by William Roger Moseid

This article shows how to create a Rev application that uses the SpecialFolders Path and the CustomProperties functions to import/export FusionCharts files. In this article I’ll show how this file was created to support Mac and Win. The phrase “Temporary Path, Permanent Solution" describes the technique for managing FusionCharts with a minimal footprint on your system.

We will show how you can use FusionCharts (swf, css, js and html files) to “bolt on” charting functionality to your Rev solutions. SpecialFolders were dealt with in the previous article, in this article we will show how to use them to import the files from a folder on your system, along with the usage of CustomProperties. Why? Well, because CustomProperties are used to store the imported files. Subsequently, SpecialFolders will be used to export these files from the CustomProperties storage to a temporary storage area.

Consider FileMaker, where a solution I created obtains the path to temporary storage on Mac and Win during a given session. During an FMP session, chart files are imported, which needs be done only once. Then, during each subsequent session these imported files are automatically exported to a temporary storage area depending on the FusionCharts Mode (Free or Trial/Pro). At that point, report information is assembled and a URL string is created. The first part of the URL string is the location of the chart files followed by the chart report info. That URL string is passed to a WebViewer (the FMP) equivalent of Revolutions revBrowser and the chart is rendered.

So, I’m on a mission to replicate this functionality in Rev and pass it on to the Rev community.

A special thanks to Mark Weider for showing this Rev newbie how CustomProperties work. Mark has just finished a lesson on CustomProperties, which can be found here.

During this task of learning Rev’s input/output functionality, I created a stack that shows the Rev developer how to:

  • Employ the answer folder technique to identify, the location of the FusionChart folder
  • Use SpecialFolders to obtain these files and store them in a CustomProperty
  • Export these files from the CustomProperty, using the SpecialFolders function, to a folder in a temporary area.

This functionality is the first major step prior to rendering the specified chart. In pursuing this task, excellent help was afforded by Mark Weider of ahsoftware.net.

A subsequent article will show how FusionCharts along with the required URL string will call a revBrowser or Browser (FireFox, Safari, IE, etc.) to process the passed URL string and render the specified chart.

FusionCharts Input/Output Overview
The purpose of the FusionCharts InputOutput.rev file is to show the rev developer how the use of the SpecialFolders and CustomProperties will provide a technique so FusionCharts files can be imported into CustomProperties for storage, then exported to a Temporary Folder during that session or a subsequent session. Figure 1, below, was created on the Mac using Omnigraffle.

Figure 1 - FusionCharts Input/Output Overview
Mac screenshots were taken using Grab. Images from Grab were processed using Preview, then saving the images as png. The FusionCharts Input/Output file is composed of one stack and 2 cards. The first card contains all the GUI and controls. The second card contains the image files used to “skin” buttons when in a Win/Mac environment. The skinning technique employs transparent buttons and image files. The subsequent GUI appearance is similar on Win and Mac:

Figure 2.1 – Mac FusionCharts ImportExport Figure 2.2 – Win FusionCharts ImportExport


The scripts are the same for Mac and Win and, when required, execute steps that are unique for each platform. When clicked, the “Get File Names List” button will:

  • Ask the user to pick the FusionCharts folder for import
  • If the folder is not found, the user is advised
  • If the FusionCharts import folder is found:
    • A blue highlight is set in the“Get File Names List” button
    • The imported File Name List is inserted as a ToolTip into the “File Name List” button
    • A ToolTip is inserted into the “Erase File Names” button
    • DropShadow is also applied to the “File Name List” and “Erase File Name List” buttons to advise the user the File Names have been obtained


This action provides visual feedback of the processing to the user. When clicked, the “Erase File Name List” button will:

  • Set the “Get File Name List” button highlight to false
  • Erase the ToolTip and DropShadow of the “File Name List” and “Erase File Name List” buttons


This action provides visual feedback of the processing to the user. The “Import FusionCharts Files” button will:

  • Import the FusionCharts files into the cChartFiles CustomProperty as compressed binary files.
    • A blue highlight is set in button “Import FusionCharts Files” for user feedback
    • The imported file count is inserted into the “# of Files Imported” button as a ToolTip
    • A ToolTip is inserted into the Erase Files Imported # button. DropShadow is also applied to buttons “# of Files Imported” and “Erase Files Imported #”


This action provides visual feedback of the processing to the user. When clicked, the “Erase Files Imported #” button will:

  • Erase the “Import FusionCharts Files” button highlight
  • Erase the ToolTips and DropShadow on the “Erase File Name List” and “File Name List” buttons

This action provides visual feedback of the processing to the user. The “Export FusionCharts Files” button exports the FusionCharts files from the cChartFiles CustomProperty as decompressed binary files to a Temporary Folder.
  • A blue highlight is set in button “Export FusionCharts Files” for user feedback
  • A ToolTip is inserted into the “Erase Files Imported #” button.
  • The exported file count is inserted into the “# of Files Exported” button as a ToolTip. DropShadow is applied to “# of Files Exported” and “Erase Files Exported #” buttons


This action provides visual feedback of the processing to the user


Preparing Button Skins: Blue Buttons (Hilite Icon)


On the Tools Pallet:

  • Selected the Default Button then drag it to the card layout as shown in Figure 3 – Tool Pallet and Figure 4 – Blue Button Creation.
  • Selected Label, drag and position it over the Blue button
  • Selected Property Inspector/Contents, followed by selecting the ToolBar/Text/Align/Center. Changed Label text to :”Get File Names List”
  • Took screenshots as shown in Figures 5, 6 and 7
Figure 3 – Rev Tools
Figure 4 – Blue Button Creation
  • Selected Property Inspector/Size & Position, entered 120 px width and 24 px height values.
  • Opened the Property Inspector/Basic Properties and unchecked Show Name.
  • Positioned the mouse as shown in Figure 5 - Move Mouse To Turn Blue, then Rev displays a blue button.
  • Used HyperSnap 6 to capture the blue button image, pasted the image on a FileMaker file (FMP Canvas) in layout mode.
  • The FMP file was used to:
    • Assemble various image screenshot parts
    • Selected the image and pasted it as a HyperSnap 6 image, with a 118 px width and 22 px height.
    • All completed button images were pasted on the Overlay Image card (Figure 10 – Overlay Images)
Figure 5 – Move Mouse To Turn Blue Figure 6 - Take Blue Button Snapshot Figure 7 – Blue Button

Repeat the steps above, then create 2 additional blue buttons (152 px width and 22 px height) as described above with these 2 labels: “Import FusionCharts Files” and “Export FusionCharts Files”.

Preparing Button Skins: White Buttons (Icon)
The white button creation process is shown in Figures 8, 9.1, 9.2 and 9,3
On the Tool Pallet, select Push Button (Figure 8), drag it to the card layout as shown in Figure 9.1.

Figure 8 –Tools/Push Button
Figure 9.1 – White Button Creation (card id 1002)



Create a white button sized to 118 px width and 22 px length with a label of “Get File Name List”. Then, make 2 white buttons sized to 152 px length and 22 px height with labels “Import FusionCharts Files” and “Export FusionCharts Files”. Create 3 more white buttons sized to 126 px length and 22 px width with labels: ‘Erase File Name List”, “Erase Files Imported #” and “Erase Files Exported #”.

Figure 9.2 – White Button Creation
Place the applicable label over each button as shown in Figure 9.2.

Figure 9.3 – White Button Snapshot
Overlay Images (Mac/Win)
The images below were used to skin the transparent buttons on Figures 2.1 (Mac) and 2.2 (Win)

Figure 10 – Overlay Images (card id 1118)

Hilight Icons: 1181, 1178 and 1176
Non Highlight Icons: 1187, 1192, 1196, 1221, 1237, 1223

Skinning The Cat:

Figure 11 –Get File Names List Button Figure 12 – Get File Names List, Icons & Border

Before following the process below, all the buttons need set as follows:
Select Tools/Edit Pointer/Property Inspector/Basic Properties/Icons & Border then select each button and set it to Style of Transparent

Set Button Skin Process
Select Tools/Edit Pointer/Basic Properties/Icons & Border, then:

  • Select the Get File Names List Button
    • o Enter“1187 for the Icon
    • The Get File Names List Button Icon (White) appears
    • Enter“1181” for the Icon
    • The Get File Names List Button Highlight Icon (Blue) appears
  • Select the Import FusionCharts Files Button
    • Enter“1192 for the Icon
    • The Import FusionCharts Files Button Icon (White) appears
    • Enter“1178 for the Hilite Icon
    • The Import FusionCharts Files Button Highlight Icon (Blue) appears
  • Select the Export FusionCharts Files Button
    • Enter“1196 for the Icon
    • The Export FusionCharts Files Button Icon (White) appears
    • Enter“1176 for the Hilite Icon
    • The Export FusionCharts Files Button Highlight Icon (Blue) appears
  • Select the Erase File Name List Button
    • Enter“1121 for the Icon
    • The Erase File Name List Button Icon (White) appears
  • Selected the Erase Files Imported # Button
    • Entered “1237” for the Icon
    • The Erase Files Imported # Button Icon (White) appears
  • Select the Erase Files Imported # Button
    • Enter“1223” for the Icon
    • The Erase Files Imported # Button Icon (White) appears

FusionCharts Tool Tips
Tool Tips were used in the following buttons:

  • Get File Names List
  • File Name List
  • Erase File Names List
  • Import FusionCharts Files
  • # of Files Imported
  • Erase Files Imported #
  • Export FusionCharts Files
  • # of Files Exported
  • Erase Files Exported #

ToolTips & ToolTip Calc Examples
Note that the ToolTip calculations below, create paginated ToolTips using the paradigm “Text Line 1” & cr & “Text Line 2”, etc.
   
set the ToolTip of Btn "Erase File Name List" to \
       "Click Here To Erase" & cr & "The File Name List"

When the “Get File Names List” button is clicked:

  • The FusionCharts filenames are imported from the FusionCharts folder and set into the “File Name List” button’s ToolTip.
  • Sets the highlight of itself to true
  • Sets the above ToolTip into the “Erase File Name List” button’s ToolTip
  • Sets DropShadows of the “Erase File Name List” and “File Name List” buttons


This action provides visual feedback of the processing to the user.

set the ToolTip of Btn "Get File Names List" to \
       "Click Here To Import" & cr & "The FusionCharts"
\ & cr & "FileNames Into The"& cr & "Filename List" 


When the “Erase File Name List” button is clicked:

  • The highlight of the “Get File Names List” button is set to false
  • Sets the above ToolTip into the “Get File Names List” button’s ToolTip.
  • Erases the DropShadow from itself
  • Sets it’s own ToolTip to empty and the “File Name List” button’s ToolTip to empty

This action provides visual feedback of the processing to the user.

set the ToolTip of Btn "Erase Files Imported #" to \
       "Click Here To Erase" & cr & "Files Imported #"

When the “Import FusionCharts Files” button is clicked:

  • FusionCharts files are imported into the CustomProperty cChartFiles
  • Sets the highlight of itself to true
  • Sets it’s own ToolTip to empty
  • The “# of Files Imported” button ToolTip is set to “<number> of Files Imported
  • Sets the DropShadows of “# of Files Imported” and “Erase Files Imported #” buttons


This action provides visual feedback of the processing to the user.

set the ToolTip of Btn "Import FusionCharts Files" to \
       "Click Here To Import" & cr & "FusionCharts Files"

When the “Erase File Imported #” button is clicked:

  • The highlight of the “Import FusionCharts Files” button is set to to false
  • Sets the “Import FusionCharts Files” button’s ToolTip
  • Sets the “# of Files ToolTip” ToolTip to empty
  • Sets it’s own ToolTip to empty.


This action provides visual feedback of the processing to the user.

set the ToolTip of Btn "Export FusionCharts Files" to \
       "Click Here To Export" & cr & "FusionCharts Files"

When the Export FusionCharts Files button is clicked:

  • The FusionCharts files are exported to the specified SpecialFolders Temporary Folder
  • Sets the hilite of itself to true
  • Sets it’s own ToolTip to empty.
  • The “# of Files Imported” button’s ToolTip is set to “<number> of Files Imported”
  • Sets the DropShadows of the “# of Files Imported” and “Erase Files Imported #” buttons

This action provides visual feedback of the processing to the user.

set the ToolTip of Btn "Import FusionCharts Files" to \
       "Click Here To Import" & cr & "FusionCharts Files"’

When the “Erase File Exported #” button is clicked:

  • The “Import FusionCharts Files” button’s highlight is set to false
  • The “# of Files Exported” button’s ToolTip is set to empty
  • It’s own ToolTip is set to empty


This action provides visual feedback of processing to the user.


SpecialFolders Temporary Folder
The FusionCharts ImportExport file uses the SpecialFolders function to create, if needed, the Temporary Folder of S10.1 (Mac/Win) as well as exporting the FusionCharts files to that folder. On the Mac when the “Export FusionCharts Files” button is clicked, the FusionCharts files are exported as shown below in FireFox:

Figure 14.1 FusionCharts Files Figure 14.2 - S10.1 Deleted On Stack Close


When the “Export FusionCharts Files” button is clicked, the FusionCharts files are exported as shown below in Safari:

Figure 15.1 - FusionCharts Files Figure 15.2 - S10.1 Deleted On Stack Close


On Windows when the “Export FusionCharts Files” button is clicked, the FusionCharts files are exported as shown below in FireFox:

Figure 16.1 - S10.1, FusionCharts Files Figure 16.2 - S10.1, Deleted On Stack Close

On the Win when the “Export FusionCharts Files” button is clicked, the FusionCharts files are exported as shown below in Internet Explorer:

Figure 17.1 – S10.1, FusionCharts Files Figure 17.2 - S10.1, Deleted On Stack Close

FusionCharts ImportExport Stack Scripts



/--
-- Author: Andy Piddock
-- Creation Date: mm/dd/2007
-- About These Scripts:
-- Close Stack
-- Cleanup Fields
-- Get Folder Content
-- Quit Routines
-- History
-- Modifier: William Roger Moseid
-- Date: 06/24/2010
-- Added Script Header
-- Added Andy's Quit Scripts
-- Added Setup Win /Mac SpecialFolders Configuration
--/
-- Get folder contents
function folder_content tFolder
   local olddir
   local tFiles
   
   put the defaultfolder into olddir
   set the defaultfolder to tFolder
   put the files into tFiles
   set the defaultfolder to olddir
   return tFiles
end folder_content

on preOpenStack
   -- Set Win or Mac SpecialFolders Configuration
   -- i.e.,
   if "Mac" is not in the platform then
      put "28" into Fld "tSF#_Code"
      put "Win SpecialFolders Number:" into Fld "LblSF#_Code"
   else -- Is Mac
      put "temp" into Fld "tSF#_Code"
      put "Mac SpecialFolders Code:" into Fld "LblSF#_Code"
   end if
   
end preOpenStack

on closeStack
   -- Delete Temporary Folder
   revDeleteFolder Fld "FldSFPath"
   
   //Uncomment if exe made
   //clear_fields
   quitMyProject
   pass closeStack
end closeStack


Figure 18a – Stack Scripts

-Quit routines
on quitMyProject
   local myStacks
   local myMsgs
   local myDontClose
   
   lock messages
   -- Stop using stacks
   put the stacksInUse into myStacks
   repeat for each line myStack in myStacks
      stop using stack myStack
   end repeat
   -- Stacks
   put the openStacks into myStacks
   put "message box,home,tool,Message Box,revTools,revMenubar" \
          & comma & the short name of me into myDontClose
   repeat for each line myStack in myStacks
      if myStack is not among the items of myDontClose then \
             close stack myStack
   end repeat
   -- Messages
   put the pendingmessages into myMsgs
   repeat for each line myMsg in myMsgs
      cancel item 1 of myMsg
   end repeat
   set the backdrop to none
   close me
   if the environment is not "development" then
      quit
   end if
end quitMyProjectnd quitMyProject��������

Figure 18b – Stack Scripts

/-- Author: Mark Weider, William Roger Moseid
-- Creation Date: 04/03/2010
-- About This Script:
--   Empties The Special Folder Path Table
--   Clears The Filename Lists
--   Puts The Folder Path Code, If Any, In 
--      The Special Folder Path Field
-- History
-- Modifier: William Roger Moseid
-- Date: 06/25/2010
-- Added Script Header & Comments
-- Added DropShadow Logic & Cursor Setup
-- Added Background Color For Mac
-- Added Cursor Setup
--/
on preOpenStack
   global tEraseDropShadow, tSetDropShadow
   -- Set DropShadow Hues
   put "255,255,255" into tEraseDropShadow
   put "100,100,100" into tSetDropShadow
   
   
   -- Set Win  or Mac SpecialFolders Configuration
   -- i.e., 
   -- 
   if "Mac" is not in the platform then
      put "28" into Fld "tSF#_Code"
      put "Win SpecialFolders Number:" into Fld
      "LblSF#_Code"
   else -- Is Mac
      put "temp" into Fld "tSF#_Code"
      put "Mac SpecialFolders Code:" into Fld "LblSF#_Code"
      -- Set Win Type Color
      set backgroundColor of this card to 231, 238, 241
   end if
   
   -- Cursor Setup
   set the cursor to hand
   set the lockCursor to true
end preOpenStack

Figure 19 – Card Script


-- Author: Mark Weider, William Roger Moseid
-- Creation Date: 04/03/2010
-- About This Script:
--   Empties The Special Folder Path Table
--   Clears The Filename Lists
--   Puts The Folder Path Code, If Any, In The Special Folder
-- Path Field
-- History
-- Modifier: William Roger Moseid
-- Date: 06/05/2010
-- Added Script Header & Comments
-- Added Answer Folder Logic
-- Added FusionCharts Folder ID Check
-- Added DropShadow Visual Feedback Logic
--/
on mouseUp
   global tEraseDropShadow
   global tSetDropShadow
   
   local tMyPath
   local tMyFiles
   
   -- Set User Visual Feedback File Name List Access Is Started
   set the dropShadow["color"] of Btn "File Name List" to \
          tEraseDropShadow
   set the dropShadow["color"] of btn "Erase File Name List" to \
          tEraseDropSHadow
   
   -- Clear Out Any Previous File Names
   put empty into button "File Name List"
   -- Set User Visual Feedback File Name List Access Is Started
   set the highlight of Btn "Get File Names List" to false
   -- Query User To Select FusionCharts Import Folder
   Answer Folder "Select Files  Folder"
   put it into tMyPath
   set Folder to tMyPath
   -- Make Sure Ihe FusionCharts Folder Really Exists
   if there is a folder tMyPath then
      -- Get The List Of Files In The Source Directory
      put folder_content(tMyPath) into tMyFiles
      -- Is It A FusionCharts Import Folder?
      If "FCColors.js" is not in tMyFiles then
         answer "FusionCharts Import Folder Not Found"
      else
         -- Filter System File If Mac
         if "Mac" is in the platform then
            -- Clear Mac System File Name
            filter tmyfiles without ".DS_Store"
         end if

Figure 20a – Get File Names List

-- Prepare To Set ToolTip (File Name List)
put tMyFiles into button "File Name List"
set the ToolTip of Btn "File Name List" to tMyFiles
-- Set FusionCharts Selected Folder Path
put tMyPath into Fld "theFilePath"
wait 1 sec
-- Setup User Visual Feedback That FileName List Is
-- Obtained
set the dropShadow["color"] of btn "File Name List" to \
       tSetDropSHadow
set the dropShadow["color"] of btn \
       "Erase File Name List" to tSetDropSHadow
set the highlight of Btn "Get File Names List" to true
set the ToolTip of Btn "Erase File Name List" to \
       "Click Here To Erase" & cr & "The File Name List"
set the toolTip of Btn "Get File Names List" to empty
-- Restore Cursor After Accessing FusionCharts Import
-- Folder
set the cursor to hand
set the lockCursor to true
end if
end if
end mouseUpd if
end mouseUp

Figure 20b – Get File Names List


-- Author: William Roger Moseid
-- Creation Date: 04/03/2010
-- About This Script:
--   Erases File Name List In Btn File Name List ToolTip
--   Erases Btn File Name List DropShadow
--   Erases Btn Erase File Name List DropShadow
-- History
-- Modifier: William Roger Moseid
-- Date: 06/23/2010
-- Added Script Header & Comments
-- Added Tool Tip & Erase DropShadow Logic
--/

on mouseUp
   global tEraseDropShadow
   
   -- Show User FileName List, ToolTip, Highlight & DropShadows
   -- Erased
   set the highlight of  Btn "Get File Names List" to false
   set the toolTip of btn "File Name List" to empty
   set the toolTip of btn "Erase File Name List" to empty
   set the DropShadow["color"] of btn "File Name List" to \
          tEraseDropShadow
   set the DropShadow["color"] of btn "Erase File Name List" to \
          tEraseDropShadow
end mouseUp
Figure 21 – Erase File Name List

/-- Author: Mark Weider, William Roger Moseid
-- Creation Date: 04/03/2010
-- About This Script:
--   Handler: Import FusionCharts File Handler
--   Inputs  19 FusionCharts files into This Stack in the
-- Custom Property Set: cChartFiles
--   URL: tFilePath is the Source Of The FusionCharts Files
--   FldSFPath is the Destination Of The FusionCharts Files
-- History
-- Modifier: William Roger Moseid
-- Date: 06/16/2010
-- Added Script Header & Comments
-- Added tCount For Amount Of Files Imported
-- Added Logic For::
--   Highlight Control for Buttons:
--     "Get File Names List", "Import FusionCharts Files",
-- ExportFusionCHarts Files
--   DropShadow Control & ToolTips for Buttons:
--     "File Name List", "# of Files Imported",
# "# of Files Imported"
--/
on mouseUp
   global tEraseDropShadow
   global tSetDropShadow
   
   local tChartFolder
   local tFilePath
   local tCharts
   local tCount
   local tAllCustomProperties
   
   -- Alert User File Import Has Started
   set the highlight of btn "Import FusionCharts Files" to false
   set the dropShadow["color"] of btn "# of Files Imported" to \
          tEraseDropShadow
   set the dropShadow["color"] of btn "Erase Files Imported #" \
          to tEraseDropShadow
   wait 1 sec
   
   -- Clear Out All Files From The Previous Import
   put the custompropertysets of this stack into \
          tAllCustomProperties
   filter tAllCustomProperties without "cChartFiles"
   set the custompropertysets of this stack to \
          tAllCustomProperties
   put field "theFilePath" into tChartFoldern

Figure 22a – Import FusionCharts Files

 

-- Get The List Of Files To Import
put folder_content(field "theFilePath") into tCharts
if "Mac" is in the platform then
   -- Clear System File Name
   filter tCharts without ".DS_Store"
end if
repeat for each line tFileName in tCharts
   put tChartFolder & "/" & tFileName into tFilePath
   -- Store Each File &
   -- Compress Files To Reduce Stack Space
   set the cChartFiles[tFileName] of this stack to \
          compress(url ("binfile:" & tFilePath))
   add 1 to tCount
end repeat

-- Set ToolTip For # Of Files Imported
set the ToolTip of Btn "# of Files Imported" to tCount & \
       " Files Imported"
-- Alert User, File Import Completed Visual Feedback
set the highlight of btn "Import FusionCharts Files" to True
set the ToolTip of Btn "Erase File Name List" to \
       "Click, Erase Files Imported #"
set the dropShadow["color"] of btn "# of Files Imported" to \
       tSetDropShadow
set the dropShadow["color"] of btn "Erase Files Imported #" \
       to tSetDropShadow
end mouseUp

Figure 22b – Import FusionCharts Files

-- Author: William Roger Moseid
-- Creation Date: 04/03/2010
-- About This Script:
--   Erases Btn Import FusionCharts Files Highlight
--   Erases Btn # of Files Imported ToolTup
--   Erases Btn # of Files Imported DropShadow
--   Erases Btn Erase Files Imported DropShadow
-- History
-- Modifier: William Roger Moseid
-- Date: 06/23/2010
-- Added Script Header & Comments
-- Added Tool Tip & Erase DropShadow Logic
--/

on mouseUp
   global tEraseDropShadow
   
   -- Show User: # of Files Imported, ToolTip, Highlight &
   # DropShadows Erased
   set the highlight of Btn "Import FusionCharts Files" to false
   set the ToolTip of Btn "Import FusionCharts Files" to \
          "Click Here To Import" & cr & "FusionCharts Files"
   set the toolTip of Btn "Erase Files Imported #" to empty
   set the toolTip of Btn "# of Files Imported" to empty
   set the DropShadow["color"] of btn "# of Files Imported" to \
          tEraseDropShadow
   set the DropShadow["color"] of btn "Erase Files Imported #" \
          to tEraseDropShadow
end mouseUp

Figure 23 – Erase Files Imported #

on mouseUp
   global tSetDropShadow
   global tEraseDropShadow
   
   local tCount
   local tFilePath
   local tFolder
   local tKeys
   local tSFNumber
   -- Setup DropShadow Logic (Visual Export File Progress To User)
   set the DropShadow["color"] of btn "# of Files Exported" to \
          tEraseDropShadow
   set the DropShadow["color"] of btn "Erase Files Exported #" \
          to tEraseDropShadow
   
   -- Create Destination Folder if Doesn't Exist
   put specialFolderPath(Fld "tSF#_Code") & kDestinationFolder \
          into tFolder
   if there is no folder tFolder then
      create folder tFolder
   end if
   -- Setup Visual Export File Progress To User
   set the highlight of btn "Export FusionCharts Files" to false
   -- Allow The User To See Highlight Change
   wait for 1 seconds
   	
   -- Assemble The Export URL For Mac/Win
   put specialFolderPath(Fld "tSF#_Code") & kDestinationFolder \
          into tFilePath
   -- Display Destination Path
   put tFilePath into fld "FldSFPath" 

Figure 24a – Export FusionCharts Files

-- Export FusionCharts Files
-- Get File List Stored In CustomProperties
put the customkeys["cChartFiles"] of this stack into tKeys
repeat for each line tLine in tKeys
   -- Decompress Files During Export
   -- (Compressed File During Import Into CustomProperties)
   put decompress(the cChartFiles[tLine] of this stack) into URL \
          ("binfile:" & tFilePath & tLine)
   add 1 to tCount
end repeat

-- Set ToolTip (# of Files Exported)
set the ToolTip of Btn "# of Files Exported" to tCount & \
       " Files Exported"
-- Visual Feedback To User File Export Completed
set the ToolTip of Btn "Erase Files Exported #" to \
       "Click Here To Erase” & cr & “Files Exported #"
set the DropShadow["color"] of btn "# of Files Exported" to \
       tSetDropShadow
set the DropShadow["color"] of btn "Erase Files Exported #" \
       to tSetDropShadow
set the highlight of btn "Export FusionCharts Files" to true
end mouseUp

Figure 24b – Export FusionCharts Files

-- Author: William Roger Moseid
-- Creation Date: 04/03/2010
-- About This Script:
of Btn "Export FusionCharts Files" to false
set the toolTip of Btn "# of Files Exported" to empty 
set the DropShadow["color"] of btn "# of Files Exported" to \
       tEraseDropShadow
set the DropShadow["color"] of btn "Erase Files Exported #" \
       to tEraseDropShadow
end mouseUp
--   Erases Btn Export FusionCharts Files Highlight
--   Erases Btn # of Files Exported
--   Erases Btn # of Files Exported DropShadow
--   Erases Btn Erase File Name List Exported # DropShadow
-- History
-- Modifier: William Roger Moseid
-- Date: 06/23/2010
-- Added Script Header & Comments
-- Added Tool Tip & Erase DropShadow Logic
--/

on mouseUp
   global tEraseDropShadow
   Set The ToolTip For The Get File Names List Button
   set the ToolTip of Btn "Get File Names List" to \
          "Click Here To Erase" & cr & "The Files Exported #"
   set the toolTip of Btn "# of Files Exported" to empty 
   set the DropShadow["color"] of btn "# of Files Exported" to \
          tEraseDropShadow
   set the DropShadow["color"] of btn "Erase Files Exported #" \
          to tEraseDropShadow
end mouseUp

Figure 25 – Erase Files Exported #


Conclusion
The SpecialFolders and CustomProperties feature in Rev enables Rev developers to quickly and easily modify their stack files in order to take advantage of the functionality in this article. The FusionCharts ImportExport.rev (Mac/Win) file discussed in this article can be downloaded here.

Currently there are 22 Free FusionCharts swf files and 46 Trial/Pro swf files along with 9 Free and 9 Trial/Pro css, js and html files. This solution uses 10 Trial/Pro swf files and 9 css, js and html files. The only difference between the Trial and Pro swf files is the Trial swf files have a watermark. In the next article, I’ll explore how to use FusionCharts in Rev. The article will show how in Rev, FusionCharts files are imported via SpecialFolders into CustomProperties, exported via SpecialFolders to Temporary Storage and data is collected for a report. The technique will include using the FusionCharts files (swf, css, js and html files) to render charts in Rev in a revBrowser.

About the Author

William Roger Moseid is president of fmpsolutions, and a "newbie" Revolution developer. More articles will follow.

Main Menu

What's New

5 new addons for only $199