Run scripts from an external program?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Filehero
Posts: 2645
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Run scripts from an external program?

Post by Filehero »

admin wrote:If I survive this, ...
Stop scaring me!

<ot>Once you finished this 200k-line challenge, you may want to drop some - or more - words on your approach to that tremendous refactoring along the release news. I'm very, very curios :wink: </ot>


Keep on going,
Filehero

admin
Site Admin
Posts: 60604
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Run scripts from an external program?

Post by admin »

Filehero wrote:
admin wrote:If I survive this, ...
Stop scaring me!

<ot>Once you finished this 200k-line challenge, you may want to drop some - or more - words on your approach to that tremendous refactoring along the release news. I'm very, very curios :wink: </ot>
When you see the LNG template you will get it.

Something like this:

Code: Select all

1234="<#> source <item;~s> in <$p>::::<#> <Quellobjekt;~e> in <$p>"

Code: Select all

1234="<#> source <item;~s> in <$p>====<#> <Quellobjekt;~e> in <$p>"
Not sure yet about the best separator (::::, ====) between English and the translation. Should be unique and visually nice and easily producible on any keyboard. (I found that my forst idea ">>" does not work so good with my variables <$v>.)

Filehero
Posts: 2645
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Run scripts from an external program?

Post by Filehero »

Code: Select all

1234="<#> source <item;~s> in <$p>++++<#> <Quellobjekt;~e> in <$p>"

Code: Select all

1234="<#> source <item;~s> in <$p>****<#> <Quellobjekt;~e> in <$p>"
I prefer the num pad for tedious stuff.

Back to <ot>: I rather meant
- how did you assure all hard-coded locations are hit?
- what basic design changes to the core classes/framework you finally have decided to apply?
- what regressions do you use during transformation? I mean - especially with the SC engine in mind - how do you assure harmful functional side-effects are excluded by feasible means?

To much OT I'm afraid....back to preparation for Win 8.


Greetz,
Filehero

admin
Site Admin
Posts: 60604
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Run scripts from an external program?

Post by admin »

I give you the phases:

1. prepare the source code for machine processing (many weeks, no fun)
2. write source code processing routine (3 hours, fun)
3. run source code processing routine (3 seconds, big fun)

It has the nice twist that XY will harvest English language strings from its own source code files. :)

Filehero
Posts: 2645
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Run scripts from an external program?

Post by Filehero »

admin wrote:It has the nice twist that XY will harvest English language strings from its own source code files. :)
Damn, that's sustainable IT in practice! :mrgreen:

I will come back to 1. some day (that's what I'm after, I like this kind of puzzles... :wink: ).


Thanks,
Filehero

printedtopsntees
Posts: 32
Joined: 02 Oct 2012 00:20

Re: Run scripts from an external program?

Post by printedtopsntees »

kodyman wrote:
Channing wrote:
highend wrote:So we'll see a working Listary integration (in XYplorer) soon?
Yes, very soon :D
YEA!!! :biggrin: :appl:

Listary is an incredibly useful add on and everyone I download it for loves it, so many thanks Channing.

I use the free version at the moment as this does everything I want because the free version is so capable and the "extras" in the paid for version are not compelling, but if a version linked in to XYP was paid for I'd get it in a flash.

At the moment the difference between the Free and Paid for versions is too small and the extras are very specific. So, Channing, give us a good reason to upgrade as I think it's important to support the small software developers.

admin
Site Admin
Posts: 60604
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Run scripts from an external program?

Post by admin »

Hi Channing,

the next BETA will have this:

Code: Select all

    + DEVELOPERS: Now you can run an XYplorer script from an external 
      program using the WM_COPYDATA command with XYplorer's hWnd. 
      - cds.dwData: 4194305 (0x00400001)
      - cds.lpData: The syntax is identical to the one of the command 
        line switch /script=<script resource>, so you can either pass 
        the path to a script file (commonly called *.xys), or pass the 
        script directly (must be preceded by ::).
      Note that this feature is not available in the Home Edition 
      (because it does not support scripting).
When? Well, I still need a couple of days to finish that language thing.

There is a small issue yet: What if the user has enabled "Step Mode" (showing a sort of debug window for triggering a script manually command by command)? Hmmm...

