Page 1 of 2
AppleScript issue
Posted: Fri May 19, 2023 9:01 pm
by mcelvain
Re: AppleScript, where “tScript” is my script:
Does SuperCard
get script(do,tScript,AppleScript)
=
LiveCard:
do tScript as “AppleScript”
??
{ doesn’t seem to, but neither platform returns errors}
Re: AppleScript issue
Posted: Fri May 19, 2023 10:01 pm
by dunbarx
It has been a very long time, HC ages ago, that I executed as script as AppleScript.
I tried the LC dictionary example:
Code: Select all
do "result = 1 + 1" as "vbscript"
answer the result
and got at execution error. A simple line of LC code run "as AppleScript" gave the same error.
I am not much help.
Craig
Re: AppleScript issue
Posted: Fri May 19, 2023 10:06 pm
by FourthWorld
@mcelvain: Yes, those two examples should be roughly equivalent. Did the LC script not work?
@dunbarx: Do you have VB Script installed on your machine? Does the same script work outside of LC?
Re: AppleScript issue
Posted: Fri May 19, 2023 10:08 pm
by mcelvain
Thank-you, Craig.
Is it possible for LC to pass Terminal commands ?
Re: AppleScript issue
Posted: Fri May 19, 2023 11:24 pm
by Emily-Elizabeth
Look up "shell" in the dictionary, that will allow you to run terminal commands
Re: AppleScript issue
Posted: Sun May 21, 2023 6:39 am
by mcelvain
no VB Script on this machine, which is a Mac.
Thank-you for recommending beginning with the dictionary "shell" definition/explanation.
One additional question which I should probably post as a new query: How do I enlarge the script editor text which loads in the variable window upon clicking a specific variable ?
This window is a terrific tool, which also stays open through multiple handler calls.
I cannot find a solution for resizing this text in preferences.
Thank-you !
Re: AppleScript issue
Posted: Mon May 22, 2023 3:51 am
by dunbarx
Hi.
The preferences pane offers the textSize right near the top. You will find it.
Interestingly, this did not work:
Code: Select all
set the textsize of fld 1 of stack "revNewScriptEditor" to 18
and I have hacked this stack now and then,
Field 1 is the default field if only one object's script is being examined. If you add others, they are field 2, 3, etc.
I have colored groups of lines in the SE, treating it just like any ordinary stack, which it pretty much is. I do this all the time so I can scroll through an entire script and find my way back to certain regions quickly. I am not sure why the above code does not work. I will check when I get to my office tomorrow, and see why I can change the backColor of, say, line 200 - 300, but not chase the text size here on my laptop.
Craig
Re: AppleScript issue
Posted: Mon May 22, 2023 6:34 pm
by SparkOut
stack "revNewScriptEditor" is probably the template stack, from which each instance of the SE is generated.
It probably needs to be referred to as "revNewScriptEditor 1" (or subsequent index number if you have opened more than one SE instance).
Re: AppleScript issue
Posted: Mon May 22, 2023 9:50 pm
by dunbarx
Sparkout.
I am sure you are correct, as I have always used "revnewScriptEditor 1".
But I got an error trying it, so I lost the "1".
I wonder if I typed "revnewScriptEditor1". I would not put that past me.
Craig
Re: AppleScript issue
Posted: Tue May 23, 2023 3:38 am
by FourthWorld
The script editor may have multiple windows. You could use "the windows" function to find the topmost one beginning with "revScriptEditor", but perhaps easier is a plugin script that triggers on launch to set the values right in the master Script Editor.
Re: AppleScript issue
Posted: Tue May 23, 2023 9:04 am
by richmond62
The script editor may have multiple windows.
Indeed it may . . .
-
-
BUT, I think that this . . .
-
-
Where the
scriptEditor allows 2 views of the same script would be fantastic.
Re: AppleScript issue
Posted: Tue May 23, 2023 10:24 am
by bn
mcelvain wrote: ↑Sun May 21, 2023 6:39 am
One additional question which I should probably post as a new query: How do I enlarge the script editor text which loads in the variable window upon clicking a specific variable ?
This window is a terrific tool, which also stays open through multiple handler calls.
I cannot find a solution for resizing this text in preferences.
If you mean the the window that pops up when in the Debugger you click on a variable then that window is a stack called "revVariableVisualizer 1" with an increasing numbering when invoked repeatedly.
That stack is created on the fly by stack "revSEVariablesPaneBehavior" in handler "private on nodeCreateVisualizationObject" beginning at line 298 in LC 9.6.9.
To change the textSize of the field "Value" of said stack you could add a line (marked --< added)
Code: Select all
private on nodeCreateVisualizationObject pPathToNode
add 1 to sVisualizationObjectCount
local tOldLock
put the lockMessages into tOldLock
lock messages
local tStack
reset the templateStack
set the _ideoverride of the templateStack to true
set the width of templateStack to 270
set the height of templateStack to 250
create invisible stack "revVariableVisualizer " & sVisualizationObjectCount
put the long id of it into tStack
set the behavior of tStack to the long id of stack revIDEScriptEditorBehavior("variable visualizer")
set the cMutable of tStack to true
set the destroyStack of tStack to true
set the destroyWindow of tStack to true
set the title of tStack to "Value : " & friendlyNodeReference(pPathToNode)
revMetadataSet the name of stack tStack, "general", "visualizer", true
-- generate variable visualizer UI
local tOldDefaultStack
put the defaultStack into tOldDefaultStack
set the defaultStack to the short name of tStack
reset the templateButton
set the height of the templateButton to 23
create button "Apply"
reset the templateField
set the vScrollbar of the templateField to true
set the textSize of the templateField to 16 --< added
create field "Value"
-- more code
That will set the textSize of field "Value" to 16
As far as I know there is no way to set a preference for this.
To make it easy I append a stack that patches stack "revSEVariablesPaneBehavior" with the modification.
That patch stack is tested using LC 9.6.9 and it works. Since very little has changed in the debugging part of LC recently it should work at least with the LC 9.x.x series (not tested).
The changes the patch applies are temporary and are gone when you quit LC. You would have to run it again when starting LC.
Kind regards
Bernd
Click on the button e.g. after starting LC
Re: AppleScript issue
Posted: Tue May 23, 2023 2:05 pm
by bn
bn wrote: ↑Tue May 23, 2023 10:24 am
To make it easy I append a stack that patches stack "revSEVariablesPaneBehavior" with the modification.
That patch stack is tested using LC 9.6.9 and it works. Since very little has changed in the debugging part of LC recently it should work at least with the LC 9.x.x series (not tested).
If you want to use above stack in versions of LC <= 9.6.5 you have to open the Script Editor once before applying the patch. Tested as far back as 9.0.0.
Starting LC 9.6.6 you do not have to start the Script Editor first. Tested including LC 10.0.0 DP5.
Kind regards
Bernd
Re: AppleScript issue
Posted: Tue May 23, 2023 3:14 pm
by FourthWorld
Historically, having an easy way to render all script-related text consistently is what the scriptTextFont and scriptTextSize were for, from HyperCard though SuperCard and MetaCard.
https://quality.livecode.com/show_bug.cgi?id=11596
Re: AppleScript issue
Posted: Tue May 23, 2023 5:49 pm
by richmond62
"LiveCode QCC 2013-12-16 12:30:00 EST
Hi Richard,
thank you for logging this report, we are currently reviewing it.
We will update you when the status changes or information in the report is updated.
Kind Regards,"
my emphasis.
About 11 and a half years ago