
-----------------------------------
ReN3g@de
Tue Mar 09, 2004 10:59 pm

[Tutorial] Using Shell commands in turing
-----------------------------------
You can use Shell commands in Turing and do such things as Restart, Shutdown, etc. LOL!! but be wise these commands could be used for evil things so use this information usefully!

First off here's the syntax:
system ( command : string, var ret : int )

Your Shell command goes in the command : string area
and the return variable goes in the var ret: int area.

For every command run there is an interger that is returned to determine if the command worked properly or if not then what went wrong...

var ret: int
system("cmd",ret)
This program will make the command prompt open

Here are the possible errors (the lines before the numbers are needed, they're negatives):
  0 Works properly
 -1 Not enough memory to load command.com
 -2 Not enough memory to run command
 -3 Argument list greater than 128 bytes or environment info
     is greater than 32k
 -4 Couldn't find command.com
 -5 command.com is corrupt
 -6 -noshell option is selected, the system procedure is
     disallowed

To interpret these errors you could set up an if statement to see whether the execution has worked...

var ret: int
system("cmd",ret)
if ret=-7 then
   put "Command cannot be found"
end if
some thing along these lines will do just fine!

var ret: int
system("shutdown -s -c message-here",ret)
This program will shutdown the computer...
the -s means shutdown you can change it to -r to reboot... but the -c must stau the same!
the message here part is a message that appers... because this form of shutting down makes a message prompt appear counting down 30 seconds till shut down and a message is written below. There cannot be any spaces or the command will not work!

Thats all for today boys and girls hope you liked it!!

-----------------------------------
jonos
Wed Mar 10, 2004 12:38 pm


-----------------------------------
wow, great tutorial. so turing's shell syntax is almost exactly like c++. thanks for the help, though i have a feeling some noobs gonna come and do the shutdown one, hehe.

-----------------------------------
recneps
Wed Mar 10, 2004 1:43 pm


-----------------------------------
Yeah, this is what i was talking about in some other post in help section, someone wanted to know how to delete, and i said there was one that let you use command prompts (as an alternative ;)) And thats crazy, how does your sig pic work? lol

-----------------------------------
ReN3g@de
Wed Mar 10, 2004 4:47 pm


-----------------------------------
who mine?
im really not sure lol... i found it on the net and i thot it was pretty cool!

-----------------------------------
recneps
Thu Mar 11, 2004 4:05 pm


-----------------------------------
Its scary, its like "OMG how does he know my ip?!" And that im using IE (well most ppl do, but still lol)

-----------------------------------
octopi
Thu Mar 11, 2004 4:15 pm


-----------------------------------
Its pretty simple, I used to have a avatar that would check to see if your computer had a firewall or not.


Basically he enters the html code, which loads an image from the server. But the image is not an image, its a cgi program, this program then gets information about the user from the headers, and then enters that info into an image, and returns the image to the browser.

-----------------------------------
ReN3g@de
Thu Mar 11, 2004 6:02 pm


-----------------------------------
well there u have it

-----------------------------------
zylum
Thu Mar 11, 2004 7:45 pm


-----------------------------------
you could also do it using flash and php i think... where the php would figure out the info and then make an xml file and flash would read it and put the text on the image...

-----------------------------------
recneps
Fri Mar 12, 2004 2:29 pm


-----------------------------------
Interesting stuff! ;)

-----------------------------------
SuperGenius
Mon Mar 29, 2004 7:36 pm


-----------------------------------
About that pic.... it got my os and browser right, but the IP is wrong I think. At least it is way different than what turing told me when i was working with my connect 4 game.

-----------------------------------
octopi
Mon Mar 29, 2004 8:28 pm


-----------------------------------
Turing will probally tell you the internal network ip address of your system's NIC card, usually 192.168.0.X, or similar, could also be 10.X, or 169.X

When on the internet, you external IP address is given.

-----------------------------------
SuperGenius
Mon May 17, 2004 4:06 pm


-----------------------------------


When on the internet, you external IP address is given.

