Auto It Script Debugging - autoit

I have a simple script that works on my PC but not on three others. I am running the script directly from SciTE on all the machines, including my own. Anyway, is there something I can turn on to see what's happening?
Script:
While True
WinSetOnTop("[TITLE:Production Floor Display]","", 1)
Sleep(20000)
WinSetOnTop("[TITLE:Production Floor Display]","", 0)
WinSetOnTop("[TITLE:Preview Image]","", 1)
Sleep(5000)
WinSetOnTop("[TITLE:Preview Image]","", 0)
Wend

No, at least not natively.
What are you trying to achieve?
Try compiling the program before doing anything else.
If that is what it looks like (something to do with an industrial camera feed), then you're better off just using Javascript, PHP, NGINX and HTML. That would also be uncomparable to your approach in terms of reliability.

Related

How to scroll up in Vim buffer with R (using Nvim-R)

I'm a happy user of the Nvim-R plugin, but I cannot find out how to scroll up in the buffer window that the plugin opens with R. Say for instance that I have a large output in console, but I cannot see the top of it - how do I scroll up to see this? In tmux for instance there's a copy mode that quite handily lets you do this, but how is this done in the R buffer?
An example below where I'm very curious to see what's on the line above the one begining with "is.na(a)...". How can this be achieved?
I have scoured the documentation found here, but without luck.
The answer is apparently to use Ctrl+\ Ctrl+n according to this answer on the bugreports for NVim-R.
Here's what my output looks like when I output mtcars:
When I hit Ctrl+\ Ctrl+n, I can move the cursor and I get line numbers:
To get back to interactive, I just use i, the same way I normally would.
Apparently, if you are using neovim, then you can add let R_esc_term = 0 in your ~/.vimrc file and you can then use the escape key, but if you don't use neovim, you are stuck using the two ctrl commands ¯\_(ツ)_/¯.
As pointed out by ZNK, it is about switching to normal mode in Vim's terminal. This, however, can easily fail due to cumbersome keybinding. If such is the case, remap the default keybinding to something reasonable, say, by putting this in your .vimrc:
tnoremap jk <C-\><C-n>
This works for me in Linux running Vim 8.0 in terminal (e.g. does not require Neovim). As you can see, I use 'jk' to switch from insert to normal mode. One can use Esc instead of jk, however, this makes me unable to use up arrow to retrieve command line history as been reported elsewhere.

How to avoid sign extension with AutoIT BitShift()?

While trying to port an algorithm from C, I have determined that the AutoIT BitShift( ) function does sign extension if the high bit of a 32-bit field is set.
ConsoleWrite("Bit shift test: (0x80112233 >> 4)=" & hex(BitShift(0x80112233,4)) & #CRLF) ;### Debug Console
ConsoleWrite("Bit shift test: (0x60112233 >> 4)=" & hex(BitShift(0x60112233,4)) & #CRLF) ;### Debug Console
Bit shift test: (0x80112233 >> 4)=F8011223
Bit shift test: (0x60112233 >> 4)=06011223
See how the first test adds an 'F' to the front.
I think I'm straying outside the normal operations of AutoIT (not a lot of documentation on BitShift and BitRotate, and I don't see anybody else that ran into this problem), but I'm hoping somebody has an easy fix for this.
I'm using 3.6.6 of SciTe, if that matters.
I don't consider current BitShift() working wrong. Official documentation says this:
Bit operations are performed as 32-bit integers.
Since it doesn't say "as unsigned 32-bit integers", sign extension seems quite OK.
However, I don't see you point. If you know desired behavior, why not implementing custom function to fit your needs? Here is my variant:
Func BitShiftUnsigned($value, $shift)
If $shift > 0 Then
Return BitAnd(BitShift($value,$shift), BitShift(0x7fffffff, $shift-1))
Else
Return BitShift($value,$shift)
EndIf
EndFunc

How to run Go(lang) code directly from terminal/command line?

I want to run simple go code directly from terminal/command line. For example:
go run "
package main
func main() {
println("hello")
}
"
hello
However golang allows code execution only from file. So maybe there are some ways how to emulate it? Like this:
go run file.go < echo "...."
But there should be no files after actions above.
In command-line, only a project like go-repl would compile/run a multi-line go source code without leaving any .go file behind.
An alternative: gore:
$ gore
Enter one or more lines and hit ctrl-D
func test() string {return "hello"}
println(test())
^D
---------------------------------
hello
(Other repl-like solution are listed in "Does Go provide REPL?")
Or you would need to develop a go wrapper which would internally create a source code and go run it, before deleting it.
Ubuntu has a gorun tool which works well for small scripts. It compiles scripts on the fly, caching the binaries in /tmp.
https://wiki.ubuntu.com/gorun
Although it's intended for scripting and not as a REPL, you could use it in various ways.
Although gorun has come from the Ubuntu community, it should work on any Linux distro because it uses vanilla Go source code via
$ go get launchpad.net/gorun

AutoIT3 - get script to run .exes from multiple root directories

I have a script that I found online which runs an .exe on my flash drive whenever I plug it in. However I have a second flash drive which obviously has a different letter to the first one, and I want the same script to attempt to try and find the (same) .exe in both flash drives when I only plug on of them in. Currently the code is this:
$DBT_DEVICEARRIVAL = "0x00008000"
$WM_DEVICECHANGE = 0x0219
GUICreate("")
GUIRegisterMsg($WM_DEVICECHANGE , "MyFunc")
Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam)
If $WParam == $DBT_DEVICEARRIVAL Then
Run ("J:\DropboxPortableAHK\DropboxPortableAHK.exe")
EndIf
EndFunc
While 1
$GuiMsg = GUIGetMsg()
WEnd
Run ("K:\DropboxPortableAHK\DropboxPortableAHK.exe")
EndIf
EndFunc
While 1
$GuiMsg = GUIGetMsg()
WEnd
Now, I'm not gonna lie, I don't actually have a clue what any of this does, with the sole exception of the Run command. I'm a very novice programmer and I only have experience in Python3, so I tried adding a second run command after the first but it didn't work. I tried Googling the problem, but I couldn't find anything that I recognised as similar to my question. If anybody knows how I could get the same script to detect both drives (J and K), that would be greatly appreciated.
Thanks,
Tom
To give you a quick and dirty solution:
Just double only the first Run(...) line and change the drive letter. Nothing will happen, when the path won't be found... but if both are found, both will be run. And remove all the lines after WEnd. That's just unnecessary copy'n'paste without knowing what you do ;-)

