Jump to content

AutoIt3Wrapper - "run" with stop on error by parameter


Recommended Posts

Hi Jos.

"+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop"

How can I use AutoIt3Wrapper for this?

 

Example.au3

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

; While 1
;   ; endless loop for debug.
; WEnd

 

Description of the problem:

From PSPad I start my "AutoIt3_Compiler Runner.au3", it starts "AutoIt3Wrapper.au3" and gives it "Example - endless loop.au3". This works so far.

If "Example.au3" hangs, for example because of an endless loop, the shortcut "Ctrl+Alt+Break to Restart" works, but "Ctrl+Break to Stop" has no effect.

In my CompilerRunner I re-registered the hotkey "Ctrl+Break" and handle it myself. But AutoIt3Wrapper has so many more features and error handling routines, so it would be very good to be able to use it. Is there another place in AutoIt3Wrapper that could help make "Ctrl+Break" work? I looked at the lines starting at 334 with "/Watcher". Could that help? :think:

Link to comment
Share on other sites

  • Developers

Ctrl+break is again an standard SciTE shortcut so that is why it works there and isn't  handled by autoit3wrapper. I don't know how pspad handles it.

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

This is an example:

>"C:\ProgFilesSelf\AutoIt3\SciTE\..\AutoIt3.exe" "C:\ProgFilesSelf\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\AU3code\MyDarkModeThemeEditor\MyFineTunedHCT.au3" /UserParams /myParam   
+>21:15:14 Starting AutoIt3Wrapper v.19.102.1901.0 SciTE v.4.1.2.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => "C:\ProgFilesSelf\AutoIt3\SciTE"   UserDir => "C:\Users\Tester\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper"   SCITE_USERHOME => C:\Users\Tester\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  params:-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7  from:C:\ProgFilesSelf\AutoIt3  input:C:\AU3code\MyDarkModeThemeEditor\MyFineTunedHCT.au3
+>21:15:15 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\ProgFilesSelf\AutoIt3\autoit3.exe "C:\AU3code\MyDarkModeThemeEditor\MyFineTunedHCT.au3" /myParam   
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop

so that "/myParam" is passed to the script I intent to run

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Ah, ok, do I understand that correctly? If I call AutoIt3 with AutoIt3Wrapper and pass "Example.au3", can I pass parameters with /UserParams that are for the "Example.au3" (not for AutoIt3Wrapper)?

Your tip with "Control Viewer" sounds interesting. I'm looking for a way to query the HotKey in PSPad/CompilerRunner. This is because AutoIt3Wrapper has already registered the HotKey (Ctrl+Break) to stop "Example.au3". If I also register the HotKey then SciTE does not work properly. But if I can't notice the HotKey in my CompilerRunner, AutoIt3Wrapper can't close "Example.au3" properly.

 

Link to comment
Share on other sites

43 minutes ago, Professor_Bernd said:

Thank you. Which parameters are user parameters? Can you please give an example?

In the full Scite Editor, if you press SHIFT+F8 it will bring up a dialog that will allow you to enter user parameters.  You will see these parameters added to the  AutoIt3Wrapper command line using /UserParams.  These parameters will be passed to the script upon execution.

Edited by TheXman
Link to comment
Share on other sites

1 minute ago, Professor_Bernd said:

If I call AutoIt3 with AutoIt3Wrapper and pass "Example.au3", can I pass parameters with /UserParams that are for the "Example.au3" (not for AutoIt3Wrapper)

exactly.

2 minutes ago, Professor_Bernd said:

Your tip with "Control Viewer" sounds interesting.

Like I said, you may close you script with the editor's hotkey and it will close the one PID but, at times, I write some ugly things, and the editor can not know that. So the CV running in the background is a life saver, say, I make my code reload my code, in a loop. The CPU is 100%, ... the only way to stop it w/o reboot is this CV running in the background ( with the "Extras" enabled.

As far as HotKeys, I'm sure you can find something not in use, to use in the other setup.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

First of all, thank you both!

 

2 minutes ago, argumentum said:

exactly.

Well, then that's settled! :drinks:

5 minutes ago, argumentum said:

As far as HotKeys, I'm sure you can find something not in use, to use in the other setup.

That's right! But AutoIt3Wrapper registers the HotKey Ctrl+Break, so it also works (unfortunately) in my CompilerRunner. The problem is that AutoIt3Wrapper doesn't close the "Example.au3" properly because it doesn't run in SciTE. (The CompilerRunner is started by PSPad.)

As described above, I can't use the same HotKey, because then SciTE doesn't work properly anymore. At the moment I'm trying to use _isPressed() to monitor whether Ctrl+Break is pressed. If this works, SciTE and PSPad can coexist.  :thumbsup:

Link to comment
Share on other sites

  • Developers

I am trying to understand your issue with Ctrl+Break. AutopIt3Wrapper uses Ctrl+Break and Ctrl+Alt+END to Restart. This should be working for either Editor right?
They are both configurable by settings them in AutoIt3Wrapper.ini:

Local $INP_HotKey_Stop = IniRead($AutoIt3WapperIni, "Other", "SciTE_STOPEXECUTE", '^{BREAK}')
        Local $INP_HotKey_Restart = IniRead($AutoIt3WapperIni, "Other", "SciTE_RESTART", '^!{BREAK}')