My connect 4 game uses Net.LocalAdress to give a number which the client types to connect to the host. So if it it the internal ip then my program should work fine within a network, but how do i get it to connect two computers that are not networked?

-----------------------------------
octopi
Mon May 17, 2004 6:36 pm


-----------------------------------
You dont.....they have to be networked....unless you intend to send data back and forth via carrier pidgeon.

-----------------------------------
SuperGenius
Mon May 17, 2004 7:30 pm


-----------------------------------
What a rip off.

-----------------------------------
octopi
Mon May 17, 2004 8:29 pm


-----------------------------------
Just so were both on the same page....


not networked means not connected to the internet, correct?

-----------------------------------
DaVe g
Sun Sep 19, 2004 10:34 am


-----------------------------------
nobody will make viruses with this info? 

 :lol:

-----------------------------------
Dan
Sun Sep 19, 2004 10:40 am


-----------------------------------
nobody will make viruses with this info? 

 :lol:

No more dnageruges then any real lang and u could not format the main hard drive just by using that comand. Whould have to reporgame some of the boot files to do that  :roll:

-----------------------------------
jeffgreco13
Thu Jun 05, 2008 11:03 am

Re: [Tutorial] Using Shell commands in turing
-----------------------------------
HEY HEY, I wrote this back in the day lol.

Oh and it's very possible to make a virus with this info lol. More or less a very very very annoying one rather than something really destructive.

Then again, with the right commands and the right files deleted... who knows......

Not giving any ideas or anything.

-----------------------------------
Tony
Thu Jun 05, 2008 11:20 am

Re: [Tutorial] Using Shell commands in turing
-----------------------------------
Oh and it's very possible to make a virus with this info
No. No, you cannot make  with that.


http://imgs.xkcd.com/comics/duty_calls.png

-----------------------------------
jeffgreco13
Thu Jun 05, 2008 11:24 am

Re: [Tutorial] Using Shell commands in turing
-----------------------------------
well that just made me bite my tongue lol... thanks for the info tho

-----------------------------------
Insectoid
Thu Jun 05, 2008 3:42 pm

RE:[Tutorial] Using Shell commands in turing
-----------------------------------
Well, almost the exact code can be typed into any text program and saved as batch file. The only difference is that it works over networks and thus requires the computer's 'name'.  In my compsci class, 9-10 kids found out how to open the remote shutdown dialog box, and were wreaking havoc in class. So I wiki'd remote shutdown and found the direct shutdown code, wrote one for every computer in the room, and shut down every person who had ever shut me down. I really had the upper hand, because they had to go to the dialog box and manually change settings, while I just had to click an icon! It didn't help that the computer names are all printed on the computer cases...

I did eventually delete all my codes and swap out my computer's hard drive to change the name. Now, when someone tries to shut me down, the computer of the very guy who started the whole shutdown thing will go off. They all think I implemented some genious code to cause codes to rebound of my computer! 

good times...

Oh, and my friend wrote a code in turing that would delete all system files on the computer, so EXTREMELY malicious software can be created in turing.

-----------------------------------
Xypher
Thu Jan 08, 2009 1:27 pm

Re: [Tutorial] Using Shell commands in turing
-----------------------------------
I have a question...I see it opens a new command window every time. I want to go to a directory to copy one file into another. I thought by default it would run the file from the directory the .t or .exe doing this is located in. Apperantly it doesn't so I would like it to run something like this:

U:
cd:\
copy /b fileout + filein outputfile

I will obiously be reciving input for the name of the drive they're using to take into consideration some people may have it on another hardrive or partition, and a directory. Other than that the file already asks for the files being worked with. The code looks like this

 setscreen("nocursor")
   var x,y:int
   var filein,fileout,name,fin:string
put"This program is designed to embed one file into another.",skip,"Please make sure that the files are in the same directory as this program!",skip
put"Press any key to continue!"
 Input.Pause
 cls
 setscreen("cursor")
put"Please enter the name of the file which will be embedded in the target file!",skip,skip,"File Name: "..
 color(red)
   get filein
 color(black)
 cls
