• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
What is the essential difference between ASOC on Script Editor and Xcode based ASOC app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What is the essential difference between ASOC on Script Editor and Xcode based ASOC app


  • Subject: What is the essential difference between ASOC on Script Editor and Xcode based ASOC app
  • From: Takaaki Naganoya <email@hidden>
  • Date: Thu, 15 Oct 2015 12:51:32 +0900

Hi All,

I wrote a easy sample graphing application using “AmCharts” framework on OS X 10.11.
(https://github.com/ChimpStudios/AmCharts)

Xcode based ASOC app could draw chart and display animation perfectly.

Same graphing script on Script Editor could not draw the graph (I made a Window dynamically for debugging ).
Exported applet version could not draw graph, too.

Script Editor version have to install “AmCharts.framework” in  your "~/Library/Frameworks” folder.
And it have to be run by control-command-R.

What is the essential difference among these runtime environment?

<Xcode version>
on applicationWillFinishLaunching_(aNotification)

--Make pieChart
set pieChart to current application's AmPieChart's alloc()'s init()
set pieChart's |type| to "pie"
set pieChart's theme to "none"


set aRecList to {{country:"Lithuania", |liters|:(501.9)}, {country:"Czech Republic", |liters|:(301.9)}, {country:"Ireland", |liters|:(201.1)}}
set dataProvider to current application's NSMutableArray's arrayWithArray:aRecList


set pieChart's dataProvider to dataProvider
set pieChart's valueField to "liters"
set pieChart's titleField to "country"

amChartV's setChart:pieChart
amChartV's drawChart()

end applicationWillFinishLaunching_
</Xcode version>

<Script Editor version>
-- Created 2015-10-15 by Takaaki Naganoya
-- 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"
use framework "Quartz"
use framework "AmCharts" --https://github.com/ChimpStudios/AmCharts


set aWidth to 400.0
set aHeight to 400.0
set outPath to "~/Desktop/test.png"


--Make pieChart
set pieChart to current application's AmPieChart's alloc()'s init()
set pieChart’s type to "pie"
set pieChart's theme to "none"

set aRecList to {{country:"Lithuania", |liters|:(501.9)}, {country:"Czech Republic", |liters|:(301.9)}, {country:"Ireland", |liters|:(201.1)}}
set dataProvider to current application's NSMutableArray's arrayWithArray:aRecList

set pieChart's dataProvider to dataProvider
set pieChart's valueField to "liters"
set pieChart's titleField to "country"


--Make AmChartView
set amChartV to current application's AmChartView's alloc()'s initWithFrame:{origin:{x:0, y:0}, |size|:current application's NSMakeSize(aWidth, aHeight)}
amChartV's setChart:pieChart
set amChartV's bodyBackgroundColor to "#ffffff"
set amChartV's isLoadingIncrementally to false
amChartV's drawChart()

repeat 10 times
set cStat to (amChartV's isReady()) as boolean
if cStat = true then exit repeat
delay 1
end repeat

--Visual Debug
set aWin to my makeWinWithView(amChartV)
my closeWin:aWin


--make Window for debug
on makeWinWithView(aView)


set aScreen to current application's NSScreen's mainScreen()
set aFrame to {{0, 0}, {800, 800}}
set aBacking to current application's NSTitledWindowMask --NSBorderlessWindowMask
set aDefer to current application's NSBackingStoreBuffered


-- Window
set aWin to current application's NSWindow's alloc()
(aWin's initWithContentRect:aFrame styleMask:aBacking backing:aDefer defer:false screen:aScreen)
aWin's setBackgroundColor:(current application's NSColor's whiteColor())


aWin's setTitle:"Visual Debug"
aWin's setDelegate:me
aWin's setDisplaysWhenScreenProfileChanges:true
aWin's setHasShadow:true
aWin's setIgnoresMouseEvents:false
aWin's setLevel:(current application's NSNormalWindowLevel)
aWin's setOpaque:false
aWin's setReleasedWhenClosed:true
aWin's |center|()
aWin's makeKeyAndOrderFront:(me)


-- Set Custom View
aWin's contentView's addSubview:aView


return aWin


end makeWinWithView

--close win
on closeWin:aWindow
delay 5
repeat with n from 10 to 1 by -1
(aWindow's setAlphaValue:n / 10)
delay 0.02
end repeat
aWindow's |close|()
end closeWin:

</Script Editor version>

--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Delete Custom Document Property in Word 2011
      • From: Dave <email@hidden>
    • New Recipient in Outlook 2011
      • From: Dave <email@hidden>
    • Re: What is the essential difference between ASOC on Script Editor and Xcode based ASOC app
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Shell script to get a list of all subfolders inside a folder
  • Next by Date: Re: What is the essential difference between ASOC on Script Editor and Xcode based ASOC app
  • Previous by thread: Clear Google Chrome browsing data
  • Next by thread: Re: What is the essential difference between ASOC on Script Editor and Xcode based ASOC app
  • Index(es):
    • Date
    • Thread