Sign in to follow this  
Followers 0
GodandRock

Scripting Help

8 posts in this topic

Hey guys, its been a long time since I posted on here, I got busy with other stuff and I need some help in this script I'm making. The purpose of the script is to hide windows, then unhide them. The problem I'm having is with the GUI stuff. I wanted to use a hotkey to bring up the window and then the same hotkey to bring up the password window which will unhide all the windows. Here, I'll post the code and you guys help me out.

Global $AutoHide_GUI, $Button_Hide, $Button_UnHide, $Checkbox_Chats, $Checkbox_D2, $CheckBox_IE, $Group_Checkboxes, $InputPW_GUI, $Input_PW, $Unhide_done

#include <String.au3>
Opt("WinTitleMatchMode", 2)
#include <GUIConstants.au3>
HotKeySet("!z", "Auto_Hide")


Func Auto_Hide()
 $Unhide_done = 0
; == GUI generated with Koda ==);
 $AutoHide_GUI = GUICreate("Auto Hide", 241, 337, 231, 129)
 GUISetBkColor(0x000000)
 $Group_Checkboxes = GUICtrlCreateGroup("Hide:", 32, 104, 177, 145)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlCreateGroup("", -99, -99, 1, 1)
 GUICtrlCreateLabel("Auto Hide", 59, 24, 122, 49)
 GUICtrlSetFont(-1, 30, 400, 0, "GlooGun")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 $CheckBox_IE = GUICtrlCreateCheckbox("", 48, 176, 17, 17)
 GUICtrlSetState(-1, $GUI_CHECKED)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlSetTip(-1, "Hide all IE windows.")
 $Checkbox_Chats = GUICtrlCreateCheckbox("", 48, 136, 17, 17)
 GUICtrlSetState(-1, $GUI_CHECKED)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlSetTip(-1, "Hide all chat windows.")
 $Checkbox_D2 = GUICtrlCreateCheckbox("", 48, 216, 17, 17)
 GUICtrlSetState(-1, $GUI_CHECKED)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlSetTip(-1, "Hide D2 window.")
 $Button_Hide = GUICtrlCreateButton("Hide!", 52, 272, 137, 51, $BS_DEFPUSHBUTTON)
 GUICtrlSetFont(-1, 30, 400, 0, "GlooGun")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetCursor($Button_Hide, 0)
 GUICtrlCreateLabel("Chats", 65, 132, 50, 27)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlSetTip(-1, "Hide all chat windows.")
 GUICtrlCreateLabel("Internet Explorer", 65, 172, 135, 27)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlSetTip(-1, "Hide all IE windows.")
 GUICtrlCreateLabel("Diablo 2", 65, 212, 68, 27)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 GUICtrlSetTip(-1, "Hide D2 window.")
 GUISetState(@SW_SHOW)
 While 1
  $msg = GUIGetMsg()
  Select
   Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    
    
    
   Case $msg = $Button_Hide
    
    
    
    GUISetState(@SW_HIDE)
    HotKeySet("!z")
    HotKeySet("!z", "Unhide")
    
    While 1
     
     If $Unhide_done = 1 Then
      ExitLoop
     EndIf
     
     WinSetState("Palm", "", @SW_HIDE)
     
     If $Unhide_done = 1 Then
      ExitLoop
     EndIf
     
     
     If GUICtrlRead($Checkbox_Chats) = $GUI_CHECKED Then
      
      WinSetState("MSN Messenger", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Yahoo! Messenger", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Instant Message", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("- Conversation", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Voice Chat", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Offline Messages", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Text Message", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("TopazChat", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("MSN", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Chat Room", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("- Chat Window", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Xfire", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("- Group Chat", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Webcam for", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Sign On", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Sign In", "", @SW_HIDE)
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      
      WinSetState("Accept Message - ", "", @SW_HIDE)
     ;WinSetState("MSN", "", @SW_HIDE)
     EndIf
     
     
     
     
     If GUICtrlRead($CheckBox_IE) = $GUI_CHECKED Then
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      WinSetState("- Microsoft Internet Explorer", "", @SW_HIDE)
     EndIf
     
     If GUICtrlRead($Checkbox_D2) = $GUI_CHECKED Then
      If $Unhide_done = 1 Then
       ExitLoop
      EndIf
      WinSetState("Diablo II", "", @SW_HIDE)
     EndIf
     
     
     
     
     
     
     
     
     
    WEnd
    
    
    If $Unhide_done = 1 Then
     ExitLoop
    EndIf
    
    
    
    
    
  EndSelect
 WEnd
EndFunc  ;==>Auto_Hide

 


Func Unhide()
; == GUI generated with Koda ==);
 $InputPW_GUI = GUICreate("Auto Hider", 361, 169, 192, 125)
 GUISetBkColor(0x000000)
 GUICtrlCreateLabel("Enter password to un-hide hidden windows.", 8, 16, 344, 27)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetBkColor(-1, 0x000000)
 $Input_PW = GUICtrlCreateInput("", 96, 72, 161, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
 $Button_UnHide = GUICtrlCreateButton("Un-Hide!", 120, 112, 113, 41, $BS_DEFPUSHBUTTON)
 GUICtrlSetFont(-1, 14, 400, 0, "Impact")
 GUICtrlSetColor(-1, 0xFF0000)
 GUICtrlSetCursor($Button_UnHide, 0)
 GUISetState(@SW_SHOW)
 While 1
  $msg = GUIGetMsg()
  Select
   Case $msg = $GUI_EVENT_CLOSE
    MsgBox(0, "", "tries to close")
    ExitLoop
   Case $msg = $Button_UnHide
    
       
     GUISetState(@SW_HIDE)
     WinSetState("Palm", "", @SW_SHOW)
     If GUICtrlRead($Checkbox_Chats) = $GUI_CHECKED Then
      
      WinSetState("MSN Messenger", "", @SW_SHOW)
      WinSetState("Yahoo! Messenger", "", @SW_SHOW)
      WinSetState("Instant Message", "", @SW_SHOW)
      WinSetState("- Conversation", "", @SW_SHOW)
      WinSetState("Voice Chat", "", @SW_SHOW)
      WinSetState("Offline Messages", "", @SW_SHOW)
      WinSetState("Text Message", "", @SW_SHOW)
      WinSetState("TopazChat", "", @SW_SHOW)
      WinSetState("MSN", "", @SW_SHOW)
      WinSetState("Chat Room", "", @SW_SHOW)
      WinSetState("- Chat Window", "", @SW_SHOW)
      WinSetState("Xfire", "", @SW_SHOW)
      WinSetState("- Group Chat", "", @SW_SHOW)
      WinSetState("Webcam for", "", @SW_SHOW)
      WinSetState("Sign On", "", @SW_SHOW)
      WinSetState("Sign In", "", @SW_SHOW)
      WinSetState("Accept Message - ", "", @SW_SHOW)
      
      
      
          
     If GUICtrlRead($CheckBox_IE) = $GUI_CHECKED Then
      WinSetState("- Microsoft Internet Explorer", "", @SW_SHOW)
     EndIf
     
     If GUICtrlRead($Checkbox_D2) = $GUI_CHECKED Then
      WinSetState("Diablo II", "", @SW_SHOW)
     EndIf
     
     
     
     HotKeySet("!z")
     HotKeySet("!z", "Auto_Hide")
     $Unhide_done = 1
     ExitLoop
     
    EndIf
  EndSelect
 WEnd
EndFunc  ;==>Unhide

 

While 1
 Sleep(100)
WEnd

What problem I'm having with that is that when I press the hotkey to bring up the password window, it INTERRUPTS the hiding process, which I put in loop on purpose. So it will stop hiding, is there a way to re-script this in some better way?


[font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hey guys, its been a long time since I posted on here, I got busy with other stuff and I need some help in this script I'm making. The purpose of the script is to hide windows, then unhide them. The problem I'm having is with the GUI stuff. I wanted to use a hotkey to bring up the window and then the same hotkey to bring up the password window which will unhide all the windows. Here, I'll post the code and you guys help me out.

CODE
Global $AutoHide_GUI, $Button_Hide, $Button_UnHide, $Checkbox_Chats, $Checkbox_D2, $CheckBox_IE, $Group_Checkboxes, $InputPW_GUI, $Input_PW, $Unhide_done

#include <String.au3>

Opt("WinTitleMatchMode", 2)

#include <GUIConstants.au3>

HotKeySet("!z", "Auto_Hide")

Func Auto_Hide()

$Unhide_done = 0

; == GUI generated with Koda ==);

$AutoHide_GUI = GUICreate("Auto Hide", 241, 337, 231, 129)

GUISetBkColor(0x000000)

$Group_Checkboxes = GUICtrlCreateGroup("Hide:", 32, 104, 177, 145)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateLabel("Auto Hide", 59, 24, 122, 49)

GUICtrlSetFont(-1, 30, 400, 0, "GlooGun")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

$CheckBox_IE = GUICtrlCreateCheckbox("", 48, 176, 17, 17)

GUICtrlSetState(-1, $GUI_CHECKED)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetTip(-1, "Hide all IE windows.")

$Checkbox_Chats = GUICtrlCreateCheckbox("", 48, 136, 17, 17)

GUICtrlSetState(-1, $GUI_CHECKED)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetTip(-1, "Hide all chat windows.")

$Checkbox_D2 = GUICtrlCreateCheckbox("", 48, 216, 17, 17)

GUICtrlSetState(-1, $GUI_CHECKED)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetTip(-1, "Hide D2 window.")

$Button_Hide = GUICtrlCreateButton("Hide!", 52, 272, 137, 51, $BS_DEFPUSHBUTTON)

GUICtrlSetFont(-1, 30, 400, 0, "GlooGun")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetCursor($Button_Hide, 0)

GUICtrlCreateLabel("Chats", 65, 132, 50, 27)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetTip(-1, "Hide all chat windows.")

GUICtrlCreateLabel("Internet Explorer", 65, 172, 135, 27)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetTip(-1, "Hide all IE windows.")

GUICtrlCreateLabel("Diablo 2", 65, 212, 68, 27)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

GUICtrlSetTip(-1, "Hide D2 window.")

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_Hide

GUISetState(@SW_HIDE)

HotKeySet("!z")

HotKeySet("!z", "Unhide")

While 1

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Palm", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

If GUICtrlRead($Checkbox_Chats) = $GUI_CHECKED Then

WinSetState("MSN Messenger", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Yahoo! Messenger", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Instant Message", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("- Conversation", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Voice Chat", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Offline Messages", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Text Message", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("TopazChat", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("MSN", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Chat Room", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("- Chat Window", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Xfire", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("- Group Chat", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Webcam for", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Sign On", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Sign In", "", @SW_HIDE)

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Accept Message - ", "", @SW_HIDE)

;WinSetState("MSN", "", @SW_HIDE)

EndIf

If GUICtrlRead($CheckBox_IE) = $GUI_CHECKED Then

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("- Microsoft Internet Explorer", "", @SW_HIDE)

EndIf

If GUICtrlRead($Checkbox_D2) = $GUI_CHECKED Then

If $Unhide_done = 1 Then

ExitLoop

EndIf

WinSetState("Diablo II", "", @SW_HIDE)

EndIf

WEnd

If $Unhide_done = 1 Then

ExitLoop

EndIf

EndSelect

WEnd

EndFunc ;==>Auto_Hide

Func Unhide()

; == GUI generated with Koda ==);

$InputPW_GUI = GUICreate("Auto Hider", 361, 169, 192, 125)

GUISetBkColor(0x000000)

GUICtrlCreateLabel("Enter password to un-hide hidden windows.", 8, 16, 344, 27)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetBkColor(-1, 0x000000)

$Input_PW = GUICtrlCreateInput("", 96, 72, 161, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))

$Button_UnHide = GUICtrlCreateButton("Un-Hide!", 120, 112, 113, 41, $BS_DEFPUSHBUTTON)

GUICtrlSetFont(-1, 14, 400, 0, "Impact")

GUICtrlSetColor(-1, 0xFF0000)

GUICtrlSetCursor($Button_UnHide, 0)

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

MsgBox(0, "", "tries to close")

ExitLoop

Case $msg = $Button_UnHide

GUISetState(@SW_HIDE)

WinSetState("Palm", "", @SW_SHOW)

If GUICtrlRead($Checkbox_Chats) = $GUI_CHECKED Then

WinSetState("MSN Messenger", "", @SW_SHOW)

WinSetState("Yahoo! Messenger", "", @SW_SHOW)

WinSetState("Instant Message", "", @SW_SHOW)

WinSetState("- Conversation", "", @SW_SHOW)

WinSetState("Voice Chat", "", @SW_SHOW)

WinSetState("Offline Messages", "", @SW_SHOW)

WinSetState("Text Message", "", @SW_SHOW)

WinSetState("TopazChat", "", @SW_SHOW)

WinSetState("MSN", "", @SW_SHOW)

WinSetState("Chat Room", "", @SW_SHOW)

WinSetState("- Chat Window", "", @SW_SHOW)

WinSetState("Xfire", "", @SW_SHOW)

WinSetState("- Group Chat", "", @SW_SHOW)

WinSetState("Webcam for", "", @SW_SHOW)

WinSetState("Sign On", "", @SW_SHOW)

WinSetState("Sign In", "", @SW_SHOW)

WinSetState("Accept Message - ", "", @SW_SHOW)

If GUICtrlRead($CheckBox_IE) = $GUI_CHECKED Then

WinSetState("- Microsoft Internet Explorer", "", @SW_SHOW)

EndIf

If GUICtrlRead($Checkbox_D2) = $GUI_CHECKED Then

WinSetState("Diablo II", "", @SW_SHOW)

EndIf

HotKeySet("!z")

HotKeySet("!z", "Auto_Hide")

$Unhide_done = 1

ExitLoop

EndIf

EndSelect

WEnd

EndFunc ;==>Unhide

While 1

Sleep(100)

WEnd

What problem I'm having with that is that when I press the hotkey to bring up the password window, it INTERRUPTS the hiding process, which I put in loop on purpose. So it will stop hiding, is there a way to re-script this in some better way?
I took out the distracting gui and reduced it to esentials:

#include <GUIConstants.au3>

opt("WinTitleMatchMode", 2)

HotKeySet("!z", "Auto_Hide"); Alt-z to hide

HotKeySet("!+z", "Auto_Unhide"); Alt-Shift-z to unhide

AdlibEnable("Hide_Unhide", 250)

While 1
    Sleep(250)
Wend

Func Hide_Unhide()
    WinSetState("Palm", "", $GUI_CHECKED)
    
    WinSetState("MSN Messenger", "", $Gui_State)
    WinSetState("Yahoo! Messenger", "", $Gui_State)
    WinSetState("Instant Message", "", $Gui_State)
    WinSetState("- Conversation", "", $Gui_State)
    WinSetState("Voice Chat", "", $Gui_State)
    WinSetState("Offline Messages", "", $Gui_State)
    WinSetState("Text Message", "", $Gui_State)
    WinSetState("TopazChat", "", $Gui_State)
    WinSetState("MSN", "", $Gui_State)
    WinSetState("Chat Room", "", $Gui_State)
    WinSetState("- Chat Window", "", $Gui_State)
    WinSetState("Xfire", "", $Gui_State)
    WinSetState("- Group Chat", "", $Gui_State)
    WinSetState("Webcam for", "", $Gui_State)
    WinSetState("Sign On", "", $Gui_State)
    WinSetState("Sign In", "", $Gui_State)
    WinSetState("Accept Message - ", "", $Gui_State)
    
    WinSetState("- Microsoft Internet Explorer", "", $Gui_State)
    
    WinSetState("Diablo II", "", $Gui_State)
EndFunc;==>Hide_Unhide

Func Auto_Hide()
    $Gui_State = @SW_HIDE
EndFunc;==>Auto_Hide

Func Auto_Unhide()
    $Gui_State = @SW_SHOW
EndFunc;==>Auto_Unhide

The idea is to use the same code to either hide or unhide by just changing the value of $Gui_State. AdlibEnable runs the function Hide_Unhide() every 250ms. You can put back the logic you really need to provide conditional operation, like your Chats, and password operation.

Hope that helps! :think:

Edit: Tweaked with AdlibEnable().

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thats smartly put. But dude, I coulda done something like that too. The point is that I want to challenge myself and see what I can do. I already have a windows hider which hides windows at certain hotkey. But I make my script repeatedly press the hotkey to keep hiding any new windows. I can get the job done cheap, but I want to be challenged and I want to learn more about GUI stuff, etc. So can you help me out with the GUI problem? Because it works fine, until I press hotkey to show up the pwinput window, becuase hotkeys pause current process. That means the loop to keep hiding windows jsut stops.


[font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font]

Share this post


Link to post
Share on other sites

Put the hide options in a seperate function and take a look at AdlibEnable().


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thats smartly put. But dude, I coulda done something like that too. The point is that I want to challenge myself and see what I can do. I already have a windows hider which hides windows at certain hotkey. But I make my script repeatedly press the hotkey to keep hiding any new windows. I can get the job done cheap, but I want to be challenged and I want to learn more about GUI stuff, etc. So can you help me out with the GUI problem? Because it works fine, until I press hotkey to show up the pwinput window, becuase hotkeys pause current process. That means the loop to keep hiding windows jsut stops.

Did you notice that the Hide_Unhide() function keeps updating the window states because of AdlibEnable(), while the hotkeys update what state to put them in? As I said before, just put the gui back in as required (leaving you the 'challenge' you desired). :(

Put the gui in a function and just call it from the hotkeys themselves:

Func Auto_Hide()
    $Gui_State = @SW_HIDE
    Gui_Func()
EndFunc;==>Auto_Hide

Func Auto_Unhide()
    $Gui_State = @SW_SHOW
    Gui_Func()
EndFunc;==>Auto_Unhide

AdlibEnable() will continue to update the window states while Gui_Func() is running.

Is that clearer? You still need to write Gui_Func(). :think:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Yea, I kinda get what you guys are saying, but also, when you call function from a function, isn't that recursion? I want to avoid recursion completely. Because that last code salty wrote has a hotkey, which calls another function. The hotkey already IS a function. Calling mroe functions from within a function is bad right? Because of recursion limits script might stop.


[font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Yea, I kinda get what you guys are saying, but also, when you call function from a function, isn't that recursion? I want to avoid recursion completely. Because that last code salty wrote has a hotkey, which calls another function. The hotkey already IS a function. Calling mroe functions from within a function is bad right? Because of recursion limits script might stop.

Functions calling functions is normal and healthy, in fact downright necesary to efficient code. The problem you may be thinking of is a loop of functions calling each other, which the programmer is responsible for avoiding. So it's worth thinking about when you code your fuctions, but don't let it stop you from calling other functions.

:think:

P.S. Who's that in the picture with the guitar? Is that you, your son, grandson, great-grandson... ? :(

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Ok thankyou a lot guys. I got the script working and it works perfect. I put the adlib at 5 seconds. Because if you put it often, it takes some time to hide the windows. Also, is there a way to hide all the windows quicker? That process takes some time, not a lot, but I wanna know if we can quicken that hiding time.

Also, thats my with my guitar, and thats a really long time ago so I'm gonna upload my new pics.


[font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font]

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