Tuesday 8 April 2014

xdotool Simple example

xdotool
used in Debian wheezy7,Lxde,openbox;

" What is xdotool? 

This tool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's XTEST extension and other Xlib functions.
Additionally, you can search for windows and move, resize, hide, and modify window properties like the title. If your window manager supports it, you can use xdotool to switch desktops, move windows between desktops, and change the number of desktops. "
                                     -http://www.semicomplete.com/projects/xdotool/
tl;dr
xdotool helps you to automate mouse and keyboard events.

Use cases
# you name it

Example
for example i want to disable my touch-pad on my laptop when im using mouse,so i can  write script to dot it,rather than going and selecting gpointing-device-settings then clicking disable touch-pad .

Steps
#1- download and install xdotool using synaptic package manager or which ever you use.[and gpointing-device-settings if dont have ]

#2-open terminal type "xdotool getmouselocation" ,this returns mouse location in x y coordinates.
#3-open terminal type "/usr/bin/gpointing-device-settings",this opens gpointing-device-settings 

#4-now using step2 check the coordinates of touch-pad button in gpointing-device-settings[make sure to keep the cursor on the touch-pad button and if you cant keep the terminal window active,right click the window title bar and select Layer>keep alawys on top, then move the cursor to the according location]

#5 repeate step4 and location of the following part

#step6-do the same to find xy coordinates of "ok"button

#step7-open texteditor and write the following

#!/bin/bash
/usr/bin/gpointing-device-settings &  
sleep 1
WID=`xdotool search "GPointing Device Settings"` &&
sleep 1
xdotool windowactivate --sync $WID 
sleep 1
xdotool mousemove 451 251 click 1
sleep 1
xdotool mousemove 567 213 click 1
sleep 1
xdotool mousemove 567 213 click 1
sleep 1
xdotool mousemove 912 589 click 1

#step8-save it as touchpadcancel.sh
#step9-Run it[change the files properties to change it to "make it executable",if it cant run by default]
#step10- DONE

Explanation of code
/usr/bin/gpointing-device-settings
>opens gpointing-device-settings
sleep>stop the code execution,so the following code is executed 1by1.

xdotool search "GPointing Device Settings"

>serach for window with tiltle GPointing Device Settings

xdotool windowactivate --sync $WID
>makes the window with title "GPointing Device Settings" active 
xdotool mousemove 451 251 click 1
>move the cursor to x:451 and y:251 and click at the coordinate 














Thursday 19 July 2012

Methods to Hide Files

Today I am writing about hiding files in windows. Hiding? it is very easy huh then why this article?. No it is easy to hide but not to get caught matters. Here i discuss three methods to hide.

-Usual Hiding.
-Super Hide.
-Hiding File inside a image.

Here i will start with simple type hiding to better one.

1)Hiding a file right clicking its property and setting attribute to hidden.
     But if someone enables show hidden files in folder option everyone can see the files.Not a great idea right.

2)Super Hide 
   As the name says it is super hidden.

   Step 1- Locate your file. In this tutorial i will use FileToHide.txt located in my E:/pictures/  as demo.Keep in mind that the file name doesn't contain any spaces.
   

   Step 2- Open Command prompt by typing "cmd" and clicking "OK" in run.
    Step 3-Type following command in command prompt and hit enter.
    attrib E:\Pictures\FileToHide.txt +s +h +a
      Replace bold words with your corresponding file name and location.


     You can even hide the entire Folder also.
    
     Observe the magic yourself. Now even anyone enables show hidden files  in folder option the file will not be seen anywhere.
     Inorder to make the file visible repeat the command in command prompt by replacing "+" with "-" ie.
     
     "attrib E:\Pictures\FileToHide.txt -s -h -a"
     

     The drawback of this method is someone disable "Hide protected windows file" feature in folder option the file will be displayed.

3)Hide file inside a picture.
   In this method you have to "zip" or "rar" the files you have to hide. You may need winRAR ir winZip.
   Here i use FileToHide1.txt and FileTohide2.txt and image named Picture.jpg located in E:\Pictures\Hide as demo. 

   Step 1) Copy the files you want to hide and a picture in one folder.
   Step 2) Compress the file to one achieve using  winZip or winRAR and name it Hide.rar.
   Step 2) Open cmd as mentioned above.
   Step 3) Type the each following command and hit Enter.
                E:\
                cd pictures\Hide
                copy /b Picture.jpg + Hide.rar Picture.jpg
  
Step 4) Delete all other files in that folder other than the .jpg file.  
Now your file is Hidden inside a picture. Nobody is going to catch you. If you want to see the file right click on that image file and select open with winRAR or winZip, your files will  be listed there. 
Great isn't it.
          

Tuesday 19 June 2012

Turbo C++ for windows 7(Full screen)

I have heard people (mainly students)  complaining about installing Turbo C++ on their windows 7 machine. Since i used to code using devcpp I never encountered such a problem.

There is two results that you get after installing Turbo C++ on your window7. That is you will be unable to switch your Turbo C++ to full screen if you are running Windows 7 on 32-bit processor. And for those who run Win7 on 64-bit processor you wont be even able to run it.


ERROR IN 64-BIT
NO FULLSCREEN ON 32-bit


So here are some simple steps that you can get rid of those two problems i mensioned.

Step 1:-Download Turbo C++ FROM HERE and extract it to C:\TC. ie all the file in tccp3.zip should be in C:\TC. 
Step 2:-Download and install Emulated Turbo C++ and install it.
Download Link: Click Here
Password : "mohitsaxena"
Installing is very easy just click few NEXT then FINISH DON'T CHANGE ANY DIRECTORY .
Step 3:-After successful installation open Emulated Turbo C++ from desktop shortcut. 
YOU'RE DONE