laudmusic Posted May 23, 2004 Posted May 23, 2004 I've had amazing success using Applescript to send, receive and pass information to and from FileMaker in version 6 (and 7). I have a solution that I wish to create runtimes using Dev 6 (and eventually 7) that use Applescript in the same way. Basically I wish to create a protable version of my solution. I am having strange and unstable results using the same exact things when my solutioin is coverted to a runtime. Sometimes the Applescript app (script saved as and app and or from scriptmaker) succeeds in passing info to FM runtime but most others my runtime crashes and the applescript displays and error of connection lost. I figure this may have to do with special considerations when doing this using a runtime FM solution but I cannot find ANYTHING regarding this. Thoughts?: HELP?: Thanks to anyone with a clue. Michael
Wim Decorte Posted May 27, 2004 Posted May 27, 2004 Not sure about AppleScript, but as a rule runtimes have no external API support. On Windows you can't use the FM ActiveX controls so I assume you can't touch runtimes through AS.
CobaltSky Posted May 28, 2004 Posted May 28, 2004 Wim Decorte said: ...as a rule runtimes have no external API support... Hi Wim, Not sure how you're defining terms such as 'external' and 'API' here, but it is worth noting that runtimes do include full support for the use of external functions via the plug-in API. Meanwhile, Michael, I suspect that your problems may relate to the translation of your AppleScript syntax between applications. Bearing in mind that the runtime is a separate application in its own right, the AS expressions will all need to be re-pointed. So "tell application FileMaker..." and any other expresions like it are going to have to become "tell application X..." where X is the name you have given to your runtime executable. Similarly all references to files will need to be updated to reflect the new filenames and/or extensions of the files after binding. There is no surer way to generate errors than to have AppleScript instruct the runtime application to write or read to one of the original (pre-binding) database files. HTH
laudmusic Posted May 29, 2004 Author Posted May 29, 2004 This I did take into account. Everything is pointing to the name of the runtime not FileMaker. For example here's one thing that is happening: Created a runtime that DOES NOT open in KIOSK mode. When I use and Applescript to launch this runtime, call it 'WCM Song Client', from a launcher script or a large script that I trigger within iTunes, it the runtime opens in Kiosk modes. Here's my script..... property Selected_Array {} property theTempPlaylist "WCM Song Temp Playlist" try tell application "iTunes" set Selected_Array to (location of selection) if (exists of playlist theTempPlaylist) = false then make playlist with properties {name:theTempPlaylist} end if set front window's view to playlist theTempPlaylist add Selected_Array to playlist theTempPlaylist end tell tell application "WCM Song Client" activate "WCM Song Data.fp5" (***this line is tricky...see below) do script "ImportCurrentPlaylist" end tell on error display dialog "You must have tracks selected to import" buttons "Ok" default button "Ok" tell application "iTunes" delete playlist theTempPlaylist end tell end try *** Sometime when activating the runtime alone it brings up the file, sometimes not, so I've been experimenting with opening the data file in the script. THat seems to have more predictable effects. Another example is where I have an Applescript tranfering song data from iTunes to 'WCM Song Client'. Here's the script (this is the applescript and not the FM script steps the preceed on follow it, those work fine independently): property FM_NAME : "" property FM_ARTIST : "" property FM_COMPOSER : "" property FM_ALBUM : "" property FM_GENRE : "" property FM_TRACKNO : "" property FM_LOCATION : "" property FM_TIME : "" property FM_PLAYLIST : "" property FM_TRACK : "" property FM_TRACKTOTAL : "" tell application "iTunes" set thePlaylist to front window's view set FM_TRACKTOTAL to count tracks of thePlaylist set FM_PLAYLIST to name of thePlaylist repeat with i from 1 to FM_TRACKTOTAL set FM_NAME to name of track i of thePlaylist set FM_ARTIST to artist of track i of thePlaylist set FM_COMPOSER to composer of track i of thePlaylist set FM_ALBUM to album of track i of thePlaylist set FM_GENRE to genre of track i of thePlaylist set FM_TIME to time of track i of thePlaylist set FM_TRACKNO to track number of track i of thePlaylist set FM_LOCATION to location of track i of thePlaylist as string tell application "WCM Song Client" create new record set cell "Name" of last record to FM_NAME set cell "Playlist" of last record to FM_PLAYLIST set cell "Composer" of last record to FM_COMPOSER set cell "TrackTotal" of last record to FM_TRACKTOTAL set cell "Artist" of last record to FM_ARTIST set cell "Album" of last record to FM_ALBUM set cell "Genre" of last record to FM_GENRE set cell "Time" of last record to FM_TIME set cell "Track_No" of last record to FM_TRACKNO set cell "Location" of last record to FM_LOCATION set cell "Name_Find" of current record to "" set cell "Artist_Find" of current record to "" set cell "Composer_Find" of current record to "" set cell "Album_Find" of current record to "" set cell "Playlist_Find" of current record to "" set cell "Lyrics_Find" of current record to "" go to last record end tell end repeat end tell ....I know I reference my funtime in the middle in a Tell statement. I need to since it won't know to talk to my runtime. Keep in mind, when not in runtime mode, these scripts NEVER, EVER fail or crash. I've been running theses for 9 months. Now when converted to a runtime it fails or crashes the runtime. Thoughts?:: Thanks, Michae
laudmusic Posted May 29, 2004 Author Posted May 29, 2004 Here's what's happening. Everything is pointing to the name of the runtime not FileMaker. For example here's one thing that is happening: Created a runtime that DOES NOT open in KIOSK mode. When I use and Applescript to launch this runtime, call it 'WCM Song Client', from a launcher script or a large script that I trigger within iTunes, it the runtime opens in Kiosk modes. Here's my script..... property Selected_Array {} property theTempPlaylist "WCM Song Temp Playlist" try tell application "iTunes" set Selected_Array to (location of selection) if (exists of playlist theTempPlaylist) = false then make playlist with properties {name:theTempPlaylist} end if set front window's view to playlist theTempPlaylist add Selected_Array to playlist theTempPlaylist end tell tell application "WCM Song Client" activate "WCM Song Data.fp5" (***this line is tricky...see below) do script "ImportCurrentPlaylist" end tell on error display dialog "You must have tracks selected to import" buttons "Ok" default button "Ok" tell application "iTunes" delete playlist theTempPlaylist end tell end try *** Sometime when activating the runtime alone it brings up the file, sometimes not, so I've been experimenting with opening the data file in the script. THat seems to have more predictable effects. Another example is where I have an Applescript tranfering song data from iTunes to 'WCM Song Client'. Here's the script (this is the applescript and not the FM script steps the preceed on follow it, those work fine independently): property FM_NAME : "" property FM_ARTIST : "" property FM_COMPOSER : "" property FM_ALBUM : "" property FM_GENRE : "" property FM_TRACKNO : "" property FM_LOCATION : "" property FM_TIME : "" property FM_PLAYLIST : "" property FM_TRACK : "" property FM_TRACKTOTAL : "" tell application "iTunes" set thePlaylist to front window's view set FM_TRACKTOTAL to count tracks of thePlaylist set FM_PLAYLIST to name of thePlaylist repeat with i from 1 to FM_TRACKTOTAL set FM_NAME to name of track i of thePlaylist set FM_ARTIST to artist of track i of thePlaylist set FM_COMPOSER to composer of track i of thePlaylist set FM_ALBUM to album of track i of thePlaylist set FM_GENRE to genre of track i of thePlaylist set FM_TIME to time of track i of thePlaylist set FM_TRACKNO to track number of track i of thePlaylist set FM_LOCATION to location of track i of thePlaylist as string tell application "WCM Song Client" create new record set cell "Name" of last record to FM_NAME set cell "Playlist" of last record to FM_PLAYLIST set cell "Composer" of last record to FM_COMPOSER set cell "TrackTotal" of last record to FM_TRACKTOTAL set cell "Artist" of last record to FM_ARTIST set cell "Album" of last record to FM_ALBUM set cell "Genre" of last record to FM_GENRE set cell "Time" of last record to FM_TIME set cell "Track_No" of last record to FM_TRACKNO set cell "Location" of last record to FM_LOCATION set cell "Name_Find" of current record to "" set cell "Artist_Find" of current record to "" set cell "Composer_Find" of current record to "" set cell "Album_Find" of current record to "" set cell "Playlist_Find" of current record to "" set cell "Lyrics_Find" of current record to "" go to last record end tell end repeat end tell ....I know I reference my funtime in the middle in a Tell statement. I need to since it won't know to talk to my runtime. Keep in mind, when not in runtime mode, these scripts NEVER, EVER fail or crash. I've been running theses for 9 months. Now when converted to a runtime it fails or crashes the runtime. Thoughts?:: Thanks, Michael --------------------- Michael C. Lau Manager Creative Music Solutions Strategic Marketing/Catalog Development Warner/Chappell Music
bruceR Posted May 29, 2004 Posted May 29, 2004 Like I said, you do NOT need to use ANY tell statement to reference your runtime. You do need to revise your script, and it looks like you haven't learned how to use handlers yet. Time to study up on applescript. Abbreviated version just to indicate the idea: tell app "iTunes" repeat -- do a buncha stuff that gets your data set newData to {FM_NAME , FM_ARTIST , FM_COMPOSER , FM_ALBUM , FM_GENRE , FM_TRACKNO , FM_LOCATION , FM_TIME , FM_PLAYLIST , FM_TRACK , FM_TRACKTOTAL } my MakeRecord( newData) end repeat end tell on makeRecord( theData) create new record with data theData -- requires you to be on a layout with fields in the -- data order end makeRecord
laudmusic Posted May 29, 2004 Author Posted May 29, 2004 Thanks. It makes sense. I do know how to use handlers but since I don't script that often, I forget about them. Go figure. I will follow the methodology you set forth. It seems to make sense. Any thoughts about why the runtime opens in Kiosk mode when launched from an applescript? Thanks, m
bruceR Posted May 30, 2004 Posted May 30, 2004 Opening in kiosk mode has to do with the privileges associated with the password. But - launched from what applescript, I thought all this was going to happen in the runtime?
laudmusic Posted May 30, 2004 Author Posted May 30, 2004 No, the idea is to have everything start from within iTunes.. So that's why my initial script tells iTunes to do something then run a script in FM. So that
bruceR Posted May 30, 2004 Posted May 30, 2004 Since you must have specified kiosk mode when making the runtime, when is the runtime supposed to be in kiosk mode and when is it not supposed to be in kiosk mode? It's still a matter of the passwords you set up. Runtimes don't start in kiosk mode by themselves.
laudmusic Posted May 31, 2004 Author Posted May 31, 2004 I'll check it out. But when I make the runtime, I do not have Kiosk mode turned on. When I have no passwords set it still does it. I will explore more into this and triple check.
Recommended Posts
This topic is 7480 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now