Custom GUI

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MegaloDon
Posts: 107
Joined: 22 Jul 2014, 17:54

Custom GUI

03 Oct 2014, 22:55

I'm sure someone must have done this by now but I couldn't find it.

It would be cool to create your own custom GUI window. Like instead of having the standard title bar, etc., create your own. You could use Gui -Caption which will give you a window with no border, etc. Then you could use your own pics and draw your own title bar, border, close button, etc. But how could you move the window with the mouse? Like if you normally click and drag the title bar, it will move the window. But if you don't have a (standard) title bar, you can't do that.

If someone has done this and I missed it, please point me to that post.
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: Custom GUI

04 Oct 2014, 01:34

You can use a WebBrowser control, remove the caption of the GUI and implement your own close, min/max, restore buttons using HTML/CSS/Javascript.
just me
Posts: 9575
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Custom GUI

04 Oct 2014, 04:08

One of SKAN's tricks:

Code: Select all

#NoEnv
Gui, -Caption
Gui, Margin, 0, 0
Gui, Add, Text, w600 h23 Center 0x200 Border gCaptionClick, My Caption (click && drag to move)
Gui, Show, h400, Test
Return
GuiClose:
GuiEscape:
ExitApp
CaptionClick:
   PostMessage, 0xA1, 2 ; WM_NCLBUTTONDOWN = 0xA1 , HTCAPTION = 2
Return
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Custom GUI

04 Oct 2014, 09:15

You can use just me's ImageButton.
Custom GUI 1.ahk
Image
Custom GUI 2.ahk
Image
floowsnaake
Posts: 7
Joined: 02 Sep 2014, 11:05

Re: Custom GUI

04 Oct 2014, 12:26

Useing pictures as GUI and Buttons
Image

Code: Select all

/*
Chatous Bot V30.1

Made by: Snow Flake | Time: 2014-09-14 21:14 GMT +1

Tested On/With:
Autohotkey_L Version: v1.1.14.03 and v1.1.15.02
Windows 7 x64 and Windows 8 x32
Google Chrome Version: 31.0.1650.63 m and 36.0.1985.125 m
screen resolution: 1336 x 768

Report bugs to me at:
http://www.autohotkey.com/board/user/21149-snow-flake/
Or find me in the Internet Relay Chat (IRC) https://kiwiirc.com/client/irc.freenode.net/
#ahk | #.ahk | #ahkscript 

*Notes
Chatous Bot V30.1 ONLY works in Chrome at the moment and the stranger must have a Gender Selected.
CTRL + R cant be used as a Toggle key biuse that key combination restarts Chatous Bot V30.1.1

--------------------
How to use it?
--------------------

1. Type a Toggle On/Off key  (Example: CTRL + D )
2. Press "Search For Someone" button if you want the bot to search for someone with a specific name.
3. Select "Keep Searching For More Even If Found"if you want the bot to find more than one found/make it loop.
2. Select "Females Only" or "Males Only" to Only find Males and skip the Females or to Only find the Females and skip the Males.
3. Select if you want a Sound to be Plaid when Chatous Bot finds the Gender you have selected in step nummber 2.
4. Select if you want the Selected to be added as your friend.
5. Use "Only Chat To Strangers From" if you want the bot to only find peapole from a specific country.
6. Type what you want to be sent to the Gender you select, then it will be sent when Chatous finds the Gender.
7. Type what you want to be sent to the Opposit Gender you select, then it will be sent when Chatous finds the Opposit Gender. 
8. Select "Save Settings" if you want the Bot to remember the setings you have made.
7. Press "Run" button.
8. Press the Toggle Key to stat the Bot, press it again to pause the bot.
9. press "Quit" button to exit ChatousBot.

*/
#NoEnv
#singleInstance, Force
#MaxThreads, 100
#MaxThreadsPerHotkey, 2
#Persistent
SetBatchLines, -1
DetectHiddenWindows, On
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen
SetTitleMatchMode, 2
SetKeyDelay, 30,50
SetMouseDelay 10
SendMode Event
#InstallKeybdHook
#InstallMouseHook
#UseHook, On
SetWorkingDir, %A_ScriptDir%/Files
toggle = 0 ; Toggle
counter = 0
counterx = 0
Config = Config.ini

