VBScript - create button in the notepad window - vbscript

Using VBScript, I want to add an additional button to Notepad labeled “send” . The send button should be located near the help menu in the Notepad window
Please advise if it is possible to add a button inside Notepad. And if it possible then how can I create the button using VBScript?
Note - why I need to add the send button: The purpose of the send button is to send the file opened in Notepad to a remote Linux machine over the network.

This is not possible with VBScript. You could possibly manage to add the button, but you couldn't hook anything to respond to it being clicked.
You could probably hack something together using the native Win32 API, but it's more work to do that than it would be to write your own simple editor in any other language and use it instead of Notepad. (Notepad is simply a thin wrapper around a multiline edit control provided by the Windows API.)

It's Impossible via VBScript but with help of more serious languages like c# or c++ freely:
for example see project of my friend:
http://www.codeproject.com/KB/COM/automatingwindowsapps.aspx

Related

GUI adapter for old DOS application

I have an old DOS application which accepts some files as input, does some calculations and saves results into file system. This app uses terminal as sort of GUI, where you can choose input files, types of calculations to perform and choose where to save the result. I don't know the logics behind calculations and am not able to reuse them in a new project.
The problem is that the users of this app want a modern looking GUI which will be easier to work with.
That is why, I have an idea to create an adapter which will translate button clicks into commands in DOS and grab text output to show in modern GUI.
Is it possible and where should I start from?
It is possible. How to start from depends on your programming Tools. If you use a RAD tool like Delphi or Lazarus or Visual Besic or ... then make your GUI design first and define Events after. For a Button click it is ButtonXClick(); In the RAD tool you will find a object inspector with properties and ther values and Events and their values. Go to Events page there, look for onClick-event. Double click there in the value line and you will get an empty Event handler, wehre you can write your Code for your application.
If you dont have or use such RAD tool, take a GUI Framework for DOS. Create your frontend and write your Code which is to call in Dependance of your button clicks.

read/capture Windows pop-up message in vb6?

Problem: Need to read/capture the text of Windows pop-up messages that is generated by non-VB applications.
Situation:
I've a VB6 app, part of which requires processing an excel workbook. A non vb-6 pop-up window (as attached screen) "FILE CONVERSION IN PROGRESS" comes up, while opening an new version of excel-sheet from an old MS Excel app. And automatically it closes alos.
Requirement: I want to capture that pop-up occurance in the code. And then write a conditional statement code for the 'cancel' button click event of that non vb-6 pop-up.
Can anyone suggest something?
You can access other applications with the following APIs:
FindWindow() to locate the main window of what you're looking for
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx
GetWindow() to navigate through the HWNDs of the application so you can get to the button
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx
GetWindowText() to access the text from a control (it cannot be an Edit control)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633520%28v=vs.85%29.aspx
You'll want to use Spy++ (which can be downloaded) to see what the class name you're looking for when it comes up and to figure out the hierarchy to navigate properly.
You'll need to use the API Text Viewer to get the API declarations so you can use them in VB6 properly.

Dialog Box Using VB Script

Hello I have some knowledge about VB Script, but i need some help so that it will help me to move further and study in VB Script.
I want to make dialog box which will contain :
Two radio button
one Text field to enter some value
OK and CANCEL button
so, could you please help me out?
VBScript doesn't support custom dialogs. You can either use the Internet Explorer COM object to emulate a dialog, or create an HTA. Either way you're building a web page with a form.

Assign VBS Script to a Keyboard Shortcut

I have a very basic VBS script that I plan on using frequently on my Windows 7 machine. Is there any way I can bind it to a keyboard shortcut so I don't have to navigate to it through Explorer obnoxiously.
I realize this question does not directly pertain to programming, or even scripting for that matter, but I could not find a straight answer online or through my own experimentation. I'm sure that there is a simple solution somewhere...
Thank you for taking the time to read, and hopefully respond to my inquiry.
Evin Ugur.
Windows does have built-in support for shell shortcut keys, where a keypress is used to invoke an *.lnk file that launches your VBScript (using either cscript or wscript).
Create a shortcut file, have it invoke your VBScript file directly or run cscript or wscript with the appropriate arguments, then save it and open its Properties sheet and set a keystroke in the "Shortcut key" field (I suggest something like Ctrl+Alt+K).
Like so:
Then, whenever you press Ctrl+Alt+K, regardless of the active application, your script will be invoked.
A more heavy-duty alternative is AutoHotKey: http://www.autohotkey.com/
Just as an FYI.
I tried this and I was not able to register the hotkey when I had the Icon in a costume folder. Even if I added the hotkey, it failed to work.
Once I moved the icon to the "C:\ProgramData\Microsoft\Windows\Start Menu\Programs", the hotkey started to work.

Command line in Visual Studio - how to close popup window?

I have situation like below.
I'm running some command and then I get a popup with Y/N answer. Is there a possibility to force answer Yes and automatically close the window through command line?
If you want to click a button in an external window, you'll need to hook the window with the button exposed. You can accomplish this by grabbing the window handle via FindWindow, finding the child button, and sending a BM_CLICK with an API call via SendMessage.
you mean a command window within VS ? I don't think there's anything generic, you could run all sorts of things, depends on what your command is - and how much control over it you have - maybe some example of what you're trying to do could help. 'picking' the window will work but depends again on what you're doing, how custom it is etc.

Resources