Jump to content

Recommended Posts

Hi

 

I am developing a script that types a  string that can be specified in the Inputbox that has the $In01 variable attached.

 

But 3 things are not working:

 

  • It's not loading the gui, even when Guicreate() is specified in the code
  • It's not typing the string, and i dont know why it doesn't type it.
  • And last of them, It's not detecting if the script has a different name than the original, :(

My Script is below:

;Script STRNG= 103494x104955x01
#include <Misc.au3>
#Include <File.au3>
#include <GuiConstants.au3>
#INCLUDE <GuiConstantsEx.au3>
#pragma compile(inputboxres, true)"
If @ScriptName Not = "DynamicRookie's Colorized No. 103494x104955x01.au3" Then
MsgBox(0, "Unofficial", "You are running an unnoficial version of STRNG: 103494x104955x01 by DynamicRookie, but feel free to use it below your own risk :)")
ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/")
EndIf
$StringVal116 = 1
$Const_Win32_idGetHandle = WinGetHandle("103494x104955x01", "1x1")
Sleep (10)
Hotkeyset("{=}", "_ResetVariable")
SetError(0, 0, 0)
$In01 = InputBox("In01", "Please enter the string you want to automate :)")
If @error = 4 Then
    Call("ConsoleErrorFunction")
EndIf
MsgBox(4, "In03", "Want to enable _HasToRenewVal Function? (DEFAULT: Yes)")
If $IDYES = 6 Then
    $_HTRVal = True
Elseif $IDNO = 7 Then
    $_HTRVal = False
EndIf
Global $StringVal104910 = 0 ;Default String 0x0x1 :)
Global $StringVal116 = 0 ;Custom String 0x5x1 :)
Global $State = 1
Global $vReStr = '000'
MsgBox(0, "DynaRookie", "Script made by DynamicRookie, for 103494 in AutoIt Forums")
GUICreate("103494x104955x01", 400, 400, -1, -1, -1, -1)
GUICtrlCreateLabel("103494x104955x01 Active Process", 10, 10, 100, 20, -1, -1)
GUICtrlCreateLabel("Value Extension Macrostring: ", 10, 40, 100, 20)
$vReStr = GUICtrlCreateLabel("N/V/R", 112, 40, 50, 20)
GUICtrlCreateLabel("String Specified: # " & $In01 & " #, type K to type specified string.", 0, 100, 300, 20)
Call("_D4N4M11CCKR010K133")
;It waits until u press K to check for $In03 and if checked to type type $In01 in the chat, then you need to press "=" key to enable the variable back, else
;If HasToRenew function is enabled you dont need to enable it back,
;else if the variable is already enabled and you dont want to make it type $In01 when you press K, press "=" when
;the variable is already enabled, it will deactivate it until you press "=" again.

Func Init0()
    GUICtrlSetData($vReStr, 'Initializing: Control 0x1')
    $StatusString = "Init0"
    Sleep(1)
    $i_Win32_idPosition = WinGetPos("103494x104955x01", "1x2")
    $i_Win32_Status = "Active0"
    GUICtrlSetData($vReStr, 'Ready to use!')
    $StatusString = "RD1"
    Call("_D4N4M11CCKR010K133")
EndFunc

Func _D4N4M11CCKR010K133()
While 1
    If _IsPressed('4B') And $StringVal116 = 1 Then
    $StringVal104910 = 1
    ExecuteFunction_0_0_0_1()
    EndIf
    Sleep(100)
WEnd
EndFunc

Func _ResetVariable()
     If $State = 0 And $_HTRVal = True Then
     $State = 1
     Call ("_D4N4M11CCKR010K133")
     Elseif $State = 1 And $_HTRVal = True Then
     $State = 0
     Call ("_D4N4M11CCKR010K133")
     Else
     Call("_D4N4M11CCKR010K133")
     EndIf
Endfunc



