Jump to content
CYCho

Interactive AutoIt Command Window

Recommended Posts

Maybe I didn't search enough of this forum, but I couldn't find anything like Interactive AutoIt Command Window. I miss the Command Window of Visual FoxPro and I feel sorry that VFP was fossilized without unicode support. What do I do to copy xxx.exe to yyy.exe in the same folder for example? I would use Power Shell, or I would copy it to another folder, change the name there and move it back to the original folder. Or I would write a samll AuotoIt script including FileCopy() function and run the script. If I have VFP running in my computer, I would simply issue 'copy file xxx.exe to yyy.exe' command in the Command Window. Now I have the following script which works like VFP Command Window but with very limited functionality. Is there a UDF already written for this purpose that I couldn't find?

#include <Inet.au3>
#include <Misc.au3>
#include <File.au3>
#include <Array.au3>

HotKeySet("^!z", "MyExit")
HotKeySet("^!c", "MyCommand")

Local $a1, $a2, $a3, $s1, $s2, $s3
While 1
    Sleep(20)
WEnd

Func MyCommand()
    Local $var = InputBox("Interactive AutoIt", "Enter an AutoIt command.", "", "", 300, 130)
    If @error Or $var = "" Then
        Return
    EndIf
    Local $answer = Execute($var)
    MsgBox(0, "Interactive AutoIt", 'The value is: "' & $answer & '"   ')
EndFunc

Func MyExit()
    Exit
EndFunc

 

Share this post


Link to post
Share on other sites
3 hours ago, CYCho said:

What do I do to copy xxx.exe to yyy.exe in the same folder for example?

Using your script, if I write in the inputbox : FileCopy("xxx.exe", "yyy.exe") , it works nice for me
It should work for many instructions, provided that these instructions are one-liners

Share this post


Link to post
Share on other sites

We can use this for some of 2 line commands:

First you enter Assign("a1", _FileListToArray(@ScriptDir, "*"))

Then you enter _ArrayDisplay($a1)

Share this post


Link to post
Share on other sites

@mikell Thanks for your comments. If we use editbox instead of inputbox, maybe we can make it execute multi-line commands.

Share this post


Link to post
Share on other sites
1 hour ago, CYCho said:

If we use editbox instead of inputbox, maybe we can make it execute multi-line commands.

Execute will only work with a single line instruction.  One possible solution, you would need to execute one line after the other. Or save the whole editbox to a file.au3  then run it as a script like this :

FileWrite ("Test.au3",$var)
$answer = RunWait ("AutoIt3.exe Test.au3","")
FileDelete ("Test.au3")

 

Share this post


Link to post
Share on other sites
14 minutes ago, Nine said:

Execute will only work with a single line instruction.

@Nine: Wrong.

@CYCho: example

Share this post


Link to post
Share on other sites
13 minutes ago, Nine said:

Or save the whole editbox to a file.au3  then run it as a script

Possible but tricky. Caution with non-declared variables, #includes if non-integrated funcs are used, unusable results, and so on

Share this post


Link to post
Share on other sites

Thank you @RTFC. You pointed me to some posts which are very interesting. Somehow these posts escaped my search.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...