Jump to content

Command and Execute


Recommended Posts

Take a look here:

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

thanks Nessie

also went ahead and made my own, its not as classy as some, but gets the job done :)

if not FileExists("C:\Program Files (x86)\AutoIt3\AutoIt3.exe") Then
MsgBox(0, "", "You Must have AutoIt Software Installed to run this Program")
Exit
EndIf


#include 
#include 
#include 
#include 
#include 
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("AutoIt Command Prompt", 616, 278, 195, 135)
GUISetBkColor(0xC0C0C0)
$Label1 = GUICtrlCreateLabel("AutoIt Command Prompt", 8, 8, 598, 33, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))
GUICtrlSetFont(-1, 18, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x99B4D1)
$Input1 = GUICtrlCreateInput("", 8, 104, 601, 28)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Enter Commands below:", 8, 56, 212, 28, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_SUNKEN))
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x99B4D1)
$Button1 = GUICtrlCreateButton("Execute", 8, 160, 601, 57)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Help", 8, 232, 601, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$file = @TempDir & "\command.au3"

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
FileDelete($file)
Exit

Case $Button1
$command = GUICtrlRead($Input1)
$file = @TempDir & "\command.au3"
FileOpen(@TempDir & "\command.au3", 10)
FileWriteLine($file, $command)
FileClose($file)
ShellExecute($file)
sleep(1000)
GUICtrlSetData($Input1,"")

Case $Button2
if FileExists("C:\Program Files (x86)\AutoIt3\AutoIt3.chm") Then
ShellExecute("C:\Program Files (x86)\AutoIt3\AutoIt3.chm")
Else
ShellExecute("http://www.autoitscript.com/wiki/Function_list")
EndIf


EndSwitch
WEnd
Link to comment
Share on other sites

This might help you

#include <File.au3>
#include <StaticConstants.au3>
#include <GUIConstants.au3>


If Not FileExists(@AutoItExe) Then
MsgBox(0, "", "You Must have AutoIt Software Installed to run this Program")
Exit
EndIf

$s_HelpFile = StringReplace(@AutoItExe,"Autoit3.exe","Autoit3.chm")

$Form1_1 = GUICreate("AutoIt Command Prompt", 616, 278, 195, 135)
GUISetBkColor(0xC0C0C0)
$Label1 = GUICtrlCreateLabel("AutoIt Command Prompt", 8, 8, 598, 33, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN))
GUICtrlSetFont(-1, 18, 800, 4, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x99B4D1)
$Input1 = GUICtrlCreateInput("", 8, 104, 601, 28)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Enter Commands/Script Path below:", 8, 56, 212, 28, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN))
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x99B4D1)
$Button1 = GUICtrlCreateButton("Execute Command", 8, 160, 300, 57)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Execute Script", 308, 160, 300, 57)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Help", 8, 232, 601, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)


$file = @TempDir & "\command.tmp"

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
FileDelete($file)
Exit

Case $Button1
Execute( GUICtrlRead( $Input1 ) )

Case $Button3
_ExecuteFile( GUICtrlRead( $Input1 ))

Case $Button2
If FileExists($s_HelpFile ) Then
ShellExecute($s_HelpFile)
Else
ShellExecute("http://www.autoitscript.com/wiki/Function_list")
EndIf
EndSwitch
WEnd


Func _ExecuteFile($sText)
Local $hFile, $PID, $s_TempFile
$s_TempFile = _TempFile()
$hFile = FileOpen($s_TempFile, 2)
FileWrite($hFile, $sText)
FileClose($hFile)
$PID = Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $s_TempFile & '"')
Sleep(300)
FileDelete($s_TempFile)
Return $PID
EndFunc   ;==>_ExecuteFile

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

quick question what is the advantage of using a temp file over an au3 file??

No such specific advantage..! The function ensures the file to be unique and random not a hard-coded file(name).

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...