Func ExecuteFunction_0_0_0_1()
    If $StatusString = "Init0" Then
        MsgBox(0, "Wait", "Please wait until it loads completely")
        Call("Init0")
    ElseIf $State = 1 And $_HTRVal = True Then
        GUICtrlSetData($vReStr, "Typing specified string")
        Send('' & $In01 & '', 1)
        $State = 0
        GuiCtrlSetData($vReStr, "Sent function command!")
        Call("_D4N4M11CCKR010K133")
    ElseIf $State = 0 or $State = 1 And _HTRVal = False Then
        GUICtrlSetData($vReStr, "Typing specified string")
        Send('' & $In01 & '', 1)
        GuiCtrlSetData($vReStr, "Sent function command!")
        Call("_D4N4M11CCKR010K133")
        Else
        Call("_D4N4M11CCKR010K133")
    EndIf
EndFunc


Func ConsoleErrorFunction()
ConsoleWrite($Const_Win32_idGetHandle)
MsgBox("1, 48, 256, 4096, 2097152", "Exception @error", "An Unexpected error has occurred, please contact DynamicRookie for help, in AutoIt forums ( This window will close in " & $i_idTimeout_msg & "seconds", $i_idTimeout_msg)
Exit 0
If @error = 1 Then
    ConsoleWrite("User has decided: Cancel = Val. 2")
    Exit 0
ElseIf @error = 2 Then
    ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/")
    ConsoleWrite("User has decided: Nothing = Val. 0")
    Exit 0
EndIf

 

Link to post
Share on other sites

Maybe This

;Script STRNG= 103494x104955x01
#include <Misc.au3>
#Include <File.au3>
#include <GuiConstants.au3>
#INCLUDE <GuiConstantsEx.au3>
#pragma compile(inputboxres, true)
If Not (@ScriptName = "DynamicRookie's Colorized No. 103494x104955x01.au3") Then
MsgBox(0, "Unofficial", "You are running an unnoficial version of STRNG: 103494x104955x01 by DynamicRookie, but feel free to use it below your own risk :)")
ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/")
EndIf
$StringVal116 = 1
$Const_Win32_idGetHandle = WinGetHandle("103494x104955x01", "1x1")
Sleep (10)
Hotkeyset("{=}", "_ResetVariable")
SetError(0, 0, 0)
$In01 = InputBox("In01", "Please enter the string you want to automate :)")
If @error Then
    Call("ConsoleErrorFunction")
EndIf
$ID=MsgBox(4, "In03", "Want to enable _HasToRenewVal Function? (DEFAULT: Yes)")
If $ID = 6 Then
    $_HTRVal = True
Elseif $ID = 7 Then
    $_HTRVal = False
EndIf
Global $StringVal104910 = 0 ;Default String 0x0x1 :)
Global $StringVal116 = 0 ;Custom String 0x5x1 :)
Global $State = 1
Global $vReStr = '000'
MsgBox(0, "DynaRookie", "Script made by DynamicRookie, for 103494 in AutoIt Forums")
GUICreate("103494x104955x01", 400, 400, -1, -1, -1, -1)
GUICtrlCreateLabel("103494x104955x01 Active Process", 10, 10, 100, 20, -1, -1)
GUICtrlCreateLabel("Value Extension Macrostring: ", 10, 40, 100, 20)
$vReStr = GUICtrlCreateLabel("N/V/R", 112, 40, 50, 20)
GUICtrlCreateLabel("String Specified: # " & $In01 & " #, type K to type specified string.", 0, 100, 300, 20)
GUISetState()
Call("_D4N4M11CCKR010K133")
;It waits until u press K to check for $In03 and if checked to type type $In01 in the chat, then you need to press "=" key to enable the variable back, else
;If HasToRenew function is enabled you dont need to enable it back,
;else if the variable is already enabled and you dont want to make it type $In01 when you press K, press "=" when
;the variable is already enabled, it will deactivate it until you press "=" again.

Func Init0()
    GUICtrlSetData($vReStr, 'Initializing: Control 0x1')
    $StatusString = "Init0"
    Sleep(1)
    $i_Win32_idPosition = WinGetPos("103494x104955x01", "1x2")
    $i_Win32_Status = "Active0"
    GUICtrlSetData($vReStr, 'Ready to use!')
    $StatusString = "RD1"
    Call("_D4N4M11CCKR010K133")
EndFunc

Func _D4N4M11CCKR010K133()
While 1
    If _IsPressed('4B') And $StringVal116 = 1 Then
    $StringVal104910 = 1
    ExecuteFunction_0_0_0_1()
    EndIf
    Sleep(100)
