PeterOctavio Posted June 7, 2017 Share Posted June 7, 2017 (edited) The original idea was to criticize the button and the script disappears for a few seconds at least 5 seconds ... and what they tell me. Ai galera, I am the newest user to register in the forum and I need a little help in this script #include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt("GUIOnEventMode", 1) $gui = GUICreate(" ·.·.·", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("Button1", 5, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button1") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xff0000); Red DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in GUISetState() While 1 Sleep(50) WEnd Func button1() ShellExecute("AutoIt3.exe", "/autoit1.au3", @ScriptDir) EndFunc Edited June 15, 2017 by JLogan3o13 Added Code Formatting Link to comment Share on other sites More sharing options...
Jefrey Posted June 10, 2017 Share Posted June 10, 2017 (edited) Try this one: Func button1() If @Compiled Then ShellExecute(@ScriptFullPath) Else ShellExecute(@AutoItExe, @ScriptFullPath) EndIf Exit EndFunc Quote Ai galera BR? Edited June 10, 2017 by Jefrey PeterOctavio 1 My stuff Spoiler My UDFs _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS · storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 10, 2017 Author Share Posted June 10, 2017 (edited) vlw, It works perfect... Edited June 10, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 10, 2017 Author Share Posted June 10, 2017 (edited) Now how do I make it faster and drag free on the screen #include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt("GUIOnEventMode", 1) $gui = GUICreate(" ·.·.·", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("fresh", 5, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button1") $button2 = GUICtrlCreateButton("Off", 50, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button2") DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in WinSetOnTop(" ·.·.·", "", 1) TraySetState() GUISetState() Func button2() Exit EndFunc Func button1() If @Compiled Then ShellExecute(@ScriptFullPath) Else ShellExecute(@AutoItExe, @ScriptFullPath) EndIf Exit EndFunc While 1 Sleep(10) WEnd Edited June 10, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
Jefrey Posted June 11, 2017 Share Posted June 11, 2017 Quote vlw Yes, you are BR Quote drag free on the screen Do the following patches: $gui = GUICreate(" ·.·.·", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("fresh", 5, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button1") $button2 = GUICtrlCreateButton("Off", 50, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button2") ; disable close button $hMenu = _GUICtrlMenu_GetSystemMenu($gui) _GUICtrlMenu_EnableMenuItem($hMenu, $SC_CLOSE, $MF_GRAYED, False) DllCall ... Quote make it faster You mean, having the "fresh" button to reload the script faster? You can't... It's not possible to control how fast a file will open, as it depends on Windows, and not on AutoIt. However you could create a function that reloads your script, resets variables to their default values and windows to the standard position. You said you want the script (I assume GUI) to disappear for 5 secs, so here's how: expandcollapse popup#include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIMenu.au3> Opt("GUIOnEventMode", 1) Global $gui Func _Main() $gui = GUICreate(" ·.·.·", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("fresh", 5, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button1") $button2 = GUICtrlCreateButton("Off", 50, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button2") ; disable close button $hMenu = _GUICtrlMenu_GetSystemMenu($gui) _GUICtrlMenu_EnableMenuItem($hMenu, $SC_CLOSE, $MF_GRAYED, False) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in WinSetOnTop($gui, "", 1) ; it's better to use the window hwnd, it's safer and faster than using the window title TraySetState() GUISetState() EndFunc _Main() Func button2() Exit EndFunc Func button1() GUIDelete($gui) Sleep(5000) ; 5000 miliseconds = 5 secs _Main() EndFunc While 1 Sleep(10) WEnd In this case, you can set the amount of seconds that your script will disappear on the Sleep() inside the button1() function. My stuff Spoiler My UDFs _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS · storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 14, 2017 Author Share Posted June 14, 2017 So dude, thanks for that code. It was cool, excerpt that when I click fresh, it disappears but does not reappear in the place where I left it on the screen, it always returns to the place fixed in the script settings. How much it makes it faster, in case it was enough the background of the window to be transparent #include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt("GUIOnEventMode", 1) $gui = GUICreate(" ·.·.·", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("fresh", 5, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button1") $button2 = GUICtrlCreateButton("Off", 50, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button2") DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in WinSetOnTop(" ·.·.·", "", 1) TraySetState() GUISetState() Func button2() Exit EndFunc Func button1() If @Compiled Then ShellExecute(@ScriptFullPath) Else ShellExecute(@AutoItExe, @ScriptFullPath) EndIf Exit EndFunc While 1 Sleep(10) WEnd Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 15, 2017 Author Share Posted June 15, 2017 Look, I had a better idea, like I do in this last script I posted, so when I click on another windows window, make the script move forward, as yours would push alt + tab??? Link to comment Share on other sites More sharing options...
Jefrey Posted June 15, 2017 Share Posted June 15, 2017 Quote So dude, thanks for that code. It was cool, excerpt that when I click fresh, it disappears but does not reappear in the place where I left it on the screen, it always returns to the place fixed in the script settings. How much it makes it faster, in case it was enough the background of the window to be transparent Try this. Here we just hide the window rather than deleting/recreating it. expandcollapse popup#include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIMenu.au3> Opt("GUIOnEventMode", 1) Global $gui Func _Main() $gui = GUICreate(" ·.·.·", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), -1, $WS_EX_TOOLWINDOW) $button1 = GUICtrlCreateButton("fresh", 5, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button1") $button2 = GUICtrlCreateButton("Off", 50, 65, 40, 20) GUICtrlSetOnEvent(-1, "Button2") ; disable close button $hMenu = _GUICtrlMenu_GetSystemMenu($gui) _GUICtrlMenu_EnableMenuItem($hMenu, $SC_CLOSE, $MF_GRAYED, False) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in WinSetOnTop($gui, "", 1) ; it's better to use the window hwnd, it's safer and faster than using the window title TraySetState() GUISetState() EndFunc _Main() Func button2() Exit EndFunc Func button1() GUISetState(@SW_HIDE, $gui) Sleep(5000) ; 5000 miliseconds = 5 secs GUISetState(@SW_SHOW, $gui) EndFunc While 1 Sleep(10) WEnd Quote Look, I had a better idea, like I do in this last script I posted, so when I click on another windows window, make the script move forward, as yours would push alt + tab??? Hm I couldn't get what you mean... do you mean setting other windows on top when you click them? My stuff Spoiler My UDFs _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS · storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 16, 2017 Author Share Posted June 16, 2017 First scrip (file 1) #include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt("GUIOnEventMode", 1) $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in WinSetOnTop("hidecard", "", 0) GUISetState() HotKeySet("{ESC}","Quit") ;Press ESC key to quit While True ;Here start main loop Sleep(20) WEnd Func Quit() Exit EndFunc Second script (file) #include <AutoItConstants.au3> Example() Func Example() ; Retrieve the handle of the active window. Local $hWnd = WinGetHandle("hidecard") ; Set the active window as being ontop using the handle returned by WinGetHandle. WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) ; Remove the "topmost" state from the active window. WinSetOnTop($hWnd, "", $WINDOWS_NOONTOP) EndFunc ;==>Example HotKeySet("{ESC}","Quit") ;Press ESC key to quit While True ;Here start main loop Sleep(2000) WEnd Func Quit() Exit EndFunc You're seeing these two files there, so why am I not making them work? You have to stay both open, one makes the other go to the front of the screen in 5 seconds, see if I'm right, that's all I want ... or the other part you did to turn into a window! Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 16, 2017 Author Share Posted June 16, 2017 I'm wrong in the script "bring window forward" Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 16, 2017 Author Share Posted June 16, 2017 Is missing there, is to check if the window is at the top, have to check every 3 seconds, is it possible? Link to comment Share on other sites More sharing options...
Deye Posted June 17, 2017 Share Posted June 17, 2017 why do you need to check if the windows is on top every 3 seconds if you are going to set it as top anyways you can simply put in the second script : While True ;Here start main loop Sleep(3000) WinSetOnTop("hidecard", "", 1) WinSetOnTop("hidecard", "", 0) WEnd Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 17, 2017 Author Share Posted June 17, 2017 (edited) hahahaha Almost there, I confused myself with the script, instead of Winsetontop is actually WinActive ... #include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt("GUIOnEventMode", 1) $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008); slide-in WinSetOnTop($gui, "", 0) GUISetState() ;RUM IF NOTEPAD (JUST AN EXAMPLE) IS OPEN ;BUTTON PAUSE WINACTIVATE ;BUTTON EXIT ;HAVE THE FUNCTION OF DRAGING TO ANOTHER SCREEN OR ;BEFORE DRAWING ANYWHERE OF THE SCREEN WITH ANY SIZE While True Sleep(1000) ;1 SECOND FOR CHECK WinActivate ("hidecard") WEnd Now I have to put it to work in a specific softwre, to hide details of the screen ... my problem is that with winactive the script goes ahead preventing me from typing, so I have to pause, the window has to go to Front but do not interrupt what I was using. Edited June 17, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
Deye Posted June 17, 2017 Share Posted June 17, 2017 Something like this ? If $gui <> _WinAPI_GetForegroundWindow() Then Sleep(3000) WinSetOnTop($gui, "", 1) WinSetOnTop($gui, "", 0) EndIf Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 17, 2017 Author Share Posted June 17, 2017 (edited) What do I do with it? Edited June 17, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 17, 2017 Author Share Posted June 17, 2017 #include <WinAPI.au3> ??? Link to comment Share on other sites More sharing options...
Deye Posted June 17, 2017 Share Posted June 17, 2017 (edited) You put that at the top of your script (where the other includes are at) , check out #include in the help file #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("GUIOnEventMode", 1) $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008) ; slide-in GUISetState() While 1 Sleep(3000) _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) _WinAPI_SetWindowPos($gui, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) WEnd Edited June 17, 2017 by Deye Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 17, 2017 Author Share Posted June 17, 2017 (edited) This example is legal, but using the notepad, clicking on the title bar (of the notepad) works perfectly, but clicking on the text area is not working #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("GUIOnEventMode", 1) $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008) ; slide-in GUISetState() While 1 Sleep(3000) _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) _WinAPI_SetWindowPos($gui, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) WEnd Edited June 17, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
Deye Posted June 17, 2017 Share Posted June 17, 2017 (edited) Well if this got you closer to what you wanted then there you have it You can use the various functions available to tailor the outcome to your needs within the limits, I guess .. #include <misc.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Local $hDLL = DllOpen("user32.dll") Local $gui = GUICreate("hidecard", 100, 100, @DesktopWidth - (700 + 100), @DesktopHeight - (700 + 100), $WS_POPUP, $WS_EX_TOOLWINDOW) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008) ; slide-in GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If _IsPressed("01", $hDLL) Then ;Left mouse click _WinAPI_SetWindowPos($gui, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_HIDEWINDOW)) While _IsPressed("01", $hDLL) Sleep(3000) WEnd DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui, "int", 200, "long", 0x00040008) ; slide-in _WinAPI_SetWindowPos($gui, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE, $SWP_SHOWWINDOW)) EndIf Sleep(10) WEnd Edited June 17, 2017 by Deye Link to comment Share on other sites More sharing options...
PeterOctavio Posted June 18, 2017 Author Share Posted June 18, 2017 (edited) tanks everyone Edited June 18, 2017 by PeterOctavio Link to comment Share on other sites More sharing options...
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