Iznogoud Posted January 22, 2014 Posted January 22, 2014 I want to create a button wich i can place in the bottom right corner of the screen wich is always ontop and when pressed it executes an executable. #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ButtonConstants.au3> $MainWindow = GUICreate ("Example", 40, 40, "-1", "-1", 0x80880008) GUICtrlCreateButton("Button", 0, 0, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "C:\Keyboard.ico", 22) GUICtrlSetState(-1, $GUI_ONTOP) GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect Wend This looks strange because the button is inside the GUI and you always see the border. I would prefer to have an image wich i can click and execute the program, but i don't know how. In my code above you see the $GUI_ONTOP, but this doesn't work, even if i comment out the GUICtrlSetImage code it doesn't work. In simple words i am looking for an image wich is always ontop in the bottom right corner wich i could click the show the onscreen keyboard wich is already available in windows 7. Could someone help me with this. I am stuck at the moment.
l3ill Posted January 22, 2014 Posted January 22, 2014 Have you had a look at $WS_EX_TOPMOST My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
JohnOne Posted January 22, 2014 Posted January 22, 2014 For some reason that const is not getting found for me. ;#include <Constants.au3> #include <GUIConstantsEx.au3> ;#include <GuiEdit.au3> #include <ButtonConstants.au3> $MainWindow = GUICreate("Example", 40, 40, -1, -1, 0x80880008, 0x00000008) ;0x00000008 = WS_EX_TOPMOST $button = GUICtrlCreateButton("Button", 0, 0, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "C:\Keyboard.ico", 22) GUICtrlSetState(-1, $GUI_ONTOP) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button Exit EndSwitch WEnd AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
l3ill Posted January 22, 2014 Posted January 22, 2014 #include <WindowsConstants.au3> http://www.autoitscript.com/autoit3/docs/appendix/GUIStyles.htm from here... My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Moderators Melba23 Posted January 22, 2014 Moderators Posted January 22, 2014 JohnOne,As its WS prefix indicates, it is in WindowsConstants.au3. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JohnOne Posted January 22, 2014 Posted January 22, 2014 Schoolboy error, duh! AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators Melba23 Posted January 22, 2014 Moderators Posted January 22, 2014 JohnOne,Could happen to anyone..... M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JohnOne Posted January 22, 2014 Posted January 22, 2014 Now where have I heard that before AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Iznogoud Posted January 22, 2014 Author Posted January 22, 2014 For some reason that const is not getting found for me. ;#include <Constants.au3> #include <GUIConstantsEx.au3> ;#include <GuiEdit.au3> #include <ButtonConstants.au3> $MainWindow = GUICreate("Example", 40, 40, -1, -1, 0x80880008, 0x00000008) ;0x00000008 = WS_EX_TOPMOST $button = GUICtrlCreateButton("Button", 0, 0, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "C:\Keyboard.ico", 22) GUICtrlSetState(-1, $GUI_ONTOP) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button Exit EndSwitch WEnd Thanks, that is looking alot better. Anyone an idea how to show it like an image instead of a button inside a GUI? So i don't get that ugly design?
JohnOne Posted January 22, 2014 Posted January 22, 2014 (edited) Put it on a label instead. EDIT: $button = GUICtrlCreateLabel("Button", 0, 0, 40, 40, $BS_ICON) Edited January 22, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted January 22, 2014 Posted January 22, 2014 Or maybe a pic control. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> ;#include <GuiEdit.au3> #include <ButtonConstants.au3> $MainWindow = GUICreate("Example", 40, 40, -1, -1, 0x80880008, $WS_EX_TOPMOST) ;0x00000008 = $button = GUICtrlCreatePic("temp01.bmp", 0, 0, 40, 40) ;GUICtrlSetImage(-1, "temp01.bmp", 22) ;GUICtrlSetState(-1, $GUI_ONTOP) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button Exit EndSwitch WEnd AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Iznogoud Posted January 22, 2014 Author Posted January 22, 2014 Weird...... How hard can it be to get this done #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> ;#include <GuiEdit.au3> #include <ButtonConstants.au3> $MainWindow = GUICreate("Example", 40, 40, -1, -1, 0x80880008, $WS_EX_TOPMOST) ;0x00000008 = $button = GUICtrlCreatePic("C:\Keyboard.jpg", 0, 0, 40, 40) ;GUICtrlSetImage(-1, "temp01.bmp", 22) ;GUICtrlSetState(-1, $GUI_ONTOP) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button Run("C:\Windows\System32\osk.exe", "C:\Windows\system32\", @SW_MAXIMIZE) EndSwitch WEnd The Run command is easy and simple but it doesn't work in this script. In my other script it does, can someone help me why it doesn't work now?
l3ill Posted January 22, 2014 Posted January 22, 2014 Try ShellExecute My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
JohnOne Posted January 22, 2014 Posted January 22, 2014 Odd, put a msgbox before your run function to test the message is being actioned upon. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Iznogoud Posted January 22, 2014 Author Posted January 22, 2014 (edited) ShellExecute is not working either. When i put a MsgBox in front of it, it shows the Box first. When i change the executable to Notepad.exe it is working. Weird......... ;#include <Constants.au3> #include <GUIConstantsEx.au3> ;#include <GuiEdit.au3> #include <ButtonConstants.au3> $MainWindow = GUICreate("Example", 40, 40, -1, -1, 0x80880008, 0x00000008) ;0x00000008 = WS_EX_TOPMOST $button = GUICtrlCreateButton("Button", 0, 0, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "C:\Keyboard.ico", 22) GUICtrlSetState(-1, $GUI_ONTOP) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button MsgBox(0, "Error", "Error") ShellExecute("C:\Windows\System32\osk.exe") EndSwitch WEnd Edited January 22, 2014 by Iznogoud
BrewManNH Posted January 22, 2014 Posted January 22, 2014 Try using @SystemDir & "osk.exe" instead of C:WindowsSystem32osk.exe and see if that makes a difference. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
l3ill Posted January 22, 2014 Posted January 22, 2014 Well I am @ home where I can test now and >this works My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
l3ill Posted January 22, 2014 Posted January 22, 2014 I'm all for learning to code and building and stuff but... you could put a shortcut on your desktop and give it it's own keyboard shortcut... just sayin' My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Gianni Posted January 22, 2014 Posted January 22, 2014 (edited) Try using @SystemDir & "osk.exe" instead of C:WindowsSystem32osk.exe and see if that makes a difference. this also do not works on win7 x64 this other works instead: #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> $MainWindow = GUICreate("Example", 40, 40, -1, -1, 0x80880008, 0x00000008) ;0x00000008 = WS_EX_TOPMOST $button = GUICtrlCreateButton("Button", 0, 0, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "C:\Keyboard.ico", 22) GUICtrlSetState(-1, $GUI_ONTOP) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $button _Wow64FsRedirection(False) Run("osk") _Wow64FsRedirection(True) EndSwitch WEnd Func _Wow64FsRedirection($state) ; Disables or reverts the filesystem redirector for a 32 bit process running on 64bit OS If Not @AutoItX64 And @OSArch = 'X64' Then If $state Then DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection", "int", 0) Else DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0) EndIf EndIf EndFunc (edit: submitted complete listing instead of only a portion) I'm all for learning to code and building and stuff but... you could put a shortcut on your desktop and give it it's own keyboard shortcut... just sayin' ... how do you set a shortcut always on top? Edited March 14, 2014 by PincoPanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now