WEnd
EndFunc

Func _ResetVariable()
     If $State = 0 And $_HTRVal = True Then
     $State = 1
     Call ("_D4N4M11CCKR010K133")
     Elseif $State = 1 And $_HTRVal = True Then
     $State = 0
     Call ("_D4N4M11CCKR010K133")
     Else
     Call("_D4N4M11CCKR010K133")
     EndIf
Endfunc



Func ExecuteFunction_0_0_0_1()
    #forcedef $StatusString
    If $StatusString = "Init0" Then
        MsgBox(0, "Wait", "Please wait until it loads completely")
        Call("Init0")
    ElseIf $State = 1 And $_HTRVal = True Then
        GUICtrlSetData($vReStr, "Typing specified string")
        Send('' & $In01 & '', 1)
        $State = 0
        GuiCtrlSetData($vReStr, "Sent function command!")
        Call("_D4N4M11CCKR010K133")
    ElseIf $State = 0 or $State = 1 And $_HTRVal = False Then
        GUICtrlSetData($vReStr, "Typing specified string")
        Send('' & $In01 & '', 1)
        GuiCtrlSetData($vReStr, "Sent function command!")
        Call("_D4N4M11CCKR010K133")
        Else
        Call("_D4N4M11CCKR010K133")
    EndIf
EndFunc


Func ConsoleErrorFunction()
#forcedef $i_idTimeout_msg
ConsoleWrite($Const_Win32_idGetHandle)
MsgBox("1, 48, 256, 4096, 2097152", "Exception @error", "An Unexpected error has occurred, please contact DynamicRookie for help, in AutoIt forums ( This window will close in " & $i_idTimeout_msg & "seconds", $i_idTimeout_msg)
Exit 0
If @error = 1 Then
    ConsoleWrite("User has decided: Cancel = Val. 2")
    Exit 0
ElseIf @error = 2 Then
    ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/")
    ConsoleWrite("User has decided: Nothing = Val. 0")
    Exit 0
EndIf
EndFunc

 

Edited by farouk12
Link to post
Share on other sites
16 hours ago, farouk12 said:

Maybe This

;Script STRNG= 103494x104955x01
#include <Misc.au3>
#Include <File.au3>
#include <GuiConstants.au3>
#INCLUDE <GuiConstantsEx.au3>
#pragma compile(inputboxres, true)
If Not (@ScriptName = "DynamicRookie's Colorized No. 103494x104955x01.au3") Then
MsgBox(0, "Unofficial", "You are running an unnoficial version of STRNG: 103494x104955x01 by DynamicRookie, but feel free to use it below your own risk :)")
ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/")
EndIf
$StringVal116 = 1
$Const_Win32_idGetHandle = WinGetHandle("103494x104955x01", "1x1")
Sleep (10)
Hotkeyset("{=}", "_ResetVariable")
SetError(0, 0, 0)
$In01 = InputBox("In01", "Please enter the string you want to automate :)")
If @error Then
    Call("ConsoleErrorFunction")
EndIf
$ID=MsgBox(4, "In03", "Want to enable _HasToRenewVal Function? (DEFAULT: Yes)")
If $ID = 6 Then
    $_HTRVal = True
Elseif $ID = 7 Then
    $_HTRVal = False
EndIf
Global $StringVal104910 = 0 ;Default String 0x0x1 :)
Global $StringVal116 = 0 ;Custom String 0x5x1 :)
Global $State = 1
Global $vReStr = '000'
MsgBox(0, "DynaRookie", "Script made by DynamicRookie, for 103494 in AutoIt Forums")
GUICreate("103494x104955x01", 400, 400, -1, -1, -1, -1)
GUICtrlCreateLabel("103494x104955x01 Active Process", 10, 10, 100, 20, -1, -1)
GUICtrlCreateLabel("Value Extension Macrostring: ", 10, 40, 100, 20)
$vReStr = GUICtrlCreateLabel("N/V/R", 112, 40, 50, 20)
GUICtrlCreateLabel("String Specified: # " & $In01 & " #, type K to type specified string.", 0, 100, 300, 20)
GUISetState()
Call("_D4N4M11CCKR010K133")
;It waits until u press K to check for $In03 and if checked to type type $In01 in the chat, then you need to press "=" key to enable the variable back, else
;If HasToRenew function is enabled you dont need to enable it back,
;else if the variable is already enabled and you dont want to make it type $In01 when you press K, press "=" when
;the variable is already enabled, it will deactivate it until you press "=" again.

