SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Q: Open files in existing editor
Goto page 1, 2  Next
 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Q: Open files in existing editor
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Q: Open files in existing editor Reply with quote
Is there a way to open files in existing SQL Editor? I mean directly from the file manager, not by dropping the file on SQL Editor, or from a file open dialog opened by SQL Editor itself. Simply assigning SQL Editor to .sql filetype opens a new instance of the editor for each file.
Wed Dec 21, 2016 3:13 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
There isn't?
Sun Mar 19, 2017 9:28 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
Turns out that is possible.

In SqlEditor.ini change

[SyntEditMain]
...
SQLEditorInstance.Active=True
Mon Mar 20, 2017 10:54 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
That's great. I'll try it ASAP, thank you very much.
Mon Mar 20, 2017 11:13 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
It works. Note that you have to edit SqlEditor.ini with SqlEditor closed else its contents will be overwritten the next time you close the editor which was open at the time the changes were made, and that could set SQLEditorInstance.Active back to False.
Wed Mar 29, 2017 7:30 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
What is the strategy of picking the target when there are multiple instances active? I had a theory that it opens it in the instance that was started last but I have no solid evidence on that. When using multiple instances on multiple virtual desktops, triggering this feature can cause quite a mess, by either moving the instances from their virtual desktop to the current virtual desktop or by making their desktop the current/active one.
Thu Mar 31, 2022 3:23 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
Good question. My common sense is telling me that "active" means the one with an input focus. What else can be classified as "active"? But I'm afraid that's just a bad word choice on the part of developers. Internally Windows Explorer needs to send DDE request to the application associated with the file type, and ask if it can start a new conversation in order to receive file detaisl by DDE. But how does Windows Explorer know which one to send it too if there are multiple application instances. I believe it's either the very first one or very last one opened that registered itself as a target for such conversations.
Thu Mar 31, 2022 9:42 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
My thoughts exactly. Would you mind entering a feature enhancement request for this one on my behalf, please?
Thu Mar 31, 2022 10:49 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
I think this is a generic issue outside of the SQL Editor. It's Windows Explorer choosing which application instance to send the request too.

On a related note, I just tested it with 12.1, and on my test system a new instance is always started for an open file. Something changed in that version, I don't know what. I sent a request for more details.
Thu Mar 31, 2022 12:31 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
I'm still checking with the team. But what I've found so far, I was totally wrong, and I have to apologize for misleading you. In 12.x it's not using standard DDE method for Windows Explorer to communicate with with editor, it's doing something proprietary for inter-process communications, which I still don't fully understand. Please give me more time to learn about what's going on there.
Fri Apr 01, 2022 9:11 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
In 12.x it's always the first instance unless it's busy and not responding to interprocess requests.
It's not using DDE internally, it's using a different kind of interprocess communication.
Mon Apr 04, 2022 10:40 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
I see. That only works properly when you have a single instance or it is the first one you want to send the file to. I assume that happens most of the time for most users but usually not in my case, I rarely have less than three instances open simultaneously.

Anyway, thank you very much for the info. I'll try to create an AutoHotkey script that I'll pass the file name to instead of passing it to SQL Editor and make that script handle the rest (make SE active, open dialogs, select file(s), etc). AutoHotkey can reliably determine which instance is the active one. By active I mean which one was the last used, it's certainly not "active" active when being addressed from another application that has the focus/foreground.
Tue Apr 05, 2022 10:21 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
You can use drag-and-drop to open it in the instance you want. Drag-and-drop is yet different mechanism.

Would that work?
Tue Apr 05, 2022 11:12 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
No can do. The reason I was so happy with this feature is that I was able to make SE directly open the file from another editor, bypassing the file manager completely, thus removing the manual step of having to find, select and drag-and-drop the file, which was both slow and error-prone. I only tested it from the file manager when I noticed it opens a new SE instance for each file to see if it makes any difference.
Wed Apr 06, 2022 6:47 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Reply with quote
Have you had a chance to try that in 12.1.277?

It may open a new instance if it finds the first opened busy with something and not responding within several seconds to the file handling request
Wed Apr 06, 2022 8:19 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.