When you like to stop the script you need to change Ctrl+Break to something else or else it will not work because of this code:

If $INP_HotKey_Stop <> '^{BREAK}' Then
    HotKeySet($INP_HotKey_Stop, 'CTRL_BREAK_WRAPPER')
EndIf

This is because, like i already mentioned in the PM, a standard Hotkey in SciTE, so I do not set it in the script. So try changing it in the INI or comment the above IF & EndIf lines and leave the HotKeySet() so that it is always done to test:

/~ If $INP_HotKey_Stop <> '^{BREAK}' Then
    HotKeySet($INP_HotKey_Stop, 'CTRL_BREAK_WRAPPER')
/~ EndIf

Is this what you are looking for?

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

3 hours ago, Jos said:

AutopIt3Wrapper uses Ctrl+Break and Ctrl+Alt+END to Restart. This should be working for either Editor right?

 

I worked on the problem all last night, but then I tested things I had tested 1,000 times before. My head overflowed and I went to sleep.

Now it's a new day. I will do many more tests and hopefully see through. As far as I can tell, Ctrl+Break to stop causes problems when SciTE and PSPad run simultaneously. For example I start "Example-1.au3" in PSPad and "Example-2.au3" in SciTE, then I press Ctrl+Break. Now it can happen that both Example.au3 in SciTE and PSPad are killed.

But in the end I was very tired and can't remember the exact connections. ... Today I will do more tests, and also test your last hints. This may take a while. Then I will post (hopefully) better information. 😁

Link to comment
Share on other sites

  • Developers

Try changing those 3 lines I show in the last part and try again to see whether that works. ;)

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

...good morning. I woke up, read the news paper AutoIt forum, and got to think that if, one is to run more than one instance of a HotKey ( of the Wrapper ), a HotKey ( in the wrapper ) is not going to work. Now with that out of the way, the wrapper should not care much ( other than hard codded ) what loaded it.
What I'm trying to say is that, only one instance of a wrapper should run at a given time, no matter what editor loaded it.

Other wise, a "main" wrapper with IPC would have to keep tabs, of the "script running wrappers", ...it would be impractical ( and doomed to failure in my thinking ).

Nah, I just wanted to say that in case it was not clear, then again, I just woke up 😴

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • Developers

When your point is that the Ctrl+End can always be set for AutoIt3Wrapper then I would agree.

...  and also just tested it, so will remove that If in the next Beta version available now.  :-)

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,

Please wait, to avoid changing the wrong one. I'm testing right now and there are crazy results. A lot of things that didn't work last night are now working. I think it's also because I rebooted the PC today. (I tested endless loops yesterday, there is probably something left in the RAM!?)

Now I will test further. Until I know more, you don't need to do any unnecessary work. (Thanks for your kindness!)  :)

But one thing is already clear: If I change the 3 lines you mentioned above, then there is chaos. In PSPad I press Ctrl+Break and SciTE displays a message. ... :doh:I changed it back to "normal" (both lines uncommented).

 

Link to comment
Share on other sites

  • Developers
13 minutes ago, Professor_Bernd said:

In PSPad I press Ctrl+Break and SciTE displays a message. ... :doh:I

Well, as I have already mentioned 2 times before, that makes sense as it is a standard Shortcut for SciTE! That will not go away when we also set it in AutoIt3Wrapper. 
So your only option will be to use an alternative shortcut for that as I have explained. ;) 

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

"Example.au3"
 

MsgBox(0, "Example", "This is an example") ; That's all. 😉 [Click and drag to move]

Test 1

Spoiler

 

Test 1a

- Open SciTE with Example.au3 and start it. An MsgBox appears.
- Open PSPad with Example.au3 and start it. An MsgBox appears and has the focus.
- Press Ctrl+Break. The MsgBox is closed.

- The same, but focus to the MsgBox of SciTE, Crtl+Break closes the MsgBox.


Test 1b

- Open SciTE with Example.au3 and start it. An MsgBox appears.
- Open PSPad with Example.au3 and start it. An MsgBox appears.
- Set the focus back to the MsgBox of SciTE, Crtl+Break closes the MsgBox.
- Set the focus back to the MsgBox of PSPad, Crtl+Break closes the MsgBox.


Test 1c

- Open SciTE with Example.au3 and start it. An MsgBox appears.
- Open PSPad with Example.au3 and start it. An MsgBox appears.
- Set the focus back to SciTE, Crtl+Break closes the MsgBox.
- Set the focus back to PSPad, Crtl+Break DOES NOT close the MsgBox.
- Set the focus on the MsgBox of PSPad, Crtl+Break closes the MsgBox.

 

So far, so good. I'm trying to catch that in my CompilerRunner.

 

15 minutes ago, Jos said:

Well, as I have already mentioned 2 times before, that makes sense as it is a standard Shortcut for SciTE! ... So your only option will be to use an alternative shortcut for that as I have explained. ;)

You're right, like you said. It would be easy to register another HotKey in PSPad, e.g. Ctrl+Shift+Break. I've thought about this many times. The problem is that AutoIt3Wrapper's HotKey (Ctrl+Break) is still captured in PSPad.

If "Example.au3" hangs, and the user presses Ctrl+Shift+Break I can capture it in CompilerRunner. But when the user presses Ctrl+Break, nothing happens and the user is confused. :drool:

I'm working on capturing that in CompilerRunner right now.

 

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...