Func Init0()
    GUICtrlSetData($vReStr, 'Initializing: Control 0x1')
    $StatusString = "Init0"
    Sleep(1)
    $i_Win32_idPosition = WinGetPos("103494x104955x01", "1x2")
    $i_Win32_Status = "Active0"
    GUICtrlSetData($vReStr, 'Ready to use!')
    $StatusString = "RD1"
    Call("_D4N4M11CCKR010K133")
EndFunc

Func _D4N4M11CCKR010K133()
While 1
    If _IsPressed('4B') And $StringVal116 = 1 Then
    $StringVal104910 = 1
    ExecuteFunction_0_0_0_1()
    EndIf
    Sleep(100)
WEnd
EndFunc

Func _ResetVariable()
     If $State = 0 And $_HTRVal = True Then
     $State = 1
     Call ("_D4N4M11CCKR010K133")
     Elseif $State = 1 And $_HTRVal = True Then
     $State = 0
     Call ("_D4N4M11CCKR010K133")
     Else
     Call("_D4N4M11CCKR010K133")
     EndIf
Endfunc



Func ExecuteFunction_0_0_0_1()
    #forcedef $StatusString
    If $StatusString = "Init0" Then
        MsgBox(0, "Wait", "Please wait until it loads completely")
        Call("Init0")
    ElseIf $State = 1 And $_HTRVal = True Then
        GUICtrlSetData($vReStr, "Typing specified string")
        Send('' & $In01 & '', 1)
        $State = 0
        GuiCtrlSetData($vReStr, "Sent function command!")
        Call("_D4N4M11CCKR010K133")
    ElseIf $State = 0 or $State = 1 And $_HTRVal = False Then
        GUICtrlSetData($vReStr, "Typing specified string")
        Send('' & $In01 & '', 1)
        GuiCtrlSetData($vReStr, "Sent function command!")
        Call("_D4N4M11CCKR010K133")
        Else
        Call("_D4N4M11CCKR010K133")
    EndIf
EndFunc


Func ConsoleErrorFunction()
#forcedef $i_idTimeout_msg
ConsoleWrite($Const_Win32_idGetHandle)
MsgBox("1, 48, 256, 4096, 2097152", "Exception @error", "An Unexpected error has occurred, please contact DynamicRookie for help, in AutoIt forums ( This window will close in " & $i_idTimeout_msg & "seconds", $i_idTimeout_msg)
Exit 0
If @error = 1 Then
    ConsoleWrite("User has decided: Cancel = Val. 2")
    Exit 0
ElseIf @error = 2 Then
    ShellExecute("https://www.autoitscript.com/forum/profile/104955-dynamicrookie/")
    ConsoleWrite("User has decided: Nothing = Val. 0")
    Exit 0
EndIf
EndFunc

 

Thanks for ur help :)

 

Everything works except the main function of the script...

 

Typing the string.. :c

Link to post
Share on other sites

When it gets to:

Func _D4N4M11CCKR010K133()

The variable $StringVal116 = 0

So, because you have a condition:

If _IsPressed('4B') And $StringVal116 = 1 Then

