doAsMessage(expression) expression text limit

14 views
Skip to first unread message

PhotoGraphex

unread,
Aug 9, 2022, 8:50:56 PM8/9/22
to SuperCard Discussion
Is it possible that the doAsMessage(expression) function has a text limit of 256 characters for the length of the expression?

After numerous tests, it seems that I am getting an error 2 for "Can't understand arguments." every times the expression is over 256 characters!

When I paste the same text string into the message box it does perform normally!

Could it be something else?
Is there a workaround? 
Can I send a return keystroke to the message box? Not elegant, but it would work!

Regards,

MARK LUCAS

unread,
Aug 10, 2022, 11:06:55 AM8/10/22
to via SuperCard Discussion
Hi André,

Yes it appears that when the maximum message length in the rest of the interpreter was increased in SC 4.7 this function was overlooked, and until now nobody noticed (or at least nobody reported it).

IIRC you can't explicitly send messages or keystrokes directly to the msg box via script, but it should automatically receive typed returns if there is no open field. So I suppose for now you could indeed use it (however inelegantly) to sidestep this limitation if you're willing to jump through a few hoops:

on mouseUp
  local oldChunk = selectedChunk(), oldMsg = msg, oldVis = vis of msg
  if oldChunk empty then
    lock messages
    select empty
    unlock messages
  end if
  put merge("say `This oughta do it!`")
  type return
  if oldChunk empty then
    lock messages
    do "select " & oldChunk
    unlock messages
  end if
  put oldMsg
  set vis of msg to oldVis
end mouseUp

-Mark
Reply all
Reply to author
Forward
0 new messages