Scripting IDE
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Scripting IDE
HI,
Whenever I open Livecode I'm always spending a minute or two placing my windows.
If I understand correctly I could probably deal with this by creating a simple plugin.
So my questions are:
1. In a script can I get a list of all open stacks?
2. How would I open the Script Editor, Property Inspector, Projector Browser and Message Box via Script
3. Can I move them via script? Also, could I make them 'sticky' (i.e. if I had the message box below the script window, could the message box move automatically if I resize the script window, or is it better to just create a menu called 'Clean Up' and run that when I want my windows organized)
4. Can I script bringing a window to the front.
much appreciated!
Whenever I open Livecode I'm always spending a minute or two placing my windows.
If I understand correctly I could probably deal with this by creating a simple plugin.
So my questions are:
1. In a script can I get a list of all open stacks?
2. How would I open the Script Editor, Property Inspector, Projector Browser and Message Box via Script
3. Can I move them via script? Also, could I make them 'sticky' (i.e. if I had the message box below the script window, could the message box move automatically if I resize the script window, or is it better to just create a menu called 'Clean Up' and run that when I want my windows organized)
4. Can I script bringing a window to the front.
much appreciated!
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Scripting IDE
[1] get the openstacks (read dictionary for variants and details ...)
[2], [3] the scheme is
Other stack names:
You have to script the geometry connection of the rects of these stacks by yourself.
This is a good occasion to read the dictionary. Start with openstacks.
Also look into LC's preferences where you can set the visibility of "LC UI elements" in lists.
Then open the "Application Browser" and you see all the names.
[4] go stack "name"
This brings the window to front within its "layer category". Palettes ('system windows') are still over windows in the 'normal layer'. You have to hide or move the palettes in order to bring an ordinary stack window to front.
[2], [3] the scheme is
Code: Select all
on mouseUp
put "message box" into s
open stack s
-- mostly its better to set loc or topleft
-- (NOT CHANGING width and height) <----------------
set rect of stack s to 100,100,500,500 -- or whatever
end mouseUp
- put "revProjectBrowser" into s
- put "revNewScriptEditor 1" into s --> better: "edit script of me"
- put "revPropertyPalette 1" into s
- put "revApplicationOverview" into s
You have to script the geometry connection of the rects of these stacks by yourself.
This is a good occasion to read the dictionary. Start with openstacks.
Also look into LC's preferences where you can set the visibility of "LC UI elements" in lists.
Then open the "Application Browser" and you see all the names.
[4] go stack "name"
This brings the window to front within its "layer category". Palettes ('system windows') are still over windows in the 'normal layer'. You have to hide or move the palettes in order to bring an ordinary stack window to front.
shiftLock happens
Re: Scripting IDE
Thanks. And yes, I was going to ask where in the dictionary is this but you answer that!
Will try this tomorrow.
Much apreciated.
Will try this tomorrow.
Much apreciated.
Re: Scripting IDE
HI.
On LC 8.1.9 a
trows an error.
What gives? Is it because it is in the plugin ?
On LC 8.1.9 a
Code: Select all
go stack "RevApplicationOverview"
What gives? Is it because it is in the plugin ?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Scripting IDE
We may be able to answer that if we can know what the reported error is.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Scripting IDE
Unfortunately it does not make sense.
The code is:
The error is:
The code is:
Code: Select all
on Preopenstack
set the defaultstack to me
set the itemdelimiter to "/"
--find if to break
put the filename of this stack into _PathMain
delete last item of _PathMain
if item -1 of _PathMain <> "Plugins" and item 3 of _PathMain = "MyUserName" then --only for me and if not in the plugin folder
go stack "RevApplicationOverview"
Breakpoint
end if
---
The error is not trows if I delete the line: go stack "RevApplicationOverview"stack "MyStack": execution error at line 48 (if-then: error in statement), char 1
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Scripting IDE
I'll assume the error is "stack not found". There's a function provided by the IDE for obtaining the path to the IDE Plugins folder. I'm on a phone so I'm unable to look it up right now, but IIRC it's also listed in the v5.x release notes.
With that path you should be able to point to the stack file reliably.
With that path you should be able to point to the stack file reliably.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Scripting IDE
Ok.
Considering that RevProjectBrowser has been renamed RevIDEProjectBrowser (?) and that we are talking of IDE plugin and not "MyLivecode" plugin, and that if you take off the ".rev" part of revapplicationoverview it does not work, and that all this should not be so difficult...
this works (on OSX. For Windows you need a different path):
I wonder when they are going to fix the "revapplicationoverview/ProjectBrowser" odd couple. Specially the Project Browser that I believe needs a complete redraw.
Considering that RevProjectBrowser has been renamed RevIDEProjectBrowser (?) and that we are talking of IDE plugin and not "MyLivecode" plugin, and that if you take off the ".rev" part of revapplicationoverview it does not work, and that all this should not be so difficult...
this works (on OSX. For Windows you need a different path):
Code: Select all
on Preopenstack
put Specialfolderpath("engine") into tPathOverview
set the itemdelimiter to slash
put "tools/Plugins/revapplicationoverview.rev" into last item of tPathOverview
go stack tPathOverview
go stack "RevIDEprojectBrowser"
end preopenstack
Last edited by trevix on Sat Mar 10, 2018 2:01 pm, edited 1 time in total.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: Scripting IDE
Also, let's put a "wait 1 seconds with messages" so that the IDE loads. Otherwise, if you start LC double-clicking on a stack, there is a "merg...something" that will mess things up (if this is your starting stack, off course).
Code: Select all
on Preopenstack
wait 1 seconds with messages
put Specialfolderpath("engine") into tPathOverview
set the itemdelimiter to slash
put "tools/Plugins/revapplicationoverview.rev" into last item of tPathOverview
go stack tPathOverview
go stack "RevIDEprojectBrowser"
end preopenstack
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Scripting IDE
Code: Select all
local tPath
local tFilePath
put revEnvironmentPluginsPath() into tPath
put tPath & slash & "revapplicationoverview.rev" into tFilePath
go stack tFilePath
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Scripting IDE
That is certainly short, sweet, and to the point.
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Scripting IDE
tested also.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Scripting IDE
One minor detail:
opening the project browser or the revapplicationoverview with a "GO" command, make them editable with the pointer tool. And this in not a great idea.
Is there some flag to set?
opening the project browser or the revapplicationoverview with a "GO" command, make them editable with the pointer tool. And this in not a great idea.
Is there some flag to set?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Scripting IDE
use
instead of
Code: Select all
palette stack tFilePath
Code: Select all
go stack tFilePath
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Scripting IDE
Perfect. Thanks you all.
Where do you find things like revEnvironmentPluginsPath()?
Where do you find things like revEnvironmentPluginsPath()?
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>