hani-dev Posted May 26, 2017 Share Posted May 26, 2017 hello there... i need to write script run in MS DOS and when u run it it's ask u to write website like www.google.com and then when u hit enter i must got the result of : ping www.google.com i other word (ping) must be built in with my script sorry for bad english can we do that Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 26, 2017 Share Posted May 26, 2017 Hi @hani-dev Do you want to develop an application compatible with MS-DOS or with Windows? That should not be so difficult to do Best regards. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 (edited) @FrancescoDiMuro for windows but work in dos #pragma compile(Console, True) but i dont know ho to do what i asked for in the first post Edited May 26, 2017 by hani-dev Link to comment Share on other sites More sharing options...
Developers Jos Posted May 26, 2017 Developers Share Posted May 26, 2017 Look at StdoutRead() and StderrRead() in the helpfile on how to read the IO stream of a CMD. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 @Jos i already do that and i did not understand how to do that Link to comment Share on other sites More sharing options...
Developers Jos Posted May 26, 2017 Developers Share Posted May 26, 2017 Ok, show us the script with the code you have tried so we can have a look. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 i found this code : #include <Constants.au3> $DOS = Run(@ComSpec & " /c Ping www.google.com", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) ConsoleWrite($Message) what i need is to modify the code to ping any website ( read website from consoleread , consolewrite ) exapmle : $DOS = Run(@ComSpec & " /c Ping ($website provided manually), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Link to comment Share on other sites More sharing options...
Developers Jos Posted May 26, 2017 Developers Share Posted May 26, 2017 (edited) I am lost: Why change the command line? Are you seriously trying to run the AutoIt3 Function in a CMD prompt? or do you want to use a variable which the script will prompt for? Jos Edited May 26, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 (edited) @Jos Let me try to clarify ... first of all my english is 2 bad ... what i want to do is to run this script from cmd i add this to do it : #pragma compile(Console, True) ok ... the next step when i want to execute my script from cmd i need it to ask me to write the website (any website wrriten manually )and just hit enter to get this result : Note : just write website without Ping Quote Pinging www.google.com [172.217.17.68] with 32 bytes of data: Reply from 172.217.17.68: bytes=32 time=114ms TTL=53 Reply from 172.217.17.68: bytes=32 time=107ms TTL=53 Reply from 172.217.17.68: bytes=32 time=111ms TTL=53 Reply from 172.217.17.68: bytes=32 time=109ms TTL=53 Ping statistics for 172.217.17.68: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 107ms, Maximum = 114ms, Average = 110ms Edited May 26, 2017 by hani-dev Link to comment Share on other sites More sharing options...
Developers Jos Posted May 26, 2017 Developers Share Posted May 26, 2017 Ok... so something like this?: #pragma compile(Console, True) #include <AutoItConstants.au3> $web=InputBox("ping website","specify website to check") if @error then Exit $DOS = Run(@ComSpec & " /c Ping " & $web, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) while ProcessExists($DOS) $Message = StdoutRead($DOS) ConsoleWrite($Message) WEnd $Message = StdoutRead($DOS) if $Message <> "" then ConsoleWrite($Message) Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 yes @jos that what i need but i need it without gui i mean without inputbox i need to write it from cmd window Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 like this @Jos Link to comment Share on other sites More sharing options...
Developers Jos Posted May 26, 2017 Developers Share Posted May 26, 2017 Something like this: #pragma compile(Console, True) #include <AutoItConstants.au3> ConsoleWrite("Please enter website:") $web = "" While 1 $web &= ConsoleRead() If StringInStr($web, @LF) Then ExitLoop WEnd ConsoleWrite("pinging:" & $web) $DOS = Run(@ComSpec & " /c Ping " & $web, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While ProcessExists($DOS) $Message = StdoutRead($DOS) ConsoleWrite($Message) WEnd $Message = StdoutRead($DOS) If $Message <> "" Then ConsoleWrite($Message) Jos Gianni 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
anthonyjr2 Posted May 26, 2017 Share Posted May 26, 2017 Keep in mind @hani-dev something like this can be done much easier in a batch script: set /P id=Enter site to ping: ping %id% pause If this is run inside a .bat file it does what you're trying to do in AutoIt. UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
Developers Jos Posted May 26, 2017 Developers Share Posted May 26, 2017 4 minutes ago, anthonyjr2 said: can be done much easier in a batch script Where is the fun in that?? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
anthonyjr2 Posted May 26, 2017 Share Posted May 26, 2017 Haha that's true, I suppose we wouldn't have a lot of our fancy UDFs if we didn't try to do every possible thing in AutoIt UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 @Jos u are the boss man <3 it's working thanx u very much <3 Link to comment Share on other sites More sharing options...
hani-dev Posted May 26, 2017 Author Share Posted May 26, 2017 @jos im soryy man it's now working outside the SCITElite when i open cmd windows and try to run my compiled .exe i got this it's now writing anythink and not doing anythink it's just stuck on this screen !! Link to comment Share on other sites More sharing options...
Developers Jos Posted May 27, 2017 Developers Share Posted May 27, 2017 Not sure what you mean. It is working fine when I compile the script and run it from a CMD prompt. So what exactly is not working for you? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
FengHuangWuShen Posted May 27, 2017 Share Posted May 27, 2017 I think he purely wants it ran from inside SciTe, not a cmd window. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now