Sign in to follow this  
Followers 0
FuryCell

7Prompt

13 posts in this topic

#1 ·  Posted (edited)

I really enjoyed Glass CMD by komalo but did not like the idea of a background process so I wrote a similar app that simply launches a glass cmd window.

7Prompt is an open-source utility to launch a command prompt with AERO glass. Linux has had cool looking prompts for a while. Now windows users can have it too. (Provided you are running Vista/7 with AERO enabled.)

Special thanks to:Jamesbrooks and Komalo.

Get it from the either of the following.

GoogleCode

Softpedia

There is also a command line tool on the google code page that can turn glass on or off with the syntax "Glass ON|OFF".

Edited by FuryCell

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites



Now a bit more research for you: It appears that the text is always slightly transparent even when using the COLOR command. Is there any way to make the text visible on a white background?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Now a bit more research for you: It appears that the text is always slightly transparent even when using the COLOR command. Is there any way to make the text visible on a white background?

I'll look into it. There are more commands for DWM that involve making certain things nontransparent but I'm not sure how they would be applied to the text on a command prompt (if its even possible). Worst case scenaioro is the command prompt has to be recreated using an edit control or something similar. :mellow:

Edited by FuryCell

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Very cool. Thanks for making it open source and sharing! I've been using command line a ton as I'm learning python and ruby. And my god it's annoying to do it the old-fashioned way. I find myself just staring at the screen trying to remember what I set out to do. This will save me many headaches.

Share this post


Link to post
Share on other sites

Very cool. Thanks for making it open source and sharing! I've been using command line a ton as I'm learning python and ruby. And my god it's annoying to do it the old-fashioned way. I find myself just staring at the screen trying to remember what I set out to do. This will save me many headaches.

Bot much? Posted Image

Share this post


Link to post
Share on other sites

I really enjoyed Glass CMD by komalo but did not like the idea of a background process so I wrote a similar app that simply launches a glass cmd window.

Special thanks to:Jamesbrooks and Komalo.

Get it from the either of the following.

GoogleCode

Softpedia

There is also a command line tool on the google code page that can turn glass on or off with the syntax "Glass ON|OFF".

This is a nice way to do it. I've made a minor modification so that a directory may be passed on the command line as the default when the prompt opens. Also added a _DirectoryExists() function so that I don't have to include my misc functions file.. just to keep it all one file.

The mods are all noted with "MilesAhead" in the comments

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=7Prompt.ico
#AutoIt3Wrapper_Outfile=7Prompt.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=7Prompt
#AutoIt3Wrapper_Res_Description=7Prompt
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=Michael Michta
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#NoAutoIt3Execute

;MilesAhead - bump version to distinguish mod file
Global Const $VerInfo = "1.0.0.1"

;Put command line args into a string if they are passed
$Args = " /k  echo 7Prompt V" & $VerInfo & "&& echo (c) 2010 Michael Michta"
;~ If $CmdLine[0] <> 0 Then
;~  $Args = " "
;~  For $X = 1 To $CmdLine[0]
;~      $Args &= $CmdLine[$X] & " "
;~  Next
;~  $Args = StringTrimRight($Args, 1)
;~ EndIf

;MilesAhead
;If a different directory is passed on Command Line
;make it the default for the prompt
$defaultDir = @WorkingDir
If $CmdLine[0] > 0 Then
    If _DirectoryExists($CmdLine[1]) Then
        $defaultDir = $CmdLine[1]
    EndIf
EndIf

;MilesAhead - changed @WorkingDir to $defaultDir
;start command prompt hidden
$PID = Run(@ComSpec & $Args, $defaultDir, @SW_HIDE)

;Wait for the console window to appear and then get a list so the correct can be found
WinWait("[CLASS:ConsoleWindowClass]")
$List = WinList("[CLASS:ConsoleWindowClass]")

;Loop through list of console windows
For $X = 1 To $List[0][0]
    If WinGetProcess($List[$X][1]) = $PID Then ; Find console window attached to spawned command prompt

        WinSetState($List[$X][1], "", @SW_SHOW) ; Show the console
        EnableBlurBehind($List[$X][1])
        WinActivate($List[$X][1])
        Exit
    EndIf
Next

;Errors
ProcessClose($PID)
MsgBox(0, "7Prompt:Error", "Failed to find console window.")
Exit



Func EnableBlurBehind($hWnd)
    Const $DWM_BB_ENABLE = 0x00000001
    $Struct = DllStructCreate("dword;int;ptr;int")
    DllStructSetData($Struct, 1, $DWM_BB_ENABLE)
    DllStructSetData($Struct, 2, "1")
    DllStructSetData($Struct, 4, "1")
    DllCall("dwmapi.dll", "int", "DwmEnableBlurBehindWindow", "hwnd", $hWnd, "ptr", DllStructGetPtr($Struct))
EndFunc   ;==>EnableBlurBehind

;returns True if $path is a directory - MilesAhead
Func _DirectoryExists($path)
    If Not FileExists($path) Then Return False
    If StringInStr(FileGetAttrib($path), "D") > 0 Then Return True
    Return False
EndFunc   ;==>_DirectoryExists

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

btw, I have a small function _GlassEnabled() so you can test rather

than assume you have glass to work with.

edit: also wanted to ask you.. I have a small utility that pops up a command prompt for selected folders in Explorer. It would look way cooler if I could just call 7Prompt with the folder on the command line. Would you have any objection to me modifying it to call 7Prompt as I've modified it v. 1.0.0.1, instead of cmd.exe? It would spiff it up a tad. :blink:

;returns non 0 if Glass is enabled on Vista/W7
Func _GlassEnabled()
    $retValue = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "int*", "")
    If @error Then Return 0
    Return $retValue[1]
EndFunc   ;==>_GlassEnabled
Edited by MilesAhead

Share this post


Link to post
Share on other sites

btw, I have a small function _GlassEnabled() so you can test rather

than assume you have glass to work with.

edit: also wanted to ask you.. I have a small utility that pops up a command prompt for selected folders in Explorer. It would look way cooler if I could just call 7Prompt with the folder on the command line. Would you have any objection to me modifying it to call 7Prompt as I've modified it v. 1.0.0.1, instead of cmd.exe? It would spiff it up a tad. :blink:

;returns non 0 if Glass is enabled on Vista/W7
Func _GlassEnabled()
    $retValue = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "int*", "")
    If @error Then Return 0
    Return $retValue[1]
EndFunc   ;==>_GlassEnabled

Nice modifications. And i dont mind you using it.

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Nice modifications. And i dont mind you using it.

Thanks. I should have mentioned my utility is a freebie. It's also

available on Softpedia

It's written in a different programming language so it saves me work if I can just invoke the .exe instead of debugging translated dll calls and whatnot. :blink:

Edited by MilesAhead

Share this post


Link to post
Share on other sites

Thanks. I should have mentioned my utility is a freebie. It's also

available on Softpedia

It's written in a different programming language so it saves me work if I can just invoke the .exe instead of debugging translated dll calls and whatnot. :blink:

Cool. Have you implemented the new prompt on it yet? I wanna check it out.


HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Cool. Have you implemented the new prompt on it yet? I wanna check it out.

I've been concentrating on modifying the glass prompt. I have a feeling because of the wait for window creation it's going to interfere with the normal action of my program. Because someone can have 7 folders selected. By having the waits it will throw off which window is active. My thing is just a macro thing. But I'll worry about that later. I moved your EnableBlurBehind() and my _DirectoryExists() into my misc functions file "MilesAheadMisc.au3"

but the nice thing so far is I changed the sequence so that when the prompt shows, it is already blurred, instead of showing black, then enabling the blur. If Glass is not enabled on the system, I just open a normal command prompt to that folder.

I attached the exe so you can so how the window opens blurred.

Here's the source changes.

edit: I updated the code a bit. I got it to work with my PromptHere program.

You can download from my site or wait for Softpedia to update on Monday or Tuesday.

Here's the link

http://www.favessoft.com/PromptHere.zip

edit2: oops. Forgot to update the zip file of 7prompt only. Got it now. :blink:

#include <WinAPI.au3>
;for glass and other functions
#include "MilesAheadMisc.au3"

;MilesAhead - bump version to distinguish mod file
Global Const $VerInfo = "1.0.0.1"

;show attirbution if Glass prompt used
$Args = " /k  echo 7Prompt V" & $VerInfo & "&& echo (c) 2010 Michael Michta" & " && echo modified with permission by MilesAhead"

;MilesAhead
;If a directory is passed on Command Line
;make it the default for the prompt
$defaultDir = @WorkingDir
If $CmdLine[0] > 0 Then
    If _DirectoryExists($CmdLine[1]) Then
        $defaultDir = $CmdLine[1]
    EndIf
EndIf

;If Glass enabled, do EnableBlurBehind
If _GlassEnabled() Then
    $PID = Run(@ComSpec & $Args, $defaultDir, @SW_HIDE)
    $Handle = WinWait("[CLASS:ConsoleWindowClass]")
    EnableBlurBehind($Handle)
    _WinAPI_ShowWindow($Handle, @SW_SHOWNORMAL)
    WinActivate("[CLASS:ConsoleWindowClass]")
Else
    Run(@ComSpec, $defaultDir, @SW_SHOW)
EndIf

7Prompt.zip

Edited by MilesAhead

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

btw I was able to incorporate functions into the PromptHere.exe. It doesn't have to call an external app now. The translation of the blur function was easier than I thought. Turns out the funky part was getting _GlassEnabled() from AutoIt3 to ahk. I must have spent 3 hours on it. Had to turn glass on and off and try it on XP to make sure it works(I hope.)

Version 2.1 of PromptHere is on my site. I acknowledged your AutoIt3 implementation in the readme.

The MilesAhead.ahk and PromptHere.ahk is included in the download, mainly because some people wanted Unicode support and I think it was Windows command line more than my program but I included the source in case they want to try to fix it. :blink:

I prefer to write reusable functions etc. in AutoIt3 but now and then it's tough to ignore the mouse hotkey support in ahk. Usually I just write a stub to do the mouse part in ahk and the rest in AutoIt3. But this one was pretty simple so I wanted to get it all in one exe.

edit: I updated to v. 2.2. Now there is a setting in the .ini file "UseGlass" that may be set to 0 to disable the glass effect.. say if you customized your system command prompt and want to use that color instead of the blur etc..

Edited by MilesAhead

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Came out nice.

Here's a link to a screen shot:

http://www.favessoft.com/prompthere.html

edit: I think this has stabilized now. Added all the features I think desirable. Now it opens a prompt if you click on desktop while the desktop is "active" using a directory settable in .ini file. Also I smoothed it so that when the prompt is shown the blur is applied. Systems both with and without glass the last prompt opened should get the keyboard focus.

My site has 2.4... Softpedia is at 2.2 currently but I've submitted the update. Should be updated to 2.4 tomorrow or Wednesday.

Edited by MilesAhead

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