.net core Linux app screw up keypad input - linux

I use PuTTY to connect to my Debian box.
If I have a console.readline I the application I cannot use the keypad to input numbers.
E.g. 1 is received as "Oq" and 2 as "Or"
Not problem using the "normal" number keys.
My .net core code:
Imports System
Module Program
Sub Main(args As String())
Console.Writeline("Please type 1 from numpad:")
Dim str as string = Console.Readline
Console.Writeline("You typed: " & str)
End Sub
End Module
Is it an issue with .net core or PuTTY?
I've tried playing around with the settings in PuTTY (Terminal\Keyboard\Function keys and keypad) but it didn't change anything.
I don't have the problem using the keypad in the shell, only in the .net core app.
If I use a keyboard directly connected to the Debian box I don't have the problem either.

Okay, I tried some different Google search approaches and this time I found something:

Related

Running 'System Events' from Excel For Mac Via VBA Results in Invalid Procedure 5 Error

I am trying to run a very simple apple script from VBA. The VBA code is:
NavigationJunk = AppleScriptTask("Budget Report Apple Scripts/NavigationMoveWindowsAppleScript.scpt", "NavigationMoveWindowLeftHandler", "")
The script reads:
on NavigationMoveWindowLeftHandler(Junk)
tell application "System Events" to key code 123 using {option down, control down}
end NavigationMoveWindowLeftHandler
where the complete path for the .scpt is: "/Users/Andrew/Library/Application Scripts/com.microsoft.Excel/Budget Report Apple Scripts/NavigationMoveWindowsAppleScript.scpt" (this is the correct path as documented here: Apple Script Task Throwing an Error 5
This code simply performs the key stroke cntrl+option+left arrow. That key stroke is a shortcut for the app Magnet to move the window to be half screen left.
This worked prior to updating my system to MacOS Ventura. I attempted to restart, uninstall Excel, reset the permissions in System Settings/Privacy/Automation (as documented here: Reset MacOS Privacy Settings) and reinstall Excel. When I tried to run the VBA code I was prompted to grant permission to system events and still received an invalid procedure error. I verified that when I call the handler from within the Apple Script Editor the system performs the keystrokes with no issues. I assume this is some sort of permission thing...How do I fix this?
Of note: this code called prior to the AppleScriptTask above runs just fine:
AppleScriptResult = Split(AppleScriptTask("Budget Report Apple Scripts/NavigationMoveWindowsAppleScript.scpt", "NavigationGetScreenResolution", ""), " ")
This is curious because the .scpt is the same file and calls a different handler:
on NavigationGetScreenResolution(Junk)
return do shell script "system_profiler SPDisplaysDataType | grep Resolution"
end NavigationGetScreenResolution
and runs just fine. Any help here would be greatly appreciated

Make terminal beep every time a node server is re-compiled & "ready" [duplicate]

I'm running a long running custom nodejs script and would like to be notified when the script is completed.
How do I make nodejs trigger the "System Bell"?
Output the BELL character (Unicode 0007) to the standard output.
console.log('\u0007');
Update 2023
Solution above doesn't work anymore, but writing directly to stdout still works (tested on Node.js v14.20):
process.stdout.write('\u0007');
References
ASCII/ISO 8859 (Latin-1) Table
Unicode Characters: 00000 to 000FF
The Open Group Base Specifications Issue 7: Portable Character Set
Programming with Unicode Documentation (unicodebook.pdf)
How a bullet turns into a beep – The Old New Thing
Unicode 10.0.0 Final Names List
The console.log('\u0007') didn't work for me running VSCode on windows 10.
The following code did work:
import { exec } from 'child_process'
exec(`rundll32 user32.dll,MessageBeep`)
I know this question is tagged unix, but I found it from Google so here is a Windows PowerShell solution.
The current answer works fine in Windows, but I wanted something a bit more unique than the standard Windows tone so this worked better for my needs:
const { exec } = require('child_process');
// Single beep
exec("[console]::beep(1000, 500)", {'shell':'powershell.exe'});
// Multiple beeps
exec("1..3 | %{ [console]::beep(1000, 500) }", {'shell':'powershell.exe'});

Problem communicating with 3rd party apps via VBA on Mac M1

I have created a VBA add-in for Microsoft Word. Both a Windows and Mac version. The add-in communicates with 3rd party apps.
This has worked fine for years. I'm now struggling making this work for the Mac-version with M1-based macs (Maybe also Big Sur related).
The communication works partly via a dylib written i c, via stdin and stdout.
Secondly some functions use AppleScriptTask.
I can't make either of these two methods work.
AppleScriptTask always return the error:
Run-time error '5'
Invalid procedure call or argument
VBA-code:
s = AppleScriptTask("WMscript.scpt","Test","")
I tried scripts with .scpt, .scptd and .applescript.
Also newly created scriptfiles with simple test.script:
on Test(paramS)
tell application "Finder"
activate
end tell
end Test
The api works in other applications, but I can't open 3rd party apps in it when used from VBA.
I use these special folders for the all the 3rd party files to circumvent sandboxing for both methods:
/Library/Application support/Microsoft/Office365/User Content/Add-ins/
~/Library/Application Scripts/com.microsoft.word/
~/Library/containers/com.microsoft.word/Data/
I also tried the GrantAccessToMultipleFiles(FileArray) function. It always returns 'True' regardless which filenames are sendt in the array. It never prompt the user.
Running:
M1 Mac
Big sur 11.6 (M1)
Microsoft Word for Mac 16.54 (21101001)
Not sure following will help you.
If your third-party application is from unknown developer, then it goes to GateKeeper quarantine. Try to remove quarantine before calling your VBA script, running following script.
set theApp to application id "Avidemux.org" -- EDIT here the bundle ID
set quotedPath to quoted form of (POSIX path of (path to theApp))
do shell script "xattr -rd com.apple.quarantine " & ¬
quotedPath with administrator privileges
You can include the code above to beginning of your VBA script.
The ApplceScriptTask problem was related to an incorrect path, for the script file:
Incorrect: ~/Library/Application Scripts/com.microsoft.word/
Correct: ~/Library/Application Scripts/com.microsoft.Word/
Had to be Uppercase W.

Using VLC player activex within excel vba as a registration-free COM

Problem definition
I have two usb microscope reading part and serial numbers.
I want to control the display and recording of screen shots from Excel-VBA.
I would like to try this using the supplied VLC active X component.
I need the finish product to be a single zip that does not need to be installed.
I think using this activex object as a registration-free COM is the way to go.
References
I have been doing my homework, here are my references.
How to use vlc.dll without registration?
Registration-Free COM Interop
VLC Player and Excel Visual Basic Editor
Cannot get registration-free COM working from VBA
My attempt so far.
I created
Desktop\excel vlc demo\excel vlc demo.xlsb
I then copied the entire vlc distribution to Desktop\excel vlc demo\vlc\
This includes axvlc.dll and axvlc.dll.manifest
I created a module and put this code in.
Sub VLC()
Dim actCtx As Object
Set actCtx = CreateObject("Microsoft.Windows.ActCtx")
actCtx.Manifest = ThisWorkbook.Path & "\vlc\axvlc.dll.manifest"
Dim myVlC As Object
Set myVlC = actCtx.CreateObject("AXVLC.VLCPlugin2")
myVlC.Visible = True
myVlC.playlist.Add (ThisWorkbook.Path & "\demo.mov")
myVlC.playlist.Play
End Sub
This fails at the line
Set myVlC = actCtx.CreateObject("AXVLC.VLCPlugin2")
with error
Run-time error '429':
ActiveX component can't create object
It is possible I have the wrong object name "AXVLC.VLCPlugin2", I could not confirm if it is still valid in the documentation.
It could also be that "user1610015" is correct in saying that "I don't think you can make reg-free COM work in this case"
At this point I am out of ideas, I never tried reg-free COM before so I don't know if I'm doing something wrong with the reg-free COM or the axvlc part !
thanks
EDIT 1: Attempt with early binding
I went in tool -> references, then clicked browse and added the axvlc.dll file.
I modified the code as follows (the AXVLC.VLCPlugin2
part auto-completed so at least this part should work)
Sub VLC()
Dim myVlC As New AXVLC.VLCPlugin2
myVlC.Visible = True
myVlC.playlist.Add (ThisWorkbook.Path & "\demo.mov")
myVlC.playlist.Play
End Sub
However this fails with the same error
Run-time error '429':
ActiveX component can't create object
on the line
myVlC.Visible = True
Perhaps I also need to register this file with regsrv32 ?
EDIT 2: tried regsvr32
ran this command from the vlc subfolder
regsvr32 axvlc.dll
I got a msgbox saying this command ran successfully, however I get the same error.
I had problems using VLC with Excel inserting vlc player onto a sheet and form.
It worked last year...
the "VLC Activex Plugin...." was not in the additional controls box to select.
Registering the dll was successful but still did not work.
Then I remembered i upgraded VLC to new version and 64Bit
I uninstalled VLC 64
and installed new version 32 bit
the "VLC Activex Plugin...." was Now in the additional controls box all good

Why can my VB6 app not open the "Open" dialog on some systems

I have a VB6 application that, despite everything manages to work on lots of systems, including the numerous Windows 7 x64 systems.
On most of them, the windows dialogs accessed through COMDLG32.OCX work just fine. However, on one particular system, this doesn't work at all. Some forms, when attempting to show the "Open" (or "Save") dialog causes an exception:
Run-time error '32765'
The common dialog function failed during initalization. This error often occurs when insufficent memory is available
Although some other forms that use it simply never show the dialog box at all. Needless to say, memory is not an issue. Microsoft have a kb article on the error where they say:
You have a Microsoft Visual Basic 6.0 program that runs on a Terminal Server, the program uses the Common Dialog control to open a file, and the following conditions are true:
The user is using a roaming profile.
There is a policy to delete the roaming profile when the user logs off.
When these conditions are true, you may receive [the error quoted above]
The conditions mentioned are not true - this is all through the (only, local) user on the system. The suggested solution involves calling the relevant API calls directly.
Reluctant to implemenet the pile of code suggested in every form relevant, I found a class already built for the purpose - CDlgEx. While this works fine on all the computers where the OCX also works fine, on the system which has problems, whenver this line is reached:
RetValue = GetOpenFileName(OFN)
where
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
and OFN is of the private type expected by the function, nothing happens. No dialog box appears, and the program simply moves on to the next line.
Further testing has shown that this only happens when running from the IDE. Running from a compliled executable, everything is fine.
Had the exact same problem. Grab the cCommonDialog class from the following link and add it to your project.
https://github.com/ziggythehamster/ignitionserver/blob/master/vbtracer/cCommonDialog.cls
You can then do something like this in your code
Private Sub Command1_Click()
Dim commonDialog As New GCommonDialog
Dim fileName As String
commonDialog.VBGetOpenFileName fileName
MsgBox fileName
End Sub

Resources