It's never gonna go past this and jump to ExecuteFunction_0_0_0_1 where it sends the inputbox contents.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Skysnake
      I don't often have occasion to use Child GUIs.  I find the multitude of options confusing.
      The example below I made for my own purposes, to have a visual guide to what the various Style and Extended Style options lead to.
      Comments are much appreciated.  This can be extended with many more examples and comments and why certain Styles are to preferred or avoided.  Where certain types of Child GUIs are most suitable etc.
       
      The code is very basic.  It is intended to show GUI Styles, not much else.
      ;~ ******************************************************************** ;~ Author: Skysnake ;~ ;~ Title: Demo various Child Gui options ;~ Updated: 2019.01.03 ;~ ;~ Function: A demo script, demonstrates various style & Extended ;~ style options for Child GUIs ;~ Comments, ideas and suggestions very welcome :) ;~ ;~ ******************************************************************** #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> ShowChildGuis() Func ShowChildGuis() Local $guiParent = GUICreate("The Parent GUI", 1200, 700, 0, 0) ;WHLT $idFilemenu = GUICtrlCreateMenu(" &Menu") $ButtonCancel = GUICtrlCreateButton("&Close", 0, 0, 80, 25) GUICtrlSetTip($ButtonCancel, "Click to close all") $ButtonShowChildGui = GUICtrlCreateButton("&Show", 0, 25, 80, 25) GUICtrlSetTip($ButtonShowChildGui, "Click to show a child GUI") ;~ #comments-start --- Toggle this and same code below to show context menu for parent or child Local $idContextmenu = GUICtrlCreateContextMenu() Local $idNewsubmenu = GUICtrlCreateMenu("This is a Context Menu", $idContextmenu) Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) Local $idContextButton = GUICtrlCreateButton("Context", 0, 50, 80, 25) GUICtrlSetTip($idContextButton, "Right Click to see Context Menu") Local $idButtoncontext = GUICtrlCreateContextMenu($idContextButton) Local $idMenuAbout = GUICtrlCreateMenuItem("This is a Context Menu", $idButtoncontext) Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) GUICtrlCreateMenuItem("", $idContextmenu) ; separator Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) ;~ #comments-end --- Toggle this and same code below to show context menu for parent or child Local $DefaultChildGui = GUICreate("Default child gui", 300, 100, 300, 300, Default, Default, $guiParent) ;;;WHLT GUICtrlCreateLabel("Default attributes" & @CRLF & "Cannot move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_aqua) $iStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($DefaultChildGui), $GWL_STYLE) $iExStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($DefaultChildGui), $GWL_EXSTYLE) GUISetStyle(BitOR($iStyle, $WS_VISIBLE), $iExStyle, $DefaultChildGui) Local $gChildGuiwithMenu = GUICreate("A child gui with menu", 300, 100, 50, 100, $WS_VISIBLE, BitOR($WS_EX_WINDOWEDGE, $WS_EX_MDICHILD, $WS_THICKFRAME), $guiParent) ;;;WHLT GUICtrlCreateLabel("Menu" & @CRLF & "Can move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_skyblue) $idFilemenu = GUICtrlCreateMenu(" &File ") Local $idFileMenuItem = GUICtrlCreateMenuItem("An item for the File menu ", $idFilemenu) GUICtrlCreateMenuItem("", $idFilemenu) ; create a separator line ; use same dimensions for GUI and its Label Local $iSizeWide = 300, $iSizeHi = 100 GUICreate("A child gui", $iSizeWide, $iSizeHi, 100, 200, $WS_VISIBLE, BitOR($WS_EX_WINDOWEDGE, $WS_EX_TOPMOST, $WS_EX_MDICHILD, $WS_THICKFRAME), $guiParent) ;;;WHLT GUICtrlCreateLabel("Can move; cannot resize" & @CRLF & "Always on top", 0, 0, $iSizeWide, $iSizeHi) GUICtrlSetBkColor(-1, $COLOR_red) GUICreate("Child Gui Resizable", 300, 100, 200, 50, BitOR($WS_POPUP, $WS_SIZEBOX, $WS_CLIPCHILDREN, $WS_VISIBLE), $WS_EX_MDICHILD, $guiParent) ;;;WHLT GUICtrlCreateLabel("Popup Cannot move; can resize" & @CRLF & "Background", 0, 0, 500, 200) ; $WS_CHILD, GUICtrlSetBkColor(-1, $COLOR_blue) ; toggle the line below :) ;$idBackgroundmenu = GUICtrlCreateMenu(" &Menu ") ; give it a menu GUICreate("Child GUI, caption, resize", 300, 100, 300, 100, BitOR($WS_VISIBLE, $WS_POPUP, $WS_CAPTION), BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD, $WS_EX_ACCEPTFILES), $guiParent) GUICtrlCreateLabel("Popup With Caption: Can move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_yellow) GUICreate("Child GUI, abc", 300, 100, 400, 150, BitOR($WS_POPUP, $WS_VISIBLE, 0), $WS_EX_MDICHILD, $guiParent) GUICtrlCreateLabel("Popup Cannot move; cannot resize", 0, 0, 500, 200) GUICtrlSetBkColor(-1, $COLOR_green) ; Child GUI below has a control ............................. ............................................. Local $gChildWithControls = GUICreate("Child GUI with Buttons", 400, 400, 500, 200, BitOR($WS_CAPTION, $WS_CHILD), -1, $guiParent) GUISetFont(14, $gChildWithControls) Local $cLabel = GUICtrlCreateLabel("Can move; cannot resize", 0, 0, 400, 50) GUICtrlSetBkColor($cLabel, $COLOR_white) Local $idChild_ButtonOkay = GUICtrlCreateButton("Okay", 0, 50, 80, 30) Local $idChild_ButtonHide = GUICtrlCreateButton("Hide", 0, 80, 80, 30) GUICtrlSetTip($idChild_ButtonHide, "Click to hide this child GUI") ;~ #comments-start --- Toggle this and same code below to show context menu for parent or child ;~ Local $idContextmenu = GUICtrlCreateContextMenu() ;~ Local $idNewsubmenu = GUICtrlCreateMenu("This is a Context Menu", $idContextmenu) ;~ Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) ;~ Local $idContextButton = GUICtrlCreateButton("Context", 0, 110, 80, 30) ;~ GUICtrlSetTip($idContextButton, "Right Click to see Context Menu") ;~ Local $idButtoncontext = GUICtrlCreateContextMenu($idContextButton) ;~ Local $idMenuAbout = GUICtrlCreateMenuItem("This is a Context Menu", $idButtoncontext) ;~ Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) ;~ Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) ;~ GUICtrlCreateMenuItem("", $idContextmenu) ; separator ;~ Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) ;~ #comments-end --- Toggle this and same code below to show context menu for parent or child GUISetState(@SW_HIDE, $gChildWithControls) ;.......................................................................................................... Local $gToolbar = GUICreate("A floating Tool Window", 300, 50, 100, 25, $WS_VISIBLE, $WS_EX_TOOLWINDOW, $guiParent) GUICtrlCreateLabel("A floating toolbar", 0, 0, 500, 200) ; this does not show :) GUICtrlSetBkColor(-1, $COLOR_lime) ;~ $iStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($gToolbar), $GWL_STYLE) ;~ $iExStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($gToolbar), $GWL_EXSTYLE) ; BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD) ;~ GUISetStyle(BitOR($iStyle, $WS_VISIBLE), $iExStyle, $gToolbar) $idToolmenu = GUICtrlCreateMenu(" &Tool ") Local $idToolMenuItem = GUICtrlCreateMenuItem("An item for the Tool menu ", $idToolmenu) Local $idToolMenuItemsecond = GUICtrlCreateMenuItem("A second item for the Tool menu ", $idToolmenu) GUICtrlCreateMenuItem("", $idToolmenu) ; create a separator line $idPrintmenu = GUICtrlCreateMenu(" &Print ") Local $idToolMenuItemPrint = GUICtrlCreateMenuItem("A Print item for the Toolbar print menu ", $idPrintmenu) GUICtrlCreateMenuItem("", $idPrintmenu) ; create a separator line #Region --- After GUI BEFORE loop starts GUISetState(@SW_SHOW, $guiParent) #EndRegion --- After GUI BEFORE loop starts While 1 ;Local $nMsg = GUIGetMsg() Switch GUIGetMsg() ; $nMsg Case $GUI_EVENT_CLOSE, $ButtonCancel GUIDelete($guiParent) ExitLoop Case $idContextButton MsgBox($MB_SYSTEMMODAL, "Button Clicked", 'Right Click to see the Contect Menu') Case $ButtonShowChildGui GUISetState(@SW_ENABLE, $gChildWithControls) GUISetState(@SW_SHOW, $gChildWithControls) Case $idChild_ButtonHide ; <<<<<<<<<<<<<<< Child Gui Control Actioned in main loop ConsoleWrite("Yup, you clicked it" & @CRLF) GUISetState(@SW_HIDE, $gChildWithControls) Case $idChild_ButtonOkay ; <<<<<<<<<<<<<<< Child Gui Control Actioned in main loop ConsoleWrite("Yup, you clicked it" & @CRLF) MsgBox($MB_SYSTEMMODAL, "Button Clicked", 'Okay') EndSwitch WEnd GUIDelete() EndFunc ;==>ShowChildGuis  
       
    • By timmy2
      I have the impression that the traditional method for processing responses to a GUI is to assign variables to each GUICreateButton (or Pic) and then use Switch/Case/Endswitch to detect when any Control is clicked.  In the tutorials I've seen about Koda it appears to use this method, too.
      While 1 Global $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Pic2 Call("verizon") Case $Pic3 Call("skype") Case $PicExit Exit EndSwitch WEnd But in a few examples I've seen a script use a different method. The script always includes the following option near the top:
      Opt("GUIOnEventMode", 1) ...and then, later, after creating each Control for the GUI, there's the function, GUICtrlSetOnEvent.  In these cases a very simple While/WEnd loop is used to wait for the user to respond. 
      I happened to employ this second method in a recent script where I used "canned" controls (checkbox and buttons). Later in the same script I used the GuiCreatePic and Switch/Case/EndSwitch method because my GUI was all custom images. (I'm not sure if that's necessary, but it's what I've deduced.) The second GUI failed to respond to any mouse clicks, but eventually I figured out the cause was the GUIOnEvenMode being enabled at the top of the script.
      This is when I realized I don't understand the reasoning behind choosing between these two methods. And I'm having no luck phrasing an appropriate search criterion. Is there an overview somewhere that explains the two methods and -- most importantly -- describes when each is appropriate?
    • By GregEisenberg
      Hi there 
      I am building a "statistics kiosk" where we will be enumerating through Web Pages, and Excel files, PDF reports and other applications each displaying statistics relevant to our project. I want to overlay some context over each page/screen so that viewers of this "statistics kiosk" have some info about that the data they are looking at is.  I have written a function called OverlayWindow which is supposed to create a transparent window which displays some text. The function SEEMS to work BUT 
      The handle returned from CreateGUI is 0 (despite there being NO error or extended information)  The window is created but not maintained.  In other words it appears but since it is not really maintained it is repainted as other content changes.  The result is that the overlay appears BUT as soon as there is a reason for the underlying windows to repaint the overlay starts to "disappear"  I have extracted the relevant code and created the most simplistic of samples here. 
      #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode ; #FUNCTION# ==================================================================================================================== ; Name ..........: OverlayWindow ; Description ...: Throws up a child window with transparent background over current window ; ; Parameters : ; $hwndParent parent hwnd ; $rectToHighlight rect to draw (or if null, skip) ; $rectForText rect for textToWrite ; $textToWrite the text to write ; =============================================================================================================================== Func OverlayWindow($hwndParent, $rectToHighlight, $rectForText, $textToWrite) $style = BitOR($WS_CHILD, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS) $exstyle = BitOR($WS_EX_TOPMOST, $WS_EX_COMPOSITED, $WS_EX_TRANSPARENT) $hGUI = GUICreate("transparent overlay", -1, -1, -1, -1, $style, $exstyle) ConsoleWrite("**** $hGUI: " & $hGUI & @CRLF) ConsoleWrite("**** @error: " & @error & @CRLF) ConsoleWrite("**** @extended: " & @extended & @CRLF) GUISetOnEvent($GUI_EVENT_CLOSE, "OverlayWindow_Exit") GUISetState(@SW_SHOW, $hGUI) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ConsoleWrite("**** $hGraphics : " & $hGraphics & @CRLF) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) $hPen = _GDIPlus_PenCreate(0xFFFF0000, 4) ; Red If ($rectToHighlight <> Null) Then _GDIPlus_GraphicsDrawRect($hGraphics, $rectToHighlight[0], $rectToHighlight[1], $rectToHighlight[2], $rectToHighlight[3], $hPen) EndIf _GDIPlus_PenDispose($hPen) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000) ; RED $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 14, 2) $tLayout = _GDIPlus_RectFCreate($rectForText[0], $rectForText[1], $rectForText[2], $rectForText[3]) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $textToWrite, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphics, $textToWrite, $hFont, $aInfo[0], $hFormat, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_GraphicsDispose($hGraphics) Return $hGUI EndFunc Func OverlayWindow_Exit() ConsoleWrite("* * * Exit event called" & @CRLF) EndFunc Func Handle_Esc() $Done = True EndFunc ;----------------------------------------------------------------- ;Main() _GDIPlus_Startup() Global $Done = False Local $rect = [10, 10, 400, 400] Local $rectForText = [15, 15, 380, 380] $hGUI = OverlayWindow(Null, $rect, $rectForText, "This is a test with long text long text and should automatically wrap long text " & @CRLF & "and " & @CRLF & " handle " & @CRLF & "cariage returns and line feeds") HotKeySet ( "{Esc}", Handle_Esc) While Not $Done Sleep(100) WEnd GUIDelete($hGUI) _GDIPlus_Shutdown () Exit 0 I am assuming the since CreateGUI returns 0 that the  _GDIPlus_GraphicsCreateFromHWND is simply creating a "graphics context" based on the desktop then and not on my window.  And thus - there IS no window (despite no @error nor no @extended data) 
      So I think the issue is in the "styles" of window I am using.
      If I don't use WS_CHILD (for example I use WS_POPUP) then I get a handle back for my window and the lifetime of the window is what i want but it is not transparent as I want. Setting styles on the window to be transparent (either using extended styles, or using WinSetTrans or _WinAPI_SetBkMode) results in my rectangle and string being transparent - not what I want either. 

      Any suggestions?

      any and all help is appreciated
      Thanks! 

       

    • By Skysnake
      Hi
      Maybe I am just being silly, but I don't understand what is supposed to happen here.
      ::/html/functions/GUICreate.htm
      GuiCreate from the Help file has 2 examples.  Specifically, the 2nd example creates a ChildGui.  Or so it says.  I do not see this on screen.
      $hGUI gets created, no problem.
      Local $hChild = GUICreate("ChildGui", 10, 10, 20, 20, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) What exactly does this line do? Should I see it on screen?
      Skysnake
    • By Skysnake
      I think I am missing something obvious
      I want the "color bar" to stretch from side to side (entire width) of the GUI.  On resize it must expand / contract as necessary.  I guess the answer is easy, but I need a bit of help please?
      $hForm = GUICreate('myColor Picker', 300, 200,-1, -1, $WS_MAXIMIZEBOX + $WS_SYSMENU + $WS_CAPTION) ;color the GUI background ;GUISetBkColor($sColorformFile, $hForm) ; set the gui background color ;Local $mycolorLabel = GUICtrlCreateLabel("",10,10,300,10) ; a blank LABEL color bar Local $mycolorLabel = GUICtrlCreateGraphic( -1,-1,300,10) ; a blank GRAPHIC color bar GUICtrlSetResizing($mycolorLabel, $ws_sizebox);$GUI_DOCKMENUBAR);$GUI_DOCKAUTO) ;$GUI_DOCKBORDERS) GUICtrlSetBkColor($mycolorLabel,$sColorformFile) ; set the color for the label  
      This is an extract from here, by @Yashied
      $hForm = GUICreate('myColor Picker', 300, 200,-1, -1, $WS_MAXIMIZEBOX + $WS_SYSMENU + $WS_CAPTION) ;color the GUI background ;GUISetBkColor($sColorformFile, $hForm) ; set the gui background color ;Local $mycolorLabel = GUICtrlCreateLabel("",10,10,300,10) ; a blank LABEL color bar Local $mycolorLabel = GUICtrlCreateGraphic( -1,-1,300,10) ; a blank GRAPHIC color bar GUICtrlSetResizing($mycolorLabel, $ws_sizebox);$GUI_DOCKMENUBAR);$GUI_DOCKAUTO) ;$GUI_DOCKBORDERS) GUICtrlSetBkColor($mycolorLabel,$sColorformFile) ; set the color for the label Specifically my issue is with that $mycolorLabel
      Thanks, Skysnake
       
×
×
  • Create New...