Random Questions

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help

Random Questions

Postby facade47 on Sun Jul 08, 2007 6:14 am

Ok, here's a couple of odd questions I've been wanting to ask for a while :P

1) Is it possible, through the command line, to send a key action? Like, if I for some reason wanted to tell the computer to do the action resulting from the keystrokes Super+C (which on my computer would pause/play the current song in amarok) ...

2) is there a way to tell the compiler (or the configure script) to use dev tools in a special folder whenever possible? For instance, I have a folder $HOME/dev and inside that folder I the folders bin, usr/bin, etc., could I tell the program to compile with its dependencies which are found in that folder? The reason I ask this is because I'm assuming that the compiled program will look for those dependency binaries in that folder, which is exactly what I want.

I hope my wording isn't too confusing :?
User avatar
facade47
Level 3
Level 3
 
Posts: 152
Joined: Fri Feb 16, 2007 4:46 am

Linux Mint is funded by ads and donations.
 

Postby Boo on Sun Jul 08, 2007 7:17 pm

1) in the old /etc/inittab file you capture the ctl-alt-delete key sequence to give the system the shutdown command. this can be very dangerous and is the first thing you comment out on a server.
so you could put a key capture in there but the new boot stuff uses upstart and the rules/files/events are in /etc/event.d/.
you can create a new inittab file and it will be used but you are better off putting it in the appropriate file in /etc/event.d/.
there is a file in there called control-alt-delete so you could create your own.

2) you could modify the configure script to point to your areas directly. some path reordering may work but not if the configure script has hard coded paths to files.

:D
Image
Now where was i going? Oh yes, crazy!
User avatar
Boo
Level 8
Level 8
 
Posts: 2364
Joined: Mon Mar 26, 2007 7:48 am

Postby facade47 on Mon Jul 09, 2007 4:09 am

Thanks for the reply, Boo =)

Unfortunately, your suggestion for (1) will not work because, looking into the file control-alt-delete, it looks like it basically says (on this keystroke){do this action}, which I can't do because I won't know what action is bound to the specific keystroke...

I haven't had a chance to try out your suggestion to #2 yet..
User avatar
facade47
Level 3
Level 3
 
Posts: 152
Joined: Fri Feb 16, 2007 4:46 am

Postby facade47 on Sun Jul 15, 2007 10:17 pm

I found the answer to my first question, but it uses java instead of bash..
Code: Select all
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;

class Main {
   public static void main( String [] args ) throws AWTException {
      Robot robot = new Robot();
      robot.keyPress(KeyEvent.VK_J);
      robot.keyRelease(KeyEvent.VK_J);
   }
}

This presses the "j" key.... now all I have to do is figure out how to set the focus to an external program :roll:
User avatar
facade47
Level 3
Level 3
 
Posts: 152
Joined: Fri Feb 16, 2007 4:46 am


Return to Newbie Questions

Who is online

Users browsing this forum: Bing [Bot], Dirkoir, Google Adsense [Bot] and 22 guests