Don

PeterH
Posts: 2785
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Run scripts from an external program?

Post by PeterH »

admin wrote:There is a small issue yet: What if the user has enabled "Step Mode" (showing a sort of debug window for triggering a script manually command by command)? Hmmm...

Don
From my point of view the ability to debug should be here, too.

But maybe it could be possible, even in Step Mode, to check the script for an Unstep as very first command, and then execute it even if Step Mode is active?

But I think whatever you will do will have some disadvantage in special situations.
Win11 Pro 223H2 Gerrman

Marco
Posts: 2347
Joined: 27 Jun 2011 15:20

Re: Run scripts from an external program?

Post by Marco »

I would think of an option like "Allow external programs to run unstepped scripts", with an explanation in the Help like "This option overrides Scripting - Step Mode for said scripts".
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: Run scripts from an external program?

Post by eil »

Marco wrote:I would think of an option like "Allow external programs to run unstepped scripts", with an explanation in the Help like "This option overrides Scripting - Step Mode for said scripts".
good solution. :)
Win 7 SP1 x64 100% 1366x768

Channing
Posts: 12
Joined: 25 Oct 2012 14:13

Re: Run scripts from an external program?

Post by Channing »

Hello Don,

Thank you for the update!
admin wrote:There is a small issue yet: What if the user has enabled "Step Mode" (showing a sort of debug window for triggering a script manually command by command)? Hmmm...
Doesn't sounds like a big problem. In my understanding "Step Mode" will only be enabled temporarily for debugging purposes. But it may still be a little weird for the uses to see some unexpected scripts keep coming :eh:

admin
Site Admin
Posts: 60604
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Run scripts from an external program?

Post by admin »

Channing wrote:
admin wrote:If you tell me what exactly you want to achieve by remote scripting, I might find an easier and safer way for you to do it.
Here are a few things I need currently:
  • Get the selected/highlighted file path in the current XYplorer instance. Then with one simple hot key press, Listary can help the user open it in a file dialog.
  • Let the current XYplorer window jump to a folder and select one specific file. The new beta version of Listary adds Everything integration, and I'd like to bring the ultra fast full disk search experience to XYplorer.
  • Export the file list content. This will make it easier for Listary to do some search and add favorites.
  • Open a new tab with specific path and file type filters. With Listary you can use Total Commander to totally replace file dialogs, and I'd love this feature to also support XYplorer.
Also, I'd like to confirm the WM_COPYDATA runs synchronously, i.e. at the moment WM_COPYDATA returns, the script is guaranteed to be finished?

Thank you very much for your time :)
Hi Channing,

there are some recent advances in inter-process communication you might like to know of. Especially this might be interesting:

Code: Select all

v12.30.0104 - 2013-04-15 10:24
    + SC CopyData enhanced: Added a mode (previously "flags") to 
      immediately return the text, with variables resolved, to the sender.
      Syntax: copydata hwnd, data, mode
        mode:
            2: Resolve variables in data and return to sender immediately.
               Variables are XYplorer native and environment variables.
      Example:
        - Determine <curitem> in another XYplorer instance (hWnd 197078):
          copydata 197078, '<curitem>', 2; echo <get copieddata 3>;
        Note that the single quotes in the example are essential else 
        <curitem> would be resolved in *this* instance of XYplorer 
        before being sent to the other instance.
    > Note for DEVELOPERS:
      The mode parameter in SC CopyData simply select different dwData
      - If called with mode 0 then
          cds.dwData == 4194304 (0x00400000)
          = Do nothing special.
      - If called with mode 1 then
          cds.dwData == 4194305 (0x00400001)
          = Data is XYplorer script; execute this script immediately.
      - If called with mode 2 then
          cds.dwData == 4194306 (0x00400002)
          = Resolve variables in data and return to sender immediately.
      So any application can use these dwData values to trigger a 
      specific reaction in XYplorer when it receives data via 
      WM_COPYDATA.
So, sending data via WM_COPYDATA to XYplorer with cds.dwData == 4194306 (0x00400002) will result in an immediate reply from XYplorer with all variables in data resolved.

Post Reply