Studio API

Editor for AutoHotkey written completely in AutoHotkey.

Moderator: maestrith

User avatar
derz00
Posts: 487
Joined: 02 Feb 2016, 17:54
GitHub: derz00
Location: Middle of the round cube

Studio API

03 Oct 2017, 13:45

Hi. Cap'n Odin gave me this code.

Code: [Select all] [Download] GeSHi © Codebox Plus

x:=Studio()
File:=x.Current(2).file
SplitPath,File,Filename,Dir,exte


I am intrigued with working with Studio through this interface. I was wondering how you might do further things with this. Such as Saving the current file.

I found some things in your great wiki, but this it does not seem inclusive. Also, a link to further examples is broke. http://files.maestrith.com/AHK-Studio/Plugins
try it and see
...
User avatar
maestrith
Posts: 726
Joined: 16 Oct 2013, 13:52

Re: Studio API

06 Oct 2017, 20:33

Sorry but I lost my host there and have not updated been able to update anything. Saving of files can be done using x.Save() using your example but it will save all of the files. Studio, by default, saves everything when saving so that it doesn't lose anything.
AHK Studio OSD GUI Creator
Donations
Discord
All code is done on a Windows 10 PC Running x64 and AutoHotkey x32
User avatar
derz00
Posts: 487
Joined: 02 Feb 2016, 17:54
GitHub: derz00
Location: Middle of the round cube

Re: Studio API

06 Oct 2017, 20:42

Do you suppose there will ever be issues with saving all the files? How does your built in "Run" function do it? Can I do something similar?
EDIT: I'm trying to study the Plugin Class in the code.
Last edited by derz00 on 06 Oct 2017, 20:43, edited 1 time in total.
try it and see
...
User avatar
RUNIE
Posts: 279
Joined: 03 May 2014, 14:50
GitHub: Run1e

Re: Studio API

06 Oct 2017, 20:42

A complete list of callable methods is here: (NOTE: since maestrith updates the whole file at once the location of this class might change, it's the PluginClass)
https://github.com/maestrith/AHK-Studio ... .ahk#L1958
User avatar
maestrith
Posts: 726
Joined: 16 Oct 2013, 13:52

Re: Studio API

06 Oct 2017, 20:44

So

Code: [Select all] [Download] GeSHi © Codebox Plus

Text:=x.Publish(1)
would store the contents of the Project into the variable Text

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

AHK Studio OSD GUI Creator
Donations
Discord
All code is done on a Windows 10 PC Running x64 and AutoHotkey x32
User avatar
maestrith
Posts: 726
Joined: 16 Oct 2013, 13:52

Re: Studio API

06 Oct 2017, 21:47

derz00 wrote:Do you suppose there will ever be issues with saving all the files? How does your built in "Run" function do it? Can I do something similar?
EDIT: I'm trying to study the Plugin Class in the code.

Run uses the Save() function to save anything that is unsaved so using the plugins x.Save() just calls the Save() function.
AHK Studio OSD GUI Creator
Donations
Discord
All code is done on a Windows 10 PC Running x64 and AutoHotkey x32
User avatar
derz00
Posts: 487
Joined: 02 Feb 2016, 17:54
GitHub: derz00
Location: Middle of the round cube

Re: Studio API

10 Oct 2017, 17:45

hi maestrith

I wrote a plugin for Studio, to look at the extension and run with the appropriate AHK version (v1.1 vs v2). This works, except for when a v1.1 script contains #include [file-name-in-A_ScriptDir]. There is then an AHK error message: Include file cannot be opened. When I run the script with the built in Run command, it works. Or if I convert the script and its extension to v2, it works. Would you have any idea what is causing the problem? Why the difference?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



cheers :wave:
try it and see
...
User avatar
Delta Pythagorean
Posts: 414
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Equestria

Re: Studio API

10 Oct 2017, 20:02

derz00 wrote:hi maestrith

I wrote a plugin for Studio, to look at the extension and run with the appropriate AHK version (v1.1 vs v2). This works, except for when a v1.1 script contains #include [file-name-in-A_ScriptDir]. There is then an AHK error message: Include file cannot be opened. When I run the script with the built in Run command, it works. Or if I convert the script and its extension to v2, it works. Would you have any idea what is causing the problem? Why the difference?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



cheers :wave:


I'd Suggest to change the absolute path to A_AHKPath to allow most users who have a portable installation of AHK, to allow usage for this plugin. So...

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
derz00
Posts: 487
Joined: 02 Feb 2016, 17:54
GitHub: derz00
Location: Middle of the round cube

Re: Studio API

11 Oct 2017, 05:34

Hi Delta, That won't work. xD Should come up with a way to do that though... Kinda separate from my current issue
try it and see
...
User avatar
maestrith
Posts: 726
Joined: 16 Oct 2013, 13:52

Re: Studio API

11 Oct 2017, 06:17

Just food for thought, my install of AHK is in D:\Program Files
You might want to use something like

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Also is AutoHotkey-v2 the default install directory for V2?
and is .ahk2 the file extension for V2 files?
AHK Studio OSD GUI Creator
Donations
Discord
All code is done on a Windows 10 PC Running x64 and AutoHotkey x32
User avatar
derz00
Posts: 487
Joined: 02 Feb 2016, 17:54
GitHub: derz00
Location: Middle of the round cube

Re: Studio API

11 Oct 2017, 07:13

No. AHK v2 does not have an installer, so there is no default. Both the directory and the extension are made up by myself. There has been discussion about having an official extension for AHK v2, but there is no such thing yet.

Any idea what about my plugin is different from the built in `Run` that throws the error with the #include?
try it and see
...
User avatar
maestrith
Posts: 726
Joined: 16 Oct 2013, 13:52

Re: Studio API

11 Oct 2017, 08:42

SplitPath,File,Filename,Dir,exte
Run,"C:\Program Files (x86)\AutoHotkey-v2\AutoHotkeyU64.exe" "%file%",%Dir% ;<-----The ,%Dir% sets the working directory
AHK Studio OSD GUI Creator
Donations
Discord
All code is done on a Windows 10 PC Running x64 and AutoHotkey x32

Return to “AHK Studio”

Who is online

Users browsing this forum: No registered users and 3 guests