Silencing ChromeDriver.exe logging

I am running ruby unit tests against Chrome using watir-webdriver. Whenever a test is run and chromedriver.exe is launched output similar to below appears:
Started ChromeDriver
port=9515
version=26.0.1383.0
log=C:\Home\Server\Test\Watir\web\chromedriver.log
[5468:8796:0404/150755:ERROR:accelerated_surface_win.cc(208)] Reseting D3D device
[5468:8996:0404/150758:ERROR:textfield.h(156)] NOT IMPLEMENTED
[WARNING:..\..\..\..\flash\platform\pepper\pep_module.cpp(63)] SANDBOXED
None of this impacts the correct functioning of the tests, but as one might imagine the appearance of "ERROR" and "WARNING" might be rather confusing to, for example, parsing rules in Jenkins looking for failures. Sure I can get really fancy with regular expression in the parsing rules, but it would be really nice to turn off this verbose and unnecessary logging on the part of chromedriver.exe. I have seen many mentions of this searching for an answer. No one has come up with a solution. Yes, chromedriver possibly has a "--silent" option, but there seems to be no way to pass that to the executable. Code similar to below is supposed to work, but has zero effect as far as I can see. Any ideas?
profile = Selenium::WebDriver::Chrome::Profile.new
profile['--cant-make-any-switches-work-here-how-about-you'] = true
browser = Watir::Browser.new :chrome, :profile => profile, :switches => %w[--ignore-certificate-errors --disable-extensions --disable-popup-blocking --disable-translate--allow-file-access]
Here's help for anyone else searching
Find ...selenium\webdriver\chrome\service.rb
Path start may differ on your system
And I added "-silent" to the passed parameters .... However, this silenced everything but the error/warning messages.
def initialize(executable_path, port)
#uri = URI.parse "http://#{Platform.localhost}:#{port}"
server_command = [executable_path, " -silent", "--port=#{port}"]
#process = ChildProcess.build(*server_command)
#socket_poller = SocketPoller.new Platform.localhost, port, START_TIMEOUT
#process.io.inherit! if $DEBUG == true
end
set chromeOptions with key --log-level=3 this should shut it up
I was able to divert the hundreds, yes hundreds, of chrome driver log messages that were showing up in cucumber stdout by using the :service_log_path argument.
#browser = Watir::Browser.new :chrome, :service_log_path => 'chromedriver.out'
the '-silent', or '--silent', or ' -silent', or ' --silent' parameter suggested above did nothing when I added it to ...selenium\webdriver\chrome\service.rb. And having to tweak the gem itself is not a particularly viable solution.
I couldn't find a place to capture the chromedriver stderr and divert it to null (not to mention having to handle doing that in windows and in *nix/osx)
The driver should default to something way less verbose. In this case INFO is way too verbose as hundreds of log entries pop out as INFO, 90%+ of them identical.
At least the :service_log_path argument works most of them.
You can try -Dwebdriver.chrome.logfile="/dev/null" and/or -Dwebdriver.chrome.args="--disable-logging" to the options of java that runs selenium-server-standalone-what.ever.jar

Resources