Author |
Message |
chipanpriest
![](http://compsci.ca/v3/uploads/user_avatars/2500543034edeb81cb83e9.jpg)
|
Posted: Thu Jan 19, 2012 1:23 pm Post subject: No Window |
|
|
What kind of command would I use if I wanted the program to run but no window to open? I want absolutely nothing to visually open on my computer when I run my program. Thanks in advance |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Beastinonyou
![](http://compsci.ca/v3/uploads/user_avatars/10820786614fe1f6d9ccbda.png)
|
Posted: Thu Jan 19, 2012 1:25 pm Post subject: Re: No Window |
|
|
chipanpriest @ Thu Jan 19, 2012 1:23 pm wrote: if I wanted the program to run but no window to open?
What are you trying to run? What is the purpose for accomplishing that? |
|
|
|
|
![](images/spacer.gif) |
Beastinonyou
![](http://compsci.ca/v3/uploads/user_avatars/10820786614fe1f6d9ccbda.png)
|
Posted: Thu Jan 19, 2012 1:29 pm Post subject: Re: No Window |
|
|
The only thing I could think of would be the following:
Turing: |
% Just setting my window / opening
var window : int := Window.Open ("graphics: 500;500")
% Take these two lines and try them out in a new turing file
View.Set ("popup")
% However, if you try to interact with the window, like putting stuff on the screen, it will pop back up
|
|
|
|
|
|
![](images/spacer.gif) |
Dreadnought
|
Posted: Thu Jan 19, 2012 1:31 pm Post subject: Re: No Window |
|
|
I don't think a window "opens" until you send output to it. So no output = no window. Alternatively, you can fool around with the Window module. |
|
|
|
|
![](images/spacer.gif) |
mirhagk
|
Posted: Thu Jan 19, 2012 3:52 pm Post subject: RE:No Window |
|
|
actually you could shorten that code to just the View.Set line (which would make the window not pop up at all) |
|
|
|
|
![](images/spacer.gif) |
Alex C.
|
Posted: Thu Jan 19, 2012 4:13 pm Post subject: RE:No Window |
|
|
what kind of program is it anyway? |
|
|
|
|
![](images/spacer.gif) |
chipanpriest
![](http://compsci.ca/v3/uploads/user_avatars/2500543034edeb81cb83e9.jpg)
|
Posted: Fri Jan 20, 2012 12:19 pm Post subject: Re: No Window |
|
|
Okay guys, I'll start over. I want to make a keylogger and a key logger obviously cannot have a window open but that's only one of my problems. I've gotten the program to work correctly when I use getch but in this case, I think Input.KeyDown would be a better command. My problem is, I don't know how to get turing to read which key is being pressed down as a string value. It takes the key you press down as a char and I don't know how to turn it into a string so any help there? I've tried a couple things like:
Turing: |
var cha : string (1)
Input.KeyDown (ch )
cha := ch %doesnt work because ch is a char and cha is a string
%---------
cha := charstr (ch ) %charstr isnt a command
|
Anyone know how to turn ch into a string? |
|
|
|
|
![](images/spacer.gif) |
Alex C.
|
Posted: Fri Jan 20, 2012 12:37 pm Post subject: RE:No Window |
|
|
um first off, char and string are able to mingle with one another so that is not your isse
2nd, i do believe that input.keydown is for boolean type variables (true or false), and has no conversion :/ |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dreadnought
|
Posted: Fri Jan 20, 2012 12:39 pm Post subject: Re: No Window |
|
|
Actually, in your case ch is not a character value.
ch is an array of boolean (true/false) variables. The indices of the array are all characters hence the declaration.
Turing: | var ch : array char of boolean |
From this it should be obvious that you can't assign the value of an array of boolean values to a character variable.
I think you've already come to the conclusion that a string is simply a sequence of characters (like an array of characters) and that a character variable and a string of length 1 (string(1)) are basically equivalent.
So how can you convert this array of boolean characters into a string representing the keys being held down? Well, since the indices of the array are characters, if we could go through all characters and check if each one is pressed (true in the array) then we can simply add theses characters to a string and we're done.
Example: Turing: | var chars : array char of boolean % Our array of boolean values
var accumulator : string % our string
loop
accumulator := "" % reset our string
Input.KeyDown (chars ) % get input
for i : char % since char is a subrangeType we can use it in our for loop
if chars (i ) then % check each character
accumulator + = i % add those that are held down
end if
end for
locate (1, 1)
put accumulator % print the string
end loop |
Note that for a key logger you will have to deal with keys being help down but not being typed multiple time. It may in fact be easier to use getchar and hasch to do what you want (this is entirely personal preference). |
|
|
|
|
![](images/spacer.gif) |
Beastinonyou
![](http://compsci.ca/v3/uploads/user_avatars/10820786614fe1f6d9ccbda.png)
|
Posted: Fri Jan 20, 2012 1:05 pm Post subject: Re: No Window |
|
|
indeed, you could detect input keys by using :
Turing: |
var ch : string (1)
var accumulator : string
loop
if hasch then
getch (ch )
end if
end loop
|
getch will store the character key that was pressed down, which only happens if hasch is true (has a character been pressed)
I'm assuming if you're making a keylogger of some sort, you will be exporting the keys the user presses into a text document located somewhere? You would then transfer the keys pressed into the text file.
You could also ensure that, say the user presses the Backspace button, you *could* erase the previous letter.. That is optional. |
|
|
|
|
![](images/spacer.gif) |
|