Computer Hope

Microsoft => Microsoft DOS => Topic started by: dhrunil92 on September 09, 2016, 07:07:11 AM

Title: Copy passowrd from text file to softwares
Post by: dhrunil92 on September 09, 2016, 07:07:11 AM
I am using xcopy to copy paste files from one location to another.

but i want to make batch file which can copy paste passwords to the software from text file and open software for me on one click.

i have to open 10-15 softwares in the morning to do different different task. so i am looking out to try something which can do that for me on one click so til that time  i can do some other work and save some time.


if anyone can help in making this it would be greatfull.

thanks in advance.
Title: Re: Copy passowrd from text file to softwares
Post by: DaveLembke on September 09, 2016, 09:02:50 AM
You would need a batch file that triggers program to start and then triggers a keyboard macro... but this would require you to launch the program and then not mess with keyboard for a specific period of time to avoid interfering with the keyboard macro. I'd buy Jitbit Macro creator and this way you can make your own macros and keep passwords private. You can make macros easily and compile them as EXE's to be run specifically or called at the Start of the system boot or add them to a batch. Redundant activities can also be automated with the jitbit software. I LOVE this software, its saved me from hours of work as well as from having to write a program solution from scratch, why reinvent the wheel when a rube goldberg method works and is fast to implement. Even used it was the means of getting called to problems when using this with alert ping pro and other monitoring software with a shoretel phone system to have a system I made call me and tell me by voice over the phone where the network or system is in trouble for a small food store chain that i use to be system admin for. So that as the problem is detected I am able to act on it and minimize down time.  ;D


https://www.jitbit.com/macro-recorder/
Title: Re: Copy passowrd from text file to softwares
Post by: Squashman on September 09, 2016, 01:32:16 PM
Batch files cannot interact with programs like that.  You could in theory use a Vbscript and use the sendkeys method.

Here is an example of opening Notepad and typing Password into Notepad.
Code: [Select]
set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run ("%windir%\notepad") 'Program to open
WScript.Sleep 1000

WshShell.AppActivate "Untitled - Notepad" 'Window Title of Program

WshShell.SendKeys "Password{ENTER}" 'Your password to send to the program
Title: Re: Copy passowrd from text file to softwares
Post by: Lorraine walsh on October 06, 2016, 05:17:44 AM
For that you'll need to create commands for a batch file, and there is no need for nay specialized software for that. You can create that on Notepad Once we’ve finished inputting our commands, we’ll head to Save As, and give the file an appropriate name. Once saved, we can change the file extension from .txt to .bat, and press Enter. For instance, if I want to launch Chrome, a Word file I’m working on, and Media Player, the command would be like:

@echo off
cd "C:\Program Files\Google\Chrome\Application\"
start chrome.exe
start – "C:\Program Files\Microsoft Office\Office15\WINWORD.EXE"
"C:\Work\MUO\How to Batch Rename.docx"
cd "C:\Program Files (x86)\Windows Media Player"
start vmplayer.exe
exit
Title: Re: Copy passowrd from text file to softwares
Post by: Squashman on October 06, 2016, 06:18:17 AM
For that you'll need to create commands for a batch file, and there is no need for nay specialized software for that. You can create that on Notepad Once we’ve finished inputting our commands, we’ll head to Save As, and give the file an appropriate name. Once saved, we can change the file extension from .txt to .bat, and press Enter. For instance, if I want to launch Chrome, a Word file I’m working on, and Media Player, the command would be like:

@echo off
cd "C:\Program Files\Google\Chrome\Application\"
start chrome.exe
start – "C:\Program Files\Microsoft Office\Office15\WINWORD.EXE"
"C:\Work\MUO\How to Batch Rename.docx"
cd "C:\Program Files (x86)\Windows Media Player"
start vmplayer.exe
exit
I fail to see how your code could send a username and password to another application.
Title: Re: Copy passowrd from text file to softwares
Post by: Geek-9pm on October 06, 2016, 09:07:32 AM
This may help:
http://www.computerhope.com/tips/tip209.htm
Quote
Autohotkey is a free and powerful tool that allows you to automate almost anything on your Windows computer in any program. Computer Hope uses this tool daily to help answer common questions asked in e-mail quickly and perform other common repetitive tasks. If you do anything daily that requires you to repeat the same actions, we highly recommend using this tool. This page demonstrates some of this programs capabilities.
Auto Key is also a macro language. I can be edited to automate almost any teaks that you would otherwise do with a keyboard.
Also, Auto Key has given rise to other alternative programs with more features. But Auto Key is free and has a support community.
It is not a DOS program. It integrates into Windows.

Title: Re: Copy passowrd from text file to softwares
Post by: foxidrive on October 06, 2016, 11:20:01 PM
Geek, your speech-to-text converter used "Auto Key" for autohotkey.
Title: Re: Copy passowrd from text file to softwares
Post by: Geek-9pm on October 07, 2016, 08:05:52 AM
Sorry, it should be autohotkey. (Just ordered a new microphone.)
The web site is:
https://autohotkey.com/
It has been around a long time. Still, many have never yet tried it.
The article in Wikipedia describes the origin and history.
https://en.wikipedia.org/wiki/AutoHotkey
Quote
AutoHotkey is a free, open-source custom scripting language for Microsoft Windows, initially aimed at providing easy keyboard shortcuts or hotkeys, fast macro-creation and software automation that allows users of most levels of computer skill to automate repetitive tasks in any Windows application. User interfaces can easily be extended or modified by AutoHotkey (for example, overriding the default Windows control key commands with their Emacs equivalents).[3] The AutoHotkey installation includes its own extensive help file with an always updated web-based version.[4]

