Using POM for single instance of an application?
-
blobby
- Posts: 19
- Joined: 06 May 2011 16:38
Using POM for single instance of an application?
I have setup a POM entry with:
*.sql>C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe
to launch MS SQL Server Management Studio when doule-clicking on a *.sql file. It works, but creates a new instance of ssms every time. This does not happen in normal Explorer.
Is there any way to make XY use the current instance of an application if there is one?
*.sql>C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe
to launch MS SQL Server Management Studio when doule-clicking on a *.sql file. It works, but creates a new instance of ssms every time. This does not happen in normal Explorer.
Is there any way to make XY use the current instance of an application if there is one?
Thanks
Rick
Rick
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Using POM for single instance of an application?
How does the registry entry for sql files look like?
One of my scripts helped you out? Please donate via Paypal
-
blobby
- Posts: 19
- Joined: 06 May 2011 16:38
Re: Using POM for single instance of an application?
The registry has:
"C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe" "%1" /dde
"C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\ssms.exe" "%1" /dde
Thanks
Rick
Rick
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Using POM for single instance of an application?
The /dde (dynamic data exchange) is the reason why this works with Windows Explorer. You would have to write a helper application (e.g. in AutoHotkey) that either uses dde or "just" automates MS SQL Server Management Studio by sending the necessary keystrokes to the running instance to open the current selected file.
One of my scripts helped you out? Please donate via Paypal
-
blobby
- Posts: 19
- Joined: 06 May 2011 16:38
Re: Using POM for single instance of an application?
Thanks.highend wrote:The /dde (dynamic data exchange) is the reason why this works with Windows Explorer. You would have to write a helper application (e.g. in AutoHotkey) that either uses dde or "just" automates MS SQL Server Management Studio by sending the necessary keystrokes to the running instance to open the current selected file.
I am not familiar with helper applications. I am a coder, so I can write scripts.
Could you just point me in the right direction? The XY help has no entries for "helper application" or AutoHotKey.
Thanks
Rick
Rick
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Using POM for single instance of an application?
This would be such a script (written in AutoHotkey):
Compile it with the AutoHotkey compiler, put the .exe e.g. into D:\Test (or wherever you want) and then your entry for the PFA has to look like this:
With all these quotation marks^^
First doubleclick on a .sql file: Open ssms.exe with that file
Following clicks will reuse the existing window...
Code: Select all
#SingleInstance force
SetTitleMatchMode, 2
SendMode Input
mssmsTitle := "Microsoft SQL Server Management Studio" ; Part of the title name to identify the application
ssmsPath := "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" ; Path to the application
IfWinNotExist, %mssmsTitle%
{
Run, %ssmsPath% "%1%"
}
else
{
WinActivate, %mssmsTitle%
SendInput ^o
WinWaitActive, ahk_class #32770
SendInput {Raw}%1%
;Sleep, 250
SendInput {Enter}
}
Code: Select all
*.sql>::run """D:\Test\<name of the compiled exe>.exe"" ""<pfaitem>""";First doubleclick on a .sql file: Open ssms.exe with that file
Following clicks will reuse the existing window...
One of my scripts helped you out? Please donate via Paypal
-
blobby
- Posts: 19
- Joined: 06 May 2011 16:38
Re: Using POM for single instance of an application?
highend wrote:This would be such a script (written in AutoHotkey):
Compile it with the AutoHotkey compiler, put the .exe e.g. into D:\Test (or wherever you want) and then your entry for the PFA has to look like this:Code: Select all
#SingleInstance force SetTitleMatchMode, 2 SendMode Input mssmsTitle := "Microsoft SQL Server Management Studio" ; Part of the title name to identify the application ssmsPath := "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" ; Path to the application IfWinNotExist, %mssmsTitle% { Run, %ssmsPath% "%1%" } else { WinActivate, %mssmsTitle% SendInput ^o WinWaitActive, ahk_class #32770 SendInput {Raw}%1% ;Sleep, 250 SendInput {Enter} }With all these quotation marks^^Code: Select all
*.sql>::run """D:\Test\<name of the compiled exe>.exe"" ""<pfaitem>""";
First doubleclick on a .sql file: Open ssms.exe with that file
Following clicks will reuse the existing window...
Mmmmmm. Got it half working. It uses the current instance, but I can't seem to get it to use the passed file.
My XY code is
Code: Select all
*.sql>::run """F:\Rix\SQL stuff\Utils\exessms.exe"" ""<curitem>""";
Thanks
Rick
Rick
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Using POM for single instance of an application?
<pfaitem> not <curitem>. Apart from that: Show a screenshot...
One of my scripts helped you out? Please donate via Paypal
-
blobby
- Posts: 19
- Joined: 06 May 2011 16:38
Re: Using POM for single instance of an application?
I did try <pfaitem> but it gave the same result. I cannot find any mention of pfaitem in the XY help.highend wrote:<pfaitem> not <curitem>. Apart from that: Show a screenshot...
This is my XY PFA settings: and this is what happens when I double-click and .sql file: It's obviously not getting the passed file.
To see the attached files, you need to log into the forum.
Thanks
Rick
Rick
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Using POM for single instance of an application?
You're not on Windows 7, right?
Execute AU3_Spy.exe from your AutoHotkey folder, make that open file requester window from your SQL Management Studio the active window and then capture a screenshot. I just need the content of the AHK spy window.
My guess:
The ahk_class is not #32770
Btw, <pfaitem> is under Advanced Topics - Variables ->
XYplorer Native Variables --> Scripting with Portable File Associations only
---> <pfaitem> the item (full path) the opening application or script in a Portable File
Execute AU3_Spy.exe from your AutoHotkey folder, make that open file requester window from your SQL Management Studio the active window and then capture a screenshot. I just need the content of the AHK spy window.
My guess:
The ahk_class is not #32770
Btw, <pfaitem> is under Advanced Topics - Variables ->
XYplorer Native Variables --> Scripting with Portable File Associations only
---> <pfaitem> the item (full path) the opening application or script in a Portable File
One of my scripts helped you out? Please donate via Paypal
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: Using POM for single instance of an application?
blobby wrote: I cannot find any mention of pfaitem in the XY help.
Code: Select all
Change Log
v12.30.0102 - 2013-04-13 21:27
+ New temporary variable <pfaitem>, resolves to the item (full path)
the opening application or script in a PFA (Portable File
Association) is associated with. In such a script called via PFA
<pfaitem> can be used. After the PFA is processed the variable is
reset to nothing.-
blobby
- Posts: 19
- Joined: 06 May 2011 16:38
Re: Using POM for single instance of an application?
Wrong. I am on Windows 7(64 bit). Does that make a difference?highend wrote:You're not on Windows 7, right?
I cannot find this in my help file. I am using version 12.30.0200. So it should be there?highend wrote: Btw, <pfaitem> is under Advanced Topics - Variables ->
XYplorer Native Variables --> Scripting with Portable File Associations only
---> <pfaitem> the item (full path) the opening application or script in a Portable File
Thanks
Rick
Rick
-
blobby
- Posts: 19
- Joined: 06 May 2011 16:38
Re: Using POM for single instance of an application?
Stefan wrote:blobby wrote: I cannot find any mention of pfaitem in the XY help.
Hint: this var is relatively new, so be sure to have a recent XYplorer version.
Thanks for the tip, but I am using 12.30.0200 and it is definitely not in the help file.Code: Select all
Change Log v12.30.0102 - 2013-04-13 21:27 + New temporary variable <pfaitem>, resolves to the item (full path) the opening application or script in a PFA (Portable File Association) is associated with. In such a script called via PFA <pfaitem> can be used. After the PFA is processed the variable is reset to nothing.
If it's not in the help file, does that indicate that it's not implemented in my version?
Thanks
Rick
Rick
-
highend
- Posts: 14955
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Using POM for single instance of an application?
Regardless if you have it or not (why don't you just update to the latest beta?), even <curitem> would work (but not if you'd try it with multiple selected entries).
What about the screenshot of the AU3_Spy.exe entries?
What about the screenshot of the AU3_Spy.exe entries?
One of my scripts helped you out? Please donate via Paypal
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: Using POM for single instance of an application?
No. Writing help is just boring and so the help is sometimes updated a few days later then releasing the code itself.blobby wrote:Thanks for the tip, but I am using 12.30.0200 and it is definitely not in the help file.
If it's not in the help file, does that indicate that it's not implemented in my version?
XYplorer Beta Club