IfExist, %Config%
{
IniRead, Msg2, %Config%, TextBox, Opposit
IniRead, Msg, %Config%, TextBox, Found

IniRead, Mode3, %Config%, Settings, Female
IniRead, Mode4, %Config%, Settings, Male

IniRead, Snd2, %Config%, Settings, Alarm
IniRead, Fre2, %Config%, Settings, Auto Friend
IniRead, Keep2, %Config%, Settings, Loop
IniRead, From2, %Config%, Settings, Search Country
IniRead, Sea2, %Config%, Settings, Someone
IniRead, Key, %Config%, Settings, Hotkey
}

Menu, Tray, Icon, 2.ico
OnMessage(0x201,"GuiMove")
Gui 1: -border hwndGUIHwnd 
Gui 1: Add, Picture,,Untitled.png
Gui 1: Color, 323A46
Gui 1: +LastFound +AlwaysOnTop -Caption +ToolWindow

Gui, Add, Hotkey, x53 y88 w120 h20 VKey, %key%
Gui, Add, Radio, x39 y156 w50 h20 VMode,
Gui, Add, Radio, x150 y156 w50 h20VMode2, 
Gui, Add, Checkbox, x39 y216 w50 h20 VSnd,

Gui, Add, Checkbox, x40 y463 w80 h20 VSave,

Gui, Add, Checkbox, x147 y212 w50 h20 VFre,
Gui, Add, Checkbox, x260 y210 w50 h20 VKeep,

Gui, Add, Edit, x49 y268 w140 h50 VMsg, *Friendly Hug*
Gui, Add, Edit, x49 y353 w140 h50 VMsg2, I HATE YOU! 

Gui, Add, Picture,  x16 y494 w90 h23 gRun, run.png
Gui, Add, Picture,  x172 y494 w90 h23 gQuit, Exit.png
Gui 1:  Show,,chatous 3

GuiControl,, Mode, %Mode3%
GuiControl,, Mode2, %Mode4%

GuiControl,, Snd, %Snd2%
GuiControl,, Fre, %Fre2%
GuiControl,, Keep, %Keep2%

return


  GuiMove() 
{ global GUIHwnd
  PostMessage, 0xA1, 2,,, % "ahk_id " GUIHwnd
}

Quit:
ExitApp

Run:
Gui, Submit

IF (Save = 1)
{
IniWrite, %Msg2%,%Config%, TextBox, Opposit
IniWrite, %Msg%,%Config%, TextBox, Found

IniWrite, %Mode%,%Config%, Settings, Female
IniWrite, %Mode2%,%Config%, Settings, Male

IniWrite, %Snd%,%Config%, Settings, Alarm
IniWrite, %Fre%,%Config%, Settings, Auto Friend
IniWrite, %Keep%,%Config%, Settings, Loop
IniWrite, %Key%,%Config%, Settings, Hotkey
}


IF (Mode = 1)
{
Skipper := "Male"
}
else
{
Skipper := "Female"
}


IF (Skipper = "Female") 
{
Found := "Male"	
}

IF (Skipper = "Male") 
{
Found := "Female"	
}

WinActivate, Chatous - Random Chat - Google Chrome
WinMaximize, Chatous - Random Chat - Google Chrome

MsgBox,,ChatousBot V30.1,Hello and Welcome to chatousbot`n`n Pleach make sure that you have Chrome running with Chatous. `n`nThen Press %key% to make the bot start searching for the Gender you have selected`n`n Pres the Same key again to make the bot pause/stop.,

TrayTip, ChatousBot V30.1, Press %key% to start

Hotkey, %Key%,LKey
return

LKey:

WinActivate, Chatous - Random Chat - Google Chrome
WinMaximize, Chatous - Random Chat - Google Chrome

ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, NewChat.png
sleep, 200
Click, %FoundX%, %FoundY% Left, 1
MouseMove, %A_ScreenWidth%, %A_ScreenHeight%
Tooltip, Chatous Bot V30.1`n`nSkipped: %counter% %Skipper% `nFound: %counterx% %Found%,%A_ScreenWidth%, %A_ScreenHeight%
sleep, 300


Toggle := !Toggle
While Toggle
{
ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, %Skipper%.png
If ErrorLevel = 0
{
Tooltip, Chatous Bot V30.1`n`nSkipped: %counter% %Skipper% `nFound: %counterx% %Found%,%A_ScreenWidth%, %A_ScreenHeight%