put"Please enter the name of the target file which will contain the file:",skip,skip,"File Name: "..
 color(red)
   get fileout
 color(black)
 cls
put"Please enter the name of the file that will be a product of the target file:",skip,skip,"File Name: "..
 color(red)
   get name
 color(black)
 cls
put"EMBEDDING..."
fin:="copy /b "+fileout+" + "+filein+" "+name
 system(fin,x)
 cls
put"Embedding complete!",skip,skip,"Enter '1' to delete the original files or '0' to close this program: "..
   get y
 cls
if y=1then
   fin:="del "+filein
 put fin
    system(fin,x)
   fin:="del "+fileout
 put fin
    system(fin,x)
end if


Thanks for any help :).


EDIT: I'm also unsure how to type something such as '\Administrator' in a put statment as I get the error "Illigal extended character in string literal". Anybody have a fix for this?

-----------------------------------
Nick
Thu Jan 08, 2009 3:17 pm

RE:[Tutorial] Using Shell commands in turing
-----------------------------------
put Dir.Current

is that what you want?

I'm also unsure how to type something such as '\Administrator' in a put statment as I get the error "Illigal extended character in string literal". Anybody have a fix for this?

try \\Administrator

-----------------------------------
Xypher
Fri Jan 09, 2009 3:33 pm

Re: [Tutorial] Using Shell commands in turing
-----------------------------------
Not quite but that's a useful command to know. I want to know how to navigate to a directory, then excecute a comman which embeds one file with another. Basically if somebody could show me a quick example program on how to move one file to another location it would help...I just really need to be able to excecute 2 statments in the same command prompt.

-----------------------------------
Lekegolo killer
Wed Jan 14, 2009 1:12 pm

Re: [Tutorial] Using Shell commands in turing
-----------------------------------
You can use Shell commands in Turing and do such things as Restart, Shutdown, etc. LOL!! but be wise these commands could be used for evil things so use this information usefully!

First off here's the syntax:
system ( command : string, var ret : int )

Your Shell command goes in the command : string area
and the return variable goes in the var ret: int area.

For every command run there is an interger that is returned to determine if the command worked properly or if not then what went wrong...

var ret: int
system("cmd",ret)
This program will make the command prompt open

Here are the possible errors (the lines before the numbers are needed, they're negatives):
  0 Works properly
 -1 Not enough memory to load command.com
 -2 Not enough memory to run command
 -3 Argument list greater than 128 bytes or environment info
     is greater than 32k
 -4 Couldn't find command.com
 -5 command.com is corrupt
 -6 -noshell option is selected, the system procedure is
     disallowed

To interpret these errors you could set up an if statement to see whether the execution has worked...

var ret: int
system("cmd",ret)
if ret=-7 then
   put "Command cannot be found"
end if
some thing along these lines will do just fine!

var ret: int
system("shutdown -s -c message-here",ret)
This program will shutdown the computer...
the -s means shutdown you can change it to -r to reboot... but the -c must stau the same!
the message here part is a message that appers... because this form of shutting down makes a message prompt appear counting down 30 seconds till shut down and a message is written below. There cannot be any spaces or the command will not work!

Thats all for today boys and girls hope you liked it!!


My friend can do all this stuff in notepad.

-----------------------------------
[Gandalf]
Wed Jan 14, 2009 4:29 pm

RE:[Tutorial] Using Shell commands in turing
-----------------------------------
I doubt it.  Notepad is a text editor, much like the one the Turing environment provides.  You probably mean he can do this stuff by making batch (*.bat) files or similar.

-----------------------------------
ritama
Tue Oct 22, 2019 4:10 am

Re: [Tutorial] Using Shell commands in turing
-----------------------------------
Turing will probably tell you the internal ip address of your system, which is usually [url=https://192-168-1-1x.com/]192.168.1.1,  When on the internet, you external IP address is given.

-----------------------------------
basiblaster
Fri Nov 29, 2019 8:55 am

RE:[Tutorial] Using Shell commands in turing
-----------------------------------
hey, just wondering, how would you get the output from the terminal and put it on the turing window?
