RS232 and SuperCard and AppleScript

Having trouble using an XCmd or XFcn? Post your questions here.

RS232 and SuperCard and AppleScript

Postby guebeli » Wed Apr 11, 2012 2:25 am

Since many years I was using SuperCard to control several projects trough RS232 connections with Keyspan-Adaptors over an XCMD written by famous Chilton Webb. Now this is no longer possible because of lacking support for PowerPC tools in Lion. I tried several terminal applications like CoolTerm or SerialPort X. They all are controlled by AppleScript which is working fine with some examples provided by the developers and the Get_Script() function. Despite several attempts I could not figure out how to assign some variables (eg. Xmit and Rcvd strings) from AppleScript to SuperCard for further use. If anyone has any hint (maybe examples) or a solution for this ugly transfer problem I would be deeply grateful.


PS to the developers of SuperCard: Why is SuperCard itself not providing some functions() to control these wide spread Keyspan and FTDI Adapters ?? [Serialcontrol] and [dial] were in earlier days working with modem/printer ports ...
User avatar
guebeli
 
Posts: 4
Joined: Tue Apr 10, 2012 7:52 am

Re: RS232 and SuperCard and AppleScript

Postby marksch » Wed Apr 11, 2012 6:34 am

Hi,

You can install Rosetta from your Snow Leopard DVD.

Kind regards,

Mark
We have time for new projects. Go to my homepage to contact me.

Follow me on Facebook https://www.facebook.com/marksch
User avatar
marksch
 
Posts: 79
Joined: Fri Aug 22, 2008 4:51 am

Re: RS232 and SuperCard and AppleScript

Postby Fulgerite » Fri May 04, 2012 7:29 am

I specifically bought SuperCard to develop a control interface for serial stepper motor drives. So there is no way to send & receive serial commands from SC without sending AppleScript commands to an external terminal? What a Kludge. This needs to be solved. SC should include serial communication tools. This is a major setback for me.
Fulgerite
 
Posts: 1
Joined: Fri May 04, 2012 7:23 am

Re: RS232 and SuperCard and AppleScript

Postby Scott » Fri May 04, 2012 10:27 am

guebeli wrote:Despite several attempts I could not figure out how to assign some variables (eg. Xmit and Rcvd strings) from AppleScript to SuperCard for further use. If anyone has any hint (maybe examples) or a solution for this ugly transfer problem I would be deeply grateful.


This shouldn't be ugly. Build a function in SuperCard to handle the data you wish to send from AppleScript and send the params to the function via the evaluate command.

Code: Select all
set theData to X --where X is the data you want to send
set tExp to "CustomFunction(`" & theData & "`)"
tell application "SuperCard 4.7"
   evaluate tExp
end tell


This will call CustomFunction() in the current SuperCard project, passing theData as a parameter.
User avatar
Scott
Site Admin
 
Posts: 1243
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: RS232 and SuperCard and AppleScript

Postby codegreen » Fri May 04, 2012 12:06 pm

Fulgerite wrote:SC should include serial communication tools.

The last Mac with a serial port was discontinued in 1998, so there's not exactly a broad and burning need for native serial I/O SuperTalk functions nowadays -- though FWIW when last I tried it SC4 could still dial the modem in my ancient G4 Powerbook (the last Mac I owned which had one).

That said, I expect updating Chilton's old serial xrtn to Universal would mainly involve just ripping out the layers of cruft needed to access Mach frameworks from CFM code (likely about half an hour's work, no rocket science required). So if somebody wants to track him down and persuade him to cough up the source (which he's usually happy to do if he can find it) I'd be willing to take the pruning shears to it. Of course I've no way to test the result, which may not work quite right out of the gate due to endian issues...

-Mark
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: RS232 and SuperCard and AppleScript

Postby Scott » Thu May 31, 2012 6:24 am

I have contacted Chilton and he was kind enough to send the source of his PPC serial Xrtn. Mark has cleaned it up a bit and recompiled as a universal, but we have no devices to test with.

If you are interested in testing it out I can clean up the example project and post it.

lemmeno
User avatar
Scott
Site Admin
 
Posts: 1243
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: RS232 and SuperCard and AppleScript

Postby guebeli » Thu Jun 14, 2012 7:47 am

Hi Scott
Yeap, that sounds good to me. Of course I will test the new version if you post it. Please let me know.
By the way: In between I found a solution for transfering data from AppleScript to SuperCard via the clipboard and made a SC stack which works pretty fine (still a little bit in the test phase) The stack opens the really nice program CoolTerm (by Roger Meier, http://freeware.the-meiers.org) which has an AppleScript interface. It works not only with the Keyspan adapters but also with some FTDI-chip adapters !

If I have spare time I will also try your example from the post dated may,4th !
Thanks anyway for all the help

Supercard forever !!
User avatar
guebeli
 
Posts: 4
Joined: Tue Apr 10, 2012 7:52 am

Re: RS232 and SuperCard and AppleScript

Postby Scott » Fri Jun 15, 2012 3:45 pm

guebeli wrote:Of course I will test the new version if you post it.


You'll find it at: viewtopic.php?f=16&t=1674
User avatar
Scott
Site Admin
 
Posts: 1243
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: RS232 and SuperCard and AppleScript

Postby guebeli » Thu Jun 21, 2012 1:13 am

Hello Scott
As promised, I tried the new Serial script but it does not work yet. To be a little more concrete: Still hanging on WRITE, nothing is transmitted and with the READ command SuperCard will hang after a couple of seconds (rotating cursor). OPEN and CLOSE is working as expected. I tried on two machines (MacBookPro with SnowLeopard and New MacMini with Lion installed, KeySpan driver 2.6, works with other terminal software without problems). Sorry for the bad news. Maybe you find some time to look over it again.
Thanks anyway
User avatar
guebeli
 
Posts: 4
Joined: Tue Apr 10, 2012 7:52 am

Re: RS232 and SuperCard and AppleScript

Postby codegreen » Thu Jun 21, 2012 6:28 am

I'm not surprised to hear there are some 'teething' issues here -- the source I received was rather gruesome and contained a number of obvious holes and bugs, so I have to suspect it wasn't actually for the final working version.

Is the external returning any kind of error message, or writing anything to the console? Also did you remember to call it with 'start' before attempting to read or write?

Thanks,
-Mark
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm

Re: RS232 and SuperCard and AppleScript

Postby guebeli » Thu Jun 21, 2012 8:03 am

Hi Mark
There is no error message returned, just waiting and then get stuck. Of course I used START before anything else, also tryed to change baudrate, port et cetera. Nothing different in behaviour. As mentioned before, the OPEN and CLOSE just works fine: I have some red/green LEDs as indicators to see if the port is open or not or transfering anything. Used the demo stack for making the tests.
Seems to be a more serious problem ... :(
User avatar
guebeli
 
Posts: 4
Joined: Tue Apr 10, 2012 7:52 am

Re: RS232 and SuperCard and AppleScript

Postby codegreen » Thu Jun 21, 2012 12:12 pm

guebeli wrote:There is no error message returned, just waiting and then get stuck.

And nothing is displayed in the console? If it actually gets to the routine which does the writing, it should log some sort of status message whether it succeeds or fails...

-Mark
codegreen
 
Posts: 1545
Joined: Mon Jul 14, 2008 11:03 pm


Return to Using Externals

Who is online

Users browsing this forum: No registered users and 1 guest

cron