Sign in to follow this  
Followers 0
SlimShady

Run Box Replacement

6 posts in this topic

#1 ·  Posted (edited)

Here's a run box replacement. If you run a command the box will stay be displayed. Until you press ESC or cancel.

Changes:

  • added support for resolution: 1024x768

    (but I added static positions, easier)

  • added Google search
To open a website enter this (example)

$i www.autoitscript.com

Some other commands:

  • windir
  • sysdir
  • progdir
  • desktop
  • mydocs
  • $g keywords
  • $b|file(s)
First is the Windows directory.

Second is the system directory.

Third is the Program Files directory.

Fourth is the desktop folder

Fifth is the "My Documents" folder

Sixth is search on Google for keywords

Example:

$g James Bond

Last:

You can create backups of file(s). The backup will be placed in your windows directory, in a folder backup. With the extension .backup.

You can't backup files with no extension, but you can backup multiple files.

See examples below

Backup examples:

$b|desktop\important.doc
$b|C:\scripts\test.au3
$b|sysdir\*.exe
$b|progdir\AutoIt3\Examples\English\*.au3

Any other command is the same as in the Windows run box.

Like:

notepad
winword
mspaint
powerpnt
excel
write
C:\
D:\
services.msc
msconfig

I figured something out :D. You can even use this (example):

windir\Cursors

And it works perfect!

$g_szVersion = "Commandbox"
If WinExists($g_szVersion) Then
WinActivate("Commandbox")
Exit
EndIf

AutoItWinSetTitle($g_szVersion)


AutoItSetOption("RunErrorsFatal", 0)

If @DesktopWidth = "1280" Then
  $pos = 810
Else
  $pos = 563
EndIf

$Command = InputBox("Commandbox", " ", "", "", 250, 110, 0, $pos)

If $Command <> "" Then
  While $Command <> ""
   Command($Command)
$Command = InputBox("Commandbox", " ", "", "", 250, 110, 0, $pos)
  WEnd
  Exit
Else
  Exit
EndIf

Func Command($Command)

;------------ Internet
$Match = StringInStr($Command, "$i")
If $Match > 0 Then $Command = StringReplace($Command, "$i", "iexplore")

;------------ Google
$Match = StringInStr($Command, "$g")
If $Match > 0 Then $Command = StringReplace($Command, "$g ", "iexplore www.google.com/search?q=")

;------------ System directories
$Sysdir = StringInStr($Command, "sysdir")
$Windir = StringInStr($Command, "windir")
$Progdir = StringInStr($Command, "progdir")
$Desktop = StringInStr($Command, "desktop")
$MyDocs = StringInStr($Command, "mydocs")

If $Windir > 0 Then $Command = StringReplace($Command, "windir", @WindowsDir)
If $Sysdir > 0 Then $Command = StringReplace($Command, "sysdir", @SystemDir)
If $Desktop > 0 Then $Command = StringReplace($Command, "desktop", FileGetShortName(@DesktopDir))
If $MyDocs > 0 Then $Command = StringReplace($Command, "mydocs", FileGetShortName(@MyDocumentsDir))
If $Progdir > 0 Then $Command = StringReplace($Command, "progdir", FileGetShortName(@ProgramFilesDir))

;------------ Backup
$Match = StringInStr($Command, "$b")
If $Match > 0 Then
Backup($Command)
Return
EndIf

Run($Command)
If @Error = 1 Then Run(@ComSpec & " /c Start " & $Command, "", @SW_HIDE)

EndFunc;---Run command

Func Backup($Command)
$Command = StringSplit($Command, "|")
$Backup = FileGetShortName($Command[2])

$Filename = StringSplit($Backup, "\")
$Filename = $Filename[$Filename[0]]

$Folder = @WindowsDir & "\backup"
DirCreate($Folder)
$Folder = $Folder & "\"

FileCopy($Backup, $Folder & $Filename & ".backup")

$Command = ""
EndFunc

Exit
Edited by SlimShady

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

i dont get what it does

(*EDIT*): I'm and Advanced Member now :D

Edited by brett

-Brett

Share this post


Link to post
Share on other sites

If you press Windows key+R you see the run box.

It's the same but this commandbox can access folders faster. And you can backup files easily.

See above for examples and commands.

Share this post


Link to post
Share on other sites

You might want to change the startup position of your InputBox.... I run at 1024x768 resolution, and it appears off screen :D

Maybe try something such as:

InputBox("Commandbox", " ", "", "", 250, 110, 10, @DesktopHeight-110-$taskbarHeight)

You can get the position of the taskbar, on Windows XP at least, by using:

WinGetPos("","Notification Area") ;returns array (x,y,width,height) for taskbar

Thanks for sharing


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

I forgot to adjust my script to that resolution.

Thank you for the information.

I will upload the new version soon.

Share this post


Link to post
Share on other sites

Changes:

- Added Google 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
Sign in to follow this  
Followers 0