Batch file for mouse click [closed] - command-line

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Hi I want to login to a server automatically. For that I need a batch file that will handle mouse clicks and logs into the system depending on pixels of the server. Can anyone give an example for this?
Thank you.

You can't do that in batch. Unless you are just calling a low level program in the script that does this, or P/Invoking DLL's from C# (question tagged with C#?).
If you want the server to log in automatically when it boots up, you can modify values in this registry key
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
You need to set AutoAdminLogon to 1. Then set DefaultUsername and DefaultPassword accordingly.
This batch file will set those keys (requires admin rights)
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /d "1" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUsername" /d "yourusername" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /d "yourpassword" /f

Related

How to set Registry editor to root key [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a scenario where , when I opened the regedit every time several times the registry hive must not be expanded . It should be set to root registry hive containing HKCR, HKCU, HKLM, HKCC irrespective of how many times the registry hives are opened and expanded. Can we achieve this?
The last key accessed by regedit.exe is stored on a per-user basis in:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit
In a value named LastKey. You can set it to a value of Computer to have just the root node be selected on launch.
Create a shortcut that launches a powershell script to update said key before launching regedit:
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit -Name LastKey -Value Computer
Start-Process regedit

Cannot press any key to continue with command pause

I wrote a script to remote execute test.cmd file by PsExec.exe.
PsExec.exe \\IP -u administrator -p password "C:\\Users\Administrator\Desktop\test.cmd"
Although I can run the script successfully, I cannot press any key to continue the process when it runs into command pause.
Press any key to continue . . . aaaaaa
The only way to keep going is press Enter.
Besides, if there are many lines of Pause or set /p which waits users to input, once user press Enter, it will affect couple lines of Pause or set /p. It really confuses me.
Best is that you use different logic in accordance with your limitations.
Try exchanging the Pause with a different suitable solution.
Other suggestion would be that you share your code, inputs and expectations (output is already given - the script doesn’t continue). Then someone can review the code and suggest for further steps.
Alternatively, it is also possible that you can fix it by using Console.ReadKey()

Detect when desktop is shown in a batch file

My question is, can you detect if desktop is currently visible in batch scripting(For Vista)?
The Idea is this: I'm writing a script as a prank for my friend. Some of you may heard about Weeping Angels from Doctor Who. I'm trying to make the script so that each time you return to desktop(Like minimizing something you were looking at), wallpaper changes to another
image of the angel, creating the illusion that it's moving when you aren't looking, just like in the series.
My idea for this was to detect when the desktop is not visible, and each time it became visible again, the wallpaper would cycle to the next image. Problem is, I have no idea about how to do that.
Aside from the actual question, any tips regarding the effect is appreciated.
Thank you.
Well, this isn't exactly what you asked for (not sure it is possible to detect the active window)... but it has some of the pieces you were looking for.
Basically it will change your wallpaper to one of several you have in a folder every x less than 5 minutes, where x is a random number. let me know if you have any ideas on how to change it/suggestions/questions.
#echo off
rem random number of milliseconds (0-5 minutes)
SET /A time=%RANDOM% * (300000 / 32768)
echo waiting %time% ms
PING 1.1.1.1 -n 1 -w %TIME% >NUL
echo done
rem index between 1 and 5
SET /A WALL_INDEX = %random% %% 5 + 1
rem create a folder with many wallpapers in it, and name them 1.png, 2.png, 3.png ... x.png
set WALL="C:\%WALL_INDEX%.png"
rem this is how you change the wallpaper, i stole this from some random site, but I tested it and it seemed to work... usually.
#echo off
reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "" /f
rem sets the wallpaper to the path in %WALL%
reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d %WALL% /f
reg delete "hkcu\Software\Microsoft\Internet Explorer\Desktop\General" /v WallpaperStyle /f
reg add "hkcu\control panel\desktop" /v WallpaperStyle /t REG_SZ /d 0 /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
You can do it using a Java library called Sikuli which does screen pattern matching. All you do is screenshot the desktop the exact way you wish it to appear when it causes the trigger and then set the unit test to run in a 5 second loop, always checking for the desktop to appear a certain way and then trigger the wallpaper change. So, its going to take a mix of Java/JUnit/Sikuli and batch scripting. Also, you would have to get the batch script into their startup programs list somehow.

How to find class in in eclipse? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to understand how basic things are working in eclipse in the code.
For example if I do hover on annotation or any change in the editor ( draw words )
How I can know which code of Java was called ( class.. )?
maybe could be some spy in eclipse to find code
If you have the mouse over a class type or return type for a couple of seconds the documentation will pop. If when it pops you put the mouse over it, after another second or 2 you will be able to scroll. Basically there is all the info about the class.
Some shortcuts you can use to interact with your classes are:
Ctrl + 1 - See options for a methodCall or a selected snippet of code
Ctrl + Shift + H - See call hierarchy for that method
Ctrl + Alt + T is find Type it will help you quick find it.
Shift + Alt + Q - See class outline view
For further reading you can see some of the most popular shortcuts people use.
When you practice them a bit your life will be easier.
For further reading see this link: http://rayfd.me/2007/05/20/10-eclipse-navigation-shortcuts-every-java-programmer-should-know/
If you want to find out a class declaration:
F3 (Windows)
Fn + F3 (Mac)
If you want to find a reference of a given variable in a file:
Ctrl + Shift + U (Windows)
Command + Shift + U (Mac)
If you want to find a reference of a given variable in the workspace:
Ctrl + Shift + G (Windows)
Command + Shift + G (Mac)

emacs annoying key combinations [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I do not know if this bothers you too or no. Emacs for some reason uses these key combinations. Some of them are crazy. You want to undo something, guess what! ctrl+shift+dash ! 3 keys at the same time, and sometimes they are not pressed quite simultaneously and you have to repeat it. And during this long process you keep typing some unwanted characters on the screen and have to delete them latter on etc .... or ctrl+shift+< . Undo in vim is just "u" !
I am getting tired of these combinations. But I like other features of emacs and do not want to move to vim. How do you guys deal with this problem? have you mapped the keys, or got used to emacs chord keys?
Remapping emacs native keys I guess is not a good idea for various reasons. Not sure how many people actually do it.
I've used emacs for a very long time, and except for a very few exceptions, I just learn the keybindings. It's mostly a matter of practice. On Windows, you might want to consider making CapsLock an extra Control key, which helps some of the finger gymnastics substantially. I recommend against completely redefining the standard keybindings, but if there's something you positively just hate, of course no problem to redefine it to your liking. Emacs reserves a few prefix keys (C-c for sure, and maybe some others that I can't recall right now) for user-defined key sequences.
Note also that there are sometimes alternate keybindings already defined. With respect to undo, it is also bound to any C-/ and C-x u. I personally use the latter. You can find this out with C-h k C-_. C-h k is the binding for describe-key, which tells you what any particular key sequence you type in does, and what other keys, if any, it's on.
If you're just starting out with emacs, reading the tutorial (C-h t) can be somewhat useful.
You may define your own key combinations in a .emacs file. It uses lisp language, if you don't understand it, just copy/paste existing lines.
Read this page for examples: Link
EDIT
To bind undo with Ctrl+z:
(global-set-key (kbd "C-z") 'undo)
And other useful lines:
(global-set-key [home] 'beginning-of-line)
(global-set-key [end] 'end-of-line)
I like this one too, which copy/cut/paste with Ctrl+Ins/Shift-Suppr/Shift-Ins:
(pc-selection-mode)
I most certainly rebind keys. Indeed, I think many of the default keybindings are quite useless and annoying, so when I can get it, I map 'undo' to the "undo" function key, otherwise to a short combo like Ctrl-- or something. Sinsedrix has already shown how to do persistent key rebinding.
(And don't worry too much about using nonstandard bindings. True, if someone else has to type into your editor it may slightly complicate things, but that isn't really very often. It is no way comparable to defining your own keyboard layout, like Dvorak in a QWERTY environment, which is what people usually warn against.)