How to hide console window while executing perl.exe? - nsis

My installer is showing a command prompt window with the process ID while executing perl.exe.
I want to block it from being displayed.

Add this awesome snippet at the bottom of your code
BEGIN {
Win32::SetChildShowWindow(0)
if defined &Win32::SetChildShowWindow;
}
Original source:
http://samdelacruz.blogspot.com/2007/12/hide-console-windows-in-perl.html

I assume you mean that it is displaying a console window...
You can use the nsExec plugin to hide the console window. If you need more control (stdin etc) you can download ExecDos and/or ExecCmd from the wiki...

Related

My node.js code in running in VS code but not showing any output in terminal, it is only showing 'code is already running'

Here is the image of my vs code and the code what I've written
The problem is that you are running your code with an extension and are trying to find the output in the terminal where you did not start the program.
Click on the drop-down menu in the nav-bar above your terminal where it says "powershell" and try switching terminals to see which one shows the output.
Try exploring the different tabs in the nav-bar as well, especially the Output tab.
(This should be a comment but unfortunately I do not have enough reputation to comment)

applescript display dialog with custom icon

Is there a way to use custom icons with applescript display dialog and notifications?
In the AppleScript documentation it says about the display dialog:
with icon (text | integer)
The resource name or ID of the icon to
display.
with icon (stop | note | caution) The type of icon to show.
You may specify one of the following constants:
stop (or 0): Shows a stop icon
note (or 1): Shows the application icon
caution (or 2): Shows a warning icon, badged with the application icon
with icon (alias | file) An alias or file specifier that specifies a .icns file.
So it seams like you can use your own icons, but I cannot get the following code to work.
display dialog "Text" with icon "/Users/user/Desktop/asd.icns"
It gets me the following error: "Resource not found."
The goal is to not even use a display dialog, but a display notification instead.
First of all you can't display a custom icon with display notification. The reason is that notifications are strongly related to a target application. As AppleScript scripts and applets aren't applications in terms of the Notification framework, the notification is related to the current application, the AppleScript Runner.
But you can display a custom icon with display dialog
The line
with icon (alias | file) An alias or file specifier that specifies a .icns file.
means what it says: The parameter must be an alias or file specifier rather than a POSIX or HFS string path.
Either
display dialog "Text" with icon alias ((path to desktop as text) & "asd.icns")
or
display dialog "Text" with icon file ((path to desktop as text) & "asd.icns")
path to desktop as text represents the HFS path to the desktop of the current user:
"Macintosh HD:Users:user:Desktop:"
Noted this question was three years ago, but I stumbled across this looking for a solution to a similar problem. Mine needs display alert rather than ... notification but the problem is the same because display alert doesn't have a custom icon option.
As noted in the other answer here, AppleScript has at least three interactive message type commands: display dialog, display alert, display notification, and probably others. It seems odd that only the first has the option to add a custom icon. I don't really understand why that is when it would be simple to make them consistent.
Needless to say, this question and #vadian's answer, inspired my solution - a "duh" moment for me once I realized it. It may or may not be a solution to this question. Posting it in case it is...
If the icon in question belongs to an app, you can tell that app to display the notification, regardless of whatever else your script is doing.
Your script can do whatever it needs to do to whatever other apps, or System Events, or itself (if your script is saved as its own application), or whatever else. In the middle of all of that you can have a single line that says:
tell application "MyApp" to display notification ...
The notification will have My App's icon, the result of the notification if any will be returned to the rest of the script and then your script will continue on inside whatever other tell statement or context its in.
If your icon isn't the icon for an app, then I believe there are ways to create an empty app with whatever icon you like, which can behave this way. Admittedly that's a bit of a kludge, but depending on how badly you want this, it's an option - though not one I'll expand on here.
My specific case in detail if interested (but doesn't particularly add to the solution above, just covers how I got there):
I'm writing a script that quits and re-opens another application after confirmation from the user. However, let's say I just wanted to provide a notification as per this question.
Options:
1. display dialog - has the option to provide a custom icon but lacks features of the other two options.
2. display alert - no custom icon but has other desired features, in my case the message parameter which adds extra smaller explanatory text below the primary text.
3. display notification - no custom icon but has other features as desired by this question's poster.
In my case I want alert because I want that extra message parameter (but this works for notification as well).
In my case, ideally the icon of the alert would be the icon of the app I'm restarting, but I can't tell the app itself to display the alert and then restart because the script loses connection with the app when it quits and it kills the running of the script.
If I tell System Events or the script itself to do all that then it can quit and reopen the app independently of the app, but the alert has the generic icon of itself or the System Events icon.
However, if I do what I described above - have my script do all its stuff, but have it tell the app in question to display the alert (and only that as described above), then the alert has the icon of the app in question, but the script still does its stuff independently of the app outside of that alert.
Solved my problem. May or may not solve this question.
#DavidT's answer is a perfect solution when your script is controlled by another application. However, things have changed a bit on Mac OS since.
Notably, if you run your script with tell application "MyApp" to display alert ... you will be promoting the user to give your app permissions to control itself, at least starting since Catalina. Not only this annoys the user with a new permission request, but it also looks kinda dumb since the dialogue is asking the user to allow "MyApp" to control "MyApp" and if the user denies it, your script will fail.
To avoid the permission request, just use tell me to display alert ... this will work just fine.
Another issue you might run into is that osascript may throw an exception if your script is launched as root. I found a nice workaround for that here.
This is a small example of how to launch the dialogue with the right user:
uid=determineUserIdFunction(...)
launchctl asuser $uid /usr/bin/osascript <<-EOS
tell me to display dialog "Now you see me" buttons {"OK"} default button 1 with title "WARNING!"
EOS
You have your path specification wrong. If you have a posix path to your icns file, use the POSIX file class coercion:
display dialog "Text" with icon POSIX file "/Users/user/Desktop/asd.icns"
This coerces the string path into a file reference the system understands, and works just fine.

Recall previous command in the RubyMine console

In the RubyMine consoles, like the one that appears in RubyMine 7 while debugging, how do you recall the previous command or line you typed? Something similar to pressing the up arrow in a conventional terminal or console.
The history of commands can be accessed similar to any conventional terminal or console :- using the up and down arrows to scroll through the history.
The commands history size limit can be specified in : File|Settings|Editor - "Console commands history size"
Scrolling through console history with the up key in any command line environment can be pretty tedious. option-command-E, can show you your entire commands history.
Looking into RubyMine 7.0 Doc
https://www.jetbrains.com/ruby/webhelp/using-consoles.html
In an interactive console, you can:
Type commands in the lower pane of the console, and press Enter to
execute them.
Results are displayed in the upper pane. Use basic code completion
Ctrl+Space.
Use Up and Down arrow keys to scroll through the history of
commands, and execute the required ones.
Load source code fom the editor into console.
Use context menu of the upper pane to copy all output to the
clipboard, compare with the current contents of the clipboard, or
remove all output from the console.
Use the toolbar buttons to control your session in the console.
Configure color scheme of the console to meet your preferences.
Refer to the section Configuring Color Scheme for Consoles for
details.

Shortcut for reload jscript file

I am using notepad++ for jscript file editing and TestComplete for automation testing which uses the JScript files, but every time i exit and start the TestComplete whenever i change anything in Jscript file.
is there any short-cut-Key to reload without closing the TestComplete.
So, you are creating a script extension. Thank you for clarification. I have checked the Tools | Customize Keyboard... dialog and there is no a possibility to assign a shortcut to the Reload Script Extensions action. So, you can do this only by manually clicking the Reload button in the Script Extensions dialog. The Alt-F-E shortcut just opens this dialog (File | Install Script Extensions...).
http://www.philnicholas.com/2009/05/11/reloading-your-javascript-without-reloading-your-page/
This page explains what you're looking for, I think. All you need to do is change the event to when ur shortcut key is pressed.

Does endwin() de-initialize ncurses?

I am using the ncurses library to show some funny output on the screen, but in the middle of the program I need to temporarily exit ncurses mode. I call endwin(), after which my program should be able to use printf() to show a menu to the user. Unluckily, my program was unable to show the menu. I tried using fflush() after printf(), and only then is it able to show the menu on the screen.
Can anyone tell me why, after I call endwin(), the terminal can't return to normal and I'm unable to use printf()?
Use def_prog_mode prior to endwin to save state.
After returning, do: reset_prog_mode and then refresh.
Your original screen will be shown.
Yes, after using printf you have to do: fflush(stdout).

Resources