/*
IF (Msg2!="")
{
Send, %Msg2%
sleep, 300
send, {Enter}
}
*/
sleep, 300
send, {Esc 2}
counter += 1
}


ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, Ended.png
If ErrorLevel = 0
{
send, {Esc}
}

ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, Save.png
If ErrorLevel = 0
{
Click, %FoundX%, %FoundY% Left, 1
MouseMove, %A_ScreenWidth%, %A_ScreenHeight%
}

ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, %Found%.png
If ErrorLevel = 0
{
sleep, 300	

counterx += 1

IF (Snd = 1)
{
SoundPlay, Alert.wav 
sleep, 200
}

IF (Msg!="")
{
Send, %Msg%
sleep, 300
send, {Enter}
}

IF (Fre = 1)
{
ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, Friend.png
sleep, 200
Click, %FoundX%, %FoundY% Left, 1
}

IF (Keep = 1)
{
ImageSearch, FoundX, FoundY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, NewChat.png
sleep, 200
Click, %FoundX%, %FoundY% Left, 1
MouseMove, %A_ScreenWidth%, %A_ScreenHeight%
}
else
{
break
sleep, 400
Tooltip, Chatous Bot V30.1`n`nSkipped: %counter% %Skipper% `nFound: %counterx% %Found%,%A_ScreenWidth%, %A_ScreenHeight%
} ; Keep
} ; If Found

} ;Toggle 

^S::Reload
MegaloDon
Posts: 107
Joined: 22 Jul 2014, 17:54

Re: Custom GUI

04 Oct 2014, 14:25

just me wrote:One of SKAN's tricks:
Thank you! This works quite well:

Code: Select all

#NoEnv
SetWorkingDir %A_ScriptDir%
Gui, -Caption
Gui, Margin, 0, 0
Gui, Add, Picture, x400 y5 w21 h21 gExitSub
Gui, Add, Picture, x0 y0 Center gCaptionClick, Title.gif
Gui, Show, h400
Return

ExitSub:
ExitApp

CaptionClick:
   PostMessage, 0xA1, 2 ; WM_NCLBUTTONDOWN = 0xA1 , HTCAPTION = 2
Return
Image
(Save above image as "Title.gif" to test it.)

Just need to figure out how to get rid of the hard corners and add resize capability.
tmplinshi wrote:You can use just me's ImageButton.
When I tried this, I got an error.

Image
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Custom GUI

04 Oct 2014, 14:30

MegaloDon wrote: When I tried this, I got an error.

Image
That's because of the forum issue. Please copy the code directly in the browser, instead of click download.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Custom GUI

04 Oct 2014, 14:55

Here is a way to handle the corners:

Save this image to Title.gif:
Image

Then:

Code: Select all

Gui +LastFound
WinSet, TransColor, 00FF00
Gui, -Caption
...your original code here
MegaloDon
Posts: 107
Joined: 22 Jul 2014, 17:54

Re: Custom GUI

04 Oct 2014, 18:12

tmplinshi wrote:That's because of the forum issue. Please copy the code directly in the browser, instead of click download.
Thanks, that fixed it!
tmplinshi wrote:Here is a way to handle the corners:
Yup, that works too. Thank you very much!
MegaloDon
Posts: 107
Joined: 22 Jul 2014, 17:54

Re: Custom GUI

05 Oct 2014, 01:01

Anybody have any thoughts on how to add resize? If you add Gui, +Resize, it puts a border around it. Is there a way to get rid of the border or make it transparent?
MegaloDon
Posts: 107
Joined: 22 Jul 2014, 17:54

Re: Custom GUI

08 Oct 2014, 19:18

Ok, so I've been googling how to hide the resize borders, etc. and have come up with nothing. Is there something like SKAN's trick that can be used for resizing? I'm not sure how PostMessage works. I have made my own borders with pics and it seems like they could be used for that. Also, if you don't use Gui, +Resize, will the built-in GuiSize subroutine still work?

Image

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Descolada, Google [Bot], moltenchees and 159 guests