We are in the DOS forum. Doing such a thing in DOS is near impossible.
Autohotkey is the best choice for the problem the OP presented.   :)
Title: Re: Copy passowrd from text file to softwares
Post by: foxidrive on October 08, 2016, 03:18:56 PM
Sorry, it should be autohotkey.
The web site is:
https://autohotkey.com/ (https://autohotkey.com/)
It has been around a long time. Still, many have never yet tried it.

I learned about it by reputation but only started to use autohotkey myself a year or so ago. 
It's the best thing since sliced bread and is an inportant tool in my computing now.

I make my words highlighted in colour using autohotkey.

I also add
Code: [Select]
code blocks using autohotkey, and a swag more things.



For anyone interested in trying autohotkey:
my autohotkey.ahk file contains things like these shown in the code block below:

The first line is triggered by typing .au and pressing enter.     The parts after the second :: are typed in for me.
I use it in a web browser when searching google for items in Australia and then use it as the last search term and away it goes.

The .dt is used in a similar way to search for keywords on dostips.com
Typing .e on the command prompt shows me the errorlevel.
The .p is to add a way of debugging a section of code - to pause and then exit the code I am testing.

I use a period as a leading character to trigger my hotstrings in this way but the period doesn't have to be part of your hotstrings.
The next set of lines have a * and which makes the hotstring trigger without the need to press enter.


When I type .fc it types a codeblock keyword and puts the cursor back to the place where I can paste my code straight into the codeblock.

I use the .f prefix as a way to remind me that these terms are used on a forum and then the c added on reminds me that it is to type a codeblock for me.

To edit my autohotkey.ahk file so I can add or change things I press Windows key and Z.
Autohotkey is powerful magic in my computing these days.


Code: [Select]
::.au:: site:au
::.ms:: site:microsoft.com
::.dt:: site:dostips.com
::.p::& pause & goto :EOF
::.e::echo `%errorlevel`%
:*:.fs::findstr  /?|more&pause
:*:.rc::robocopy /?|more&pause
:*:.fc::{left 7}

To type a hotstring term like .au itself; I type . au and then remove the space.

There's a forum glitch with BBcode control characters that is corrupting my sample autohotkey code
so I attached it with a .txt extension added.

[attachment deleted by admin to conserve space]
Title: Re: Copy passowrd from text file to softwares
Post by: foxidrive on October 08, 2016, 04:27:47 PM
I obviously didn't include my code to give the winning lottery numbers, or to find out the password for your wife's secret bank account, but there are a number of other things I use autohotkey for.
Title: Re: Copy passowrd from text file to softwares
Post by: patio on October 08, 2016, 07:36:58 PM
My wifes account ain't much but i'll take the Lotto code if you like...
Title: Re: Copy passowrd from text file to softwares
Post by: foxidrive on October 08, 2016, 10:18:05 PM
I am using xcopy to copy paste files from one location to another.

i want to make batch file which can copy paste passwords to the software from text file and open software for me on one click.

i have to open 10-15 softwares in the morning to do different different task.


I hijacked your thread a little, sorry, but see below:

Using autohotkey then you can start programs like this. 
The exact commands to paste the password depend on the program you are using and what keystrokes are needed to focus the place to type the password.

This example starts each program and then types a password using names of fruit.

It adds a 2 second delay to allow the program time to load and initialise but a slower computer might need 4 or 6 seconds.
2000 miliseconds is equal to 2 seconds.


The hotkey to launch it is Windows key and F12.

Code: [Select]
#F12::
run, "c:\program files\programA\program1.exe"
sleep 2000
sendinput apple
sleep 2000

run, "c:\program files\programB\program2.exe"
sleep 2000
sendinput passionfruit
sleep 2000

run, "c:\program files\programC\program3.exe"
sleep 2000
sendinput strawberry
sleep 2000

run, "c:\program files\programD\program4.exe"
sleep 2000
sendinput mandarine
sleep 2000

run, "c:\program files\programE\program5.exe"
sleep 2000
sendinput grape
sleep 2000

run, "c:\program files\programF\program6.exe"
sleep 2000
sendinput loganberry
sleep 2000
return


As an example of making autohotkey type on the keyboard:

the line below uses the tab key 8 times, presses enter, then tab another 5 times and presses enter again.
It types the word mypass amd presses enter once more.

Code: [Select]
sendinput {tab 8}{enter}{tab 5}{enter}mypass{enter}
Title: Re: Copy passowrd from text file to softwares
Post by: foxidrive on October 08, 2016, 10:56:42 PM
My wifes account ain't much but i'll take the Lotto code if you like...
Sure thing!  Have you got a TARDIS type 40?  It needs one to run the code....
Title: Re: Copy passowrd from text file to softwares
Post by: patio on October 09, 2016, 07:00:16 AM
The PSU on it doesn't work...
Title: Re: Copy passowrd from text file to softwares
Post by: foxidrive on October 09, 2016, 10:16:11 AM
The PSU on it doesn't work...
Bugger.  They are almost as unreliable as the chameleon circuit on those old type 40's.    :||x
Title: Re: Copy passowrd from text file to softwares
Post by: patio on October 09, 2016, 10:45:49 AM
You would think with something that advanced they wouldn't scrimp on important components.....
Title: Re: Copy passowrd from text file to softwares
Post by: foxidrive on October 09, 2016, 12:11:10 PM
You would think with something that advanced they wouldn't scrimp on important components.....

True dat.  Gallifrey's version of cheap Chinese components is probably the bugbear.
Title: Re: Copy passowrd from text file to softwares
Post by: patio on October 09, 2016, 04:08:29 PM
Shame is the *censored* thing worked so well when i 1st got it...