Jump to content

AutoIt3Wrapper - "run" with stop on error by parameter


Recommended Posts

  • Developers

What exactly is "CompilerRunner" and what does it do? 
In AutoIt3Wrapper I shell an extra Watcher instance which monitors both the original shelled AutoIt3Wrapper instance and  the  Script instance.
When Either one is not there anymore, the other will be killed to ensure the editor sees it is terminated.  (Hope that makes sense, else check the logic for "/watcher" in the script.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

12 minutes ago, Jos said:

What exactly is "CompilerRunner" and what does it do? 

CompilerRunner is the short form of "AutoIt3_CompilerRunner.au3" (see posting).

It is the Au3 script that handles the "Run" commands ("Run", "Compile", "Compile with Dialog", and "Check"). It is called by PSPad.

PSPad calls CompilerRunner and gives it "Example.au3". CompilerRunner starts AutoIt3 with AutoIt3Wrapper and passes it "Example.au3".

Spoiler with code section of CompilerRunner.

Spoiler
; [1]: TypToRun ("/Run", "/Compile", "/CompileDialog", "/Check")
      ; [2]: ActiveAu3Path ($sAu3FilePath)

      ; Run:            /prod /in "%File%" /run /ErrorStdOut /UserParams
      ; Compile:        /prod /in "%File%" /out "%Dir%%Name%.exe"
      ;                 /prod /in "%File%" /out "%Dir%%Name%.exe" /NoStatus
      ; CompileDialog:  /prod /in "%File%" /ShowGui
      ; Check:          /prod /in "%File%" /AU3check
      ; Check (Short):  "C:\Program Files (x86)\AutoIt3\Au3Check.exe" "%File%"

      $sTypToRun = $CmdLine[1]
      $sAu3FilePath = $CmdLine[2]

      Switch $sTypToRun

        Case '/Run'
          $sRunParams = ' /prod /in "' & $sAu3FilePath & '" /run /ErrorStdOut /UserParams'

        Case '/Compile'
          $sExeFilePath = StringReplace($sAu3FilePath, ".au3", ".exe", -1)
          $sRunParams = ' /prod /in "' & $sAu3FilePath & '" /out "' & $sExeFilePath & '"' ; & ' /NoStatus'

        Case '/CompileDialog'
          $sRunParams = ' /prod /in "' & $sAu3FilePath & '" /ShowGui'

        Case '/Check'
          $sRunParams = ' /prod /in "' & $sAu3FilePath & '" /AU3check'

        Case Else
            MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "AutoIt3_CompilerRunner", _
            'Wrong parameter for "TypToRun":  ' & $sTypToRun)

      EndSwitch

      $sAutoIt3Command = _
        '"' & @ProgramFilesDir & '\AutoIt3\AutoIt3.exe"' _
        & ' "' & @ProgramFilesDir & '\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3"' _
        & $sRunParams

;       MsgBox(0, "", $sAutoIt3Command)

      $g_iAutoIt3PID = Run($sAutoIt3Command, "", @SW_HIDE, $STDOUT_CHILD)

      ; Ausgabe nach Error-Lines durchsuchen und korrigieren, denen Spaltenangaben fehlen.
      CaptureAutoIt3Output_AndSendToLogWin($hPSPad, $tLogCtrls)

 

 

25 minutes ago, Jos said:

In AutoIt3Wrapper I shell an extra Watcher instance ...  (Hope that makes sense, else check the logic for "/watcher" in the script.

I understand what is meant. I did a lot of research on the internet (found this here from 2009) and studied the great AutoIt3Wrapper.au3. 👍

 

32 minutes ago, Jos said:

In AutoIt3Wrapper I shell an extra Watcher instance which monitors both the original shelled AutoIt3Wrapper instance and  the  Script instance.
When Either one is not there anymore, the other will be killed to ensure the editor sees it is terminated.

This works great in SciTE if you press Ctrl+Break, but unfortunately not in PSPad if there is no visible window.

Link to comment
Share on other sites


"Example - endless loop.au3" (in the following I just call it Example.au3)

MsgBox(0, "", "After closing the MsgBox an endless loop starts.")

While 1
  endless loop for debug.
WEnd

Test 2

- Open SciTE with Example.au3 and start it. An MsgBox appears. Click MsgBox away, the infinite loop starts, no window is visible.
- Open PSPad with Example.au3 and start it. An MsgBox appears. Click MsgBox away, the infinite loop starts, no window is visible.
- Set the focus back to SciTE, Crtl+Break closes Example.au3.
- Set the focus back to PSPad, Crtl+Break does NOT close Example.au3.
- The infinite loop runs and runs.

As I said, next I try to intercept this in my CompilerRunner.

Link to comment
Share on other sites

  • Developers

Ok... I have done some testing with PSPAD myself and found the issue in Autoit3Wrapper...  try the latest Beta. ;) 

image.thumb.png.3d5f21af3bdd4a0bc6ce0bad2a5f77b9.png

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi Jos, CompilerRunner for Jos 2019-11-16 19.01.zip is a short version of CompilerRunner. If you want to try it, just copy the whole folder "Script" into the PSPad directory. Then start PSPad. It should work then: F5, Ctrl+F5, F7 and Ctrl+F7. And Ctrl+Break for testing. :)

From line 254 is my workaround. It is commented out.

My tests with the new beta of AutoIt3Wrapper follows in the next post.

 

Edit: Oh, I forgot: Please remove all old shortcuts in PSPad needed by CompilerRunner (F5 - F7, etc.).

Edited by Professor_Bernd
Link to comment
Share on other sites

  • Developers

It's not as simple as just copying the scripts for me.
The script support wasn't switched on but after that it still doesn't work. The menuitems now show under Scripts/_autoit but nothing happens.
Any suggestions?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Did you copy the folder completely into the PSPad directory?

The structure should look like this:

- PSPad

- - Script

- - - AutoIt helper scripts (with AutoIt3_CompilerRunner.au3 in it)

- - - VBScript (with AutoIt3__Main_A.vbs in it)

Bitte PSPad dann starten, oder neu starten.

Then please start PSPad, or restart it.

Edited by Professor_Bernd
Part translated to english.
Link to comment
Share on other sites

 

Ok, it might be because you have PSPad in the programs folder of Windows. Then settings will be moved to AppData.

Here is a link to a portable version of PSPad4AutoIt3 for you. This should work so that you can use this version without affecting the other PSPad installations. I put it together very quickly, I hope it was all right. Please try it and tell me if it works. ;)

 

Bernd.

Link to comment
Share on other sites

  • Developers
18 minutes ago, Professor_Bernd said:

Did you copy the folder completely into the PSPad directory?

-snip-

Bitte PSPad dann starten, oder neu starten.

 

Basics work as the Menu is there, so this isn't the problem. ;) 

2 minutes ago, Professor_Bernd said:

Ok, it might be because you have PSPad in the programs folder of Windows. Then settings will be moved to AppData.

I indeed used the installer and PSpad is in the programs x86 folder. Can't find any settings in appdata.

..but did a little testing and the getVarValue("%Ext%") statement return nothing in Sub AutoIt3_RunCompilerRunner(s_TypToRun), so that is why nothing happens.
I am done trying to make this work as I am not really that interested in investing time in this editor anymore. I di start with PSPAD in the beginning, many moons ago, but was to limited in the whole integration and lexer capabilities, so moved to SciTE and wrote my own lexer for AutoIt3. :) 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

6 minutes ago, Jos said:

..but did a little testing and the getVarValue("%Ext%") statement return nothing in Sub

Your version of PSPad is missing some improvements of the new PSPad Developer version. If you still want to try, in my link is a working portable version of PSPad4AutoIt3 that should work.

Otherwise I understand that you don't want to spend time in PSPad, you made something wonderful out of SciTE. Thanks for your help!

Link to comment
Share on other sites

  • Developers

Ah ok....  tried that and it works .....   also the Ctrl+Break . :) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I just copied them into the PSPAD dir in program files x86. 
Just uploaded an updated AutoIt3Wrapper that will now also show which editor it was shelled from and it version info and skipping the SciTE stuff when not shelled from SciTE. :) 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi Jos. Can you please wait with the update for AutoIt3Wrapper.au3 "19.102.1901.10"? In my tests under some circumstances the version "19.102.1901.8" is better suited, but I'm not sure. I will not be home tomorrow (Sunday). If it's okay with you, I can finish my tests on Monday and let you know. 😊

Link to comment
Share on other sites

Okay, one two last tests today. :P

 

Example-1.au3

MsgBox(0, "Example", "This is an example"); That's all. ;-)

 

Example-2.au3

MsgBox(0, "", "After closing the MsgBox an endless loop starts.")

While 1
  ; endless loop for debug.
WEnd

 

Test 1


- Open SciTE with Example-1.au3 and start it. An MsgBox appears.
 
- Open PSPad with Example-2.au3 and start it. An MsgBox appears. Click MsgBox away, the infinite loop starts, no window is visible.

- Set the focus to PSPad and press Crtl+Break.

=> Now the MsgBox in SciTE is closed, Example-1.au3 is closed and the output of AutoIt3Wrapper is displayed in SciTE.

=> In PSPad nothing happens, the endless loop continues and no output is displayed.

 

Test 2

- Open PSPad with Example-1.au3 and start it. An MsgBox appears.

- Open SciTE (run no script) and press Ctrl+Break.

=> Example-1.au3 in PSPad is quit and the output of AutoIt3Wrapper is displayed in PSPad.

 

Maybe you could check which window is in the foreground when Ctrl+Break is pressed. :think:

Edited by Professor_Bernd
Link to comment
Share on other sites

  • Developers

Don't expect to be able to run a script both in SciTE and pspad at the same time with the same shortcuts as that is expected to give strange results. Why this do you want this to be possible?
From the Helpfile SetHotKey():

Quote

If two AutoIt scripts set the same hotkeys, you should avoid running those scripts simultaneously as the second script cannot capture the hotkey unless the first script terminates or unregisters the key prior to the second script setting the hotkey. If the scripts use GUIs, then consider using GUISetAccelerators as these keys are only active when the parent GUI is active.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

2 hours ago, Jos said:

Don't expect to be able to run a script both in SciTE and pspad at the same time with the same shortcuts as that is expected to give strange results. Why do you want this to be possible?

I hope it's not too off-topic, but I'd like to add a general consideration :

During the development of PsPad4AutoIt it is essential to run scripts simultaneously in SciTE and PsPad, of course.

After a release of PsPad4AutoIt, potential users certainly want to test both solutions as well, to compare the results.

But as soon as the user has made a decision to work with PsPad instead of SciTE, there are few reasons for a parallel, simultaneous usage.

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

  • Developers
8 minutes ago, Musashi said:

During the development of PsPad4AutoIt it is essential to run scripts simultaneously in SciTE and PsPad, of course.

 

10 minutes ago, Musashi said:

there are few reasons for a parallel, simultaneous usage.

Why exactly at the same time?  What is a proper use case for this?
This doesn't currently work with just SciTE either! 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...