Jump to content


Photo

[Solved] Can you make this with ahk?


  • Please log in to reply
5 replies to this topic

#1 ibbignerd

ibbignerd
  • Members
  • 37 posts

Posted 07 August 2012 - 08:19 PM

On a very simple level, I want to make an input box that looks like this:

Posted Image

So basically, no extra libraries, not an actual window, on enter, close input and save contents as a variable. Does anyone know how to do this?

#2 rbrtryn

rbrtryn
  • Members
  • 790 posts

Posted 07 August 2012 - 09:25 PM

You mean like this?
#NoEnv
#SingleInstance force
SetBatchLines -1
ListLines Off
SendMode Input
SetWorkingDir %A_ScriptDir%

; Autoexecute
	Gui -Caption +AlwaysOnTop +Border 
	Gui Add, Edit
	       , r2 w500 -WantReturn -VScroll vContents
		   ,
	Gui Add, Button
	       , Hidden Default gEndEdit
		   ,
	Gui Show, h50
return

EndEdit:
	Gui Submit
	MsgBox You Typed: `n%Contents%
	ExitApp
return

Type stuff in the box and hit enter :D

#3 dylan904

dylan904
  • Members
  • 706 posts

Posted 07 August 2012 - 09:45 PM

Minus the thick border, I hope this is close to what you speak of...
Gui, +LastFound -Caption +AlwaysOnTop +ToolWindow

HWND := WinExist()



Gui, Font, s14

gui, Add, Edit, vEdit -WantReturn

Gui, Color, EEAA99

Gui +LastFound  ; Make the GUI window the last found window for use by the line below.

WinSet, TransColor, EEAA99

Gui, Show, x45 y680

ControlFocus, Edit1, ahk_id %HWND%

return



Esc::

If (!Hidden)

{

   WinHide, ahk_id %HWND%

   Hidden := True 

}

Else 

{

   WinShow, ahk_id %HWND%

   Hidden := False

}

return


#4 ibbignerd

ibbignerd
  • Members
  • 37 posts

Posted 08 August 2012 - 03:06 AM

Thank you to both of you. This got me started to make what I wanted exactly. I combined both of your codes to get the following:

#InstallKeybdHook
#NoEnv
#SingleInstance force
Gui, +LastFound -Caption +AlwaysOnTop +ToolWindow +Border
HWND := WinExist()

Gui, Font, s26
gui, Add, Edit, vEdit -WantReturn x5 y5 w510
Gui, Color, 000000
Gui, margin, 0, 0
Gui +LastFound
WinSet, TransColor, EEAA99
Gui Add, Button
          , Hidden Default gEndEdit
         ,
Gui, Show, x45 y668 w520 h57
ControlFocus, Edit1, ahk_id %HWND%
winactivate %HWND%
return

EndEdit:
   Gui Submit
   MsgBox You Typed: `n%Edit%
   ExitApp
return

!1::
If (!Hidden)
{
   WinHide, ahk_id %HWND% 
   Hidden := True 
}
Else 
{
   WinShow, ahk_id %HWND%
   Hidden := False
}
return

esc::
exitapp
return


#5 dylan904

dylan904
  • Members
  • 706 posts

Posted 08 August 2012 - 03:17 AM

You use +LastFound twice so you can delete the 2nd one.

#6 ibbignerd

ibbignerd
  • Members
  • 37 posts

Posted 08 August 2012 - 04:54 PM

Thanks!