[wdx] WinScript Advanced Content Plugin (x86\x64) (new)

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, Stefan2, white, sheep

Skif_off
Member
Member
Posts: 107
Joined: 2013-09-30, 13:13 UTC

Post by *Skif_off » 2016-05-15, 14:25 UTC

Huh! AutoIt works too:

Code: Select all

Local $hFile, $sLine
$hFile = FileOpen($CmdLine[1], 0)
If $hFile = -1 Then
    ConsoleWrite('Error: Permission denied')
    Exit
EndIf
$sLine = FileReadLine($hFile, 1)
FileClose($hFile)
ConsoleWrite($sLine)
Upd:
2hi5
AutoHotkey.vbs works without " 2>&1":

Code: Select all

content = execStdOut("""path\AutoHotkey.exe"" ""path\testAhk.ahk"" """ & filename & """")

hi5
Member
Member
Posts: 155
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2016-05-15, 14:43 UTC

Thanks, updated the HOW TO with a link to your AutoIt example.

Psychedelic
Junior Member
Junior Member
Posts: 20
Joined: 2011-10-30, 15:35 UTC

Post by *Psychedelic » 2016-05-17, 20:32 UTC

Updated
1.3.4: 17 May, 2016
***
Added an ability to add any custom script engines. WinScriptAdv sends script code directly to an exe interpreter, and script returns its results to the console StdOut, where WinScriptAdv reads them.

Some script engines do not support COM interface (IActiveScript) or has problems with it (no x64, unstable, buggy, stopped supporting like php etc), so this option will be very useful, but such scripts are working slower.

Now Vbs, JS and Python are using COM,
AHK and PHP are working via exe parser.

***
Added AutoHotKey (*.ahk) scripting language support

***
Added PHP scripting language support

See examples in Scripts folder, and read ReadMe for details.


Image: http://img10.lostpic.net/2016/05/17/535fc327e542cfb84b561b7cac0f2fc7.png

Btw how to enable images on this forum? I do not see images in tags img, only link to png file.

hi5
Member
Member
Posts: 155
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2016-05-17, 21:34 UTC

PHP - very nice and AHK of course - tested it and it works like a charm :-)

Thanks!

Skif_off
Member
Member
Posts: 107
Joined: 2013-09-30, 13:13 UTC

Post by *Skif_off » 2016-05-17, 22:27 UTC

2Psychedelic
Thanks! About x64 exe interpretetor: is the plugin supports paths with environment variables? I now can not check :( I use AutoRun and environment variable %AutoIt%:

Code: Select all

If %AUTORUN_TCARCH% = 32 Then 
  SetEnv /EV AutoIt %COMMANDER_PATH%\AutoIt3.exe 
Else 
  SetEnv /EV AutoIt %COMMANDER_PATH%\AutoIt3_x64.exe 
EndIf
it's very convenient.

Psychedelic
Junior Member
Junior Member
Posts: 20
Joined: 2011-10-30, 15:35 UTC

Post by *Psychedelic » 2016-05-18, 01:44 UTC

Skif_off wrote:2Psychedelic
Thanks! About x64 exe interpretetor: is the plugin supports paths with environment variables? I now can not check :( I use AutoRun and environment variable %AutoIt%:

Code: Select all

If %AUTORUN_TCARCH% = 32 Then 
  SetEnv /EV AutoIt %COMMANDER_PATH%\AutoIt3.exe 
Else 
  SetEnv /EV AutoIt %COMMANDER_PATH%\AutoIt3_x64.exe 
EndIf
it's very convenient.
Yes I can do it, but

[Text below is not actual yet, I found a solution]:

I have another problem with Autoit.
The main problem - Autoit script can't write text to the console or I can't read it correctly. So simple but..

Yes it has ConsoleWrite , but pipe that I create before starting AutoIt process (CreatePipe + CreateProcess(Autoit.exe)) is always empty, 0 bytes.

For example in AHK it sends to Stdout pipe:

Code: Select all

FileAppend, %content% `n, *
If I run AHK script from cmd.exe - I do not see any output (like with Autoit), but if I run it with CreateProcess with Read\Write pipe - I see some data in pipe.
To see text in cmd.exe (for script debug or testing with cmd.exe) with AHK I used

Code: Select all

DllCall("AttachConsole", "int", -1)  
and then
FileAppend, %content% `n, * 

But in case of Autoit I do not see both - no text in cmd.exe, and no data in Pipe (CreateProcess).
I tried AttachConsole - no text.

So I started to search how to disaply text in console (cmd.exe for example) and has found this https://www.autoitscript.com/forum/topic/154864-consolewrite-doesnt-work-need-console-print-function/
and tried it (Win 10)

Code: Select all

#include <consoleprint.au3>
ConsoleOut("asdasd")
but still no text in cmd.exe and in StdPipe.
I also tried some another variations (do not remember yet) but still no text in pipe or cmd.exe.
Last edited by Psychedelic on 2016-05-18, 10:49 UTC, edited 1 time in total.

Skif_off
Member
Member
Posts: 107
Joined: 2013-09-30, 13:13 UTC

Post by *Skif_off » 2016-05-18, 10:35 UTC

Psychedelic wrote:Yes I can do it
Thanks :)

I now have not ideas about AutoIt, but now we can use AutoIt.vbs, AutoIt3.exe and *.au3 like here.

Psychedelic
Junior Member
Junior Member
Posts: 20
Joined: 2011-10-30, 15:35 UTC

Post by *Psychedelic » 2016-05-18, 10:41 UTC

Skif_off wrote:
Psychedelic wrote:Yes I can do it
Thanks :)

I now have not ideas about AutoIt, but now we can use AutoIt.vbs, AutoIt3.exe and *.au3 like here.
I already found problem in my Delphi code. I just needed to create 2 pipes as was shown here
https://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx

Psychedelic
Junior Member
Junior Member
Posts: 20
Joined: 2011-10-30, 15:35 UTC

Post by *Psychedelic » 2016-05-18, 18:47 UTC

Updated
v.1.4 : 18 May, 2016

***
Added AutoIt (*.au3) scripting language support
***
You can use enviroment variables in "path" key in options.ini, section [ExeScriptParsers]
***
Fixed: Under certain conditions the data did not come through StdOut pipe from some apps.

User avatar
Stefan2
Power Member
Power Member
Posts: 2091
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 » 2016-05-18, 19:02 UTC

Great improvements!

Is there a change you will add support for PowerShell script too?




Thanks for your Work!


 

Skif_off
Member
Member
Posts: 107
Joined: 2013-09-30, 13:13 UTC

Post by *Skif_off » 2016-05-18, 21:30 UTC

2Psychedelic
Big thanks!
About testAutoIt.au3: string

Code: Select all

#include <WinAPIFiles.au3>
is not needed because all used functions are "built-in" functions AutoIt exe.

Psychedelic
Junior Member
Junior Member
Posts: 20
Joined: 2011-10-30, 15:35 UTC

Post by *Psychedelic » 2016-05-18, 23:26 UTC

Stefan2 wrote:Great improvements!
Is there a change you will add support for PowerShell script too?

Thanks for your Work!
 
PowerShell requires a slightly different approach to launch scripts.
It does not have COM interfaces to execute his script (like vbs, js, python) so plugin have to execute ps script via exe interpreter.

To start php script for example, via exe, I just need to start php.exe with path to a script file. When it's done - script return data to console pipe. All this take milliseconds - near 150-200 ms.

When I started cmd.exe and typed PowerShell.exe with path to a script file (which had only one command - writing to console text "Hello world!") - it took about 5 seconds from starting exe to showing text (!).
This is slow as hell to process each file in a list with such method.

We need another method - such as start PowerShell and do not close it, until plugin has closed or by timeout, and send script data to this always running PS.exe (during WinScriptAdv session), get results and filter them.

To implement this method I need a few days of work, so I'll do it later (in summer, dunno exactly) or earlier if more people will request Power Shell in WinScriptAdv.

User avatar
Stefan2
Power Member
Power Member
Posts: 2091
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 » 2016-05-19, 09:32 UTC

Psychedelic wrote:
Stefan2 wrote:Is there a change you will add support for PowerShell script too?
PowerShell requires a slightly different approach to launch scripts.
OK, I see. Please take your time, IF you consider to work on that. Thank you.



 

User avatar
Ovg
Power Member
Power Member
Posts: 536
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Post by *Ovg » 2016-05-19, 16:56 UTC

First of all - many thanks for this nice plugin!

But i have a problem:

I wrote a VBS script to parse the xml file. From the command line it works, but as soon as I connect it to the plugin - TC hangs up with error for both versions of TC

http://rgho.st/8cS666hQX x32
http://rgho.st/6TXpNSPqD x64

I have found source of problem:
set xmlDoc = CreateObject("MSXML2.DOMDocument")
lead to crash. Even if this is the only line in the script.

I tried set xmlDoc = createobject("Microsoft.XMLDOM"), but result is the same. Any suggestions will be appreciated.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 9.20 x64, Windows 7 SP1 x64

Psychedelic
Junior Member
Junior Member
Posts: 20
Joined: 2011-10-30, 15:35 UTC

Post by *Psychedelic » 2016-05-20, 21:31 UTC

Updated

v1.5: 21 May, 2016
***
Fixed crash when creating certain objects in vbs script.
Such as: set xmlDoc = CreateObject("MSXML2.DOMDocument")
or
xmlDoc = createobject("Microsoft.XMLDOM")

Post Reply