Jump to content

GUI Problem


anzacfalcon
 Share

Recommended Posts

I have currently working on a small tool which supports Drag And Drop. Here is a screenshot:

Posted Image

As you's can see. There are 5 input boxes which do support drag and drop. What i want my program to do is when the first input box is not blank "", Enable the second input box and so on. Thank's.

Link to comment
Share on other sites

  • Moderators

anzacfalcon,

And what have you tried so far? Any code to show for it? :)

You need to trap the

EN_UPDATE message. Have a go yourself and come back if you run into problems.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

anzacfalcon,

And what have you tried so far? Any code to show for it? :)

You need to trap the

EN_UPDATE message. Have a go yourself and come back if you run into problems.

M23

So faar i have tried using a while statement and made it so that if Input1 = Not "" then Input2.Enabled = True ;)

LoL dont get confused with my example code im more of a VB6 coder so i used Input2.Enabled = True as an example. What happens with this way is that the while statement rapidly check's the input box causing a flickering and this is obviously not a acceptable piece of code for this action. Understand? kthnxbai

Link to comment
Share on other sites

#include<GuiConstantsEx>
If GUICtrlRead($input1) <> "" Then
    If BitAND(GuiCtrlGetState($input2), $GUI_ENABLED) <> $GUI_ENABLED Then
        GUICtrlSetState($Inputs, $GUI_ENABLED)
    EndIf
Else
    If BitAND(GuiCtrlGetState($input2), $GUI_DISABLED) <> $GUI_DISABLED Then
        GUICtrlSetState($Inputs, $GUI_DISABLED)
    EndIf
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Thnx but doesn't this need a loop?

It would normally be used in a loop situation but it could also be in a Function or anyplace else you want it. You wanted to know how to do the AutoIt equivalent to the VBS so I showed you but I also added in state checking to prevent control flicker.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Ok im getting "WARNING: $GUI_ENABLED: possibly used before declaration.

If BitAND(GuiCtrlGetState($input2), $GUI_ENABLED)"

That was my fault. Change $GUI_ENABLED to $GUI_ENABLE and change $GUI_DISABLED to $GUI_DISABLE. I generally don't use constants in my scripts so I get them wrong once in a while.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Local $Button1
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Haluk\Desktop\Form1_1.kxf
$Form1_1 = GUICreate("Form1", 414, 554, 707, 340, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_WINDOWEDGE))
GUISetBkColor(0xFFFFFF)
$Label1 = GUICtrlCreateLabel("Auto NoVirusThanks Scanner", 54, 24, 311, 44)
GUICtrlSetFont(-1, 16, 400, 0, "MS Reference Sans Serif")
$Button1 = GUICtrlCreateButton("Scan", 112, 496, 193, 41, $WS_GROUP)
GUICtrlSetFont(-1, 20, 400, 0, "Microsoft Sans Serif")
$Input1 = GUICtrlCreateInput("", 63, 120, 321, 21)
GUICtrlSetState($Input1,$GUI_DROPACCEPTED)
$Input2 = GUICtrlCreateInput("", 64, 152, 321, 21)
$Input3 = GUICtrlCreateInput("", 64, 184, 321, 21)
$Input4 = GUICtrlCreateInput("", 64, 216, 321, 21)
$Input5 = GUICtrlCreateInput("", 64, 248, 321, 21)
 GUICtrlSetState ( $Input2, $GUI_DISABLE )
  GUICtrlSetState ( $Input3, $GUI_DISABLE )
   GUICtrlSetState ( $Input4, $GUI_DISABLE )
    GUICtrlSetState ( $Input5, $GUI_DISABLE )
$Label2 = GUICtrlCreateLabel("File 1", 24, 120, 29, 25)
$Label3 = GUICtrlCreateLabel("File 2", 24, 152, 29, 17)
$Label4 = GUICtrlCreateLabel("File 3", 24, 184, 29, 17)
$Label5 = GUICtrlCreateLabel("File 4", 24, 216, 29, 17)
$Label6 = GUICtrlCreateLabel("File 5", 24, 248, 29, 17)
$Label7 = GUICtrlCreateLabel("Choose Browser:", 117, 360, 168, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Reference Sans Serif")
$Firefox = GUICtrlCreateRadio("Firefox 3", 24, 437, 121, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetFont(-1, 16, 400, 0, "MS Reference Sans Serif")
$IE = GUICtrlCreateRadio("Internet Explorer 8", 166, 437, 225, 25)
GUICtrlSetFont(-1, 16, 400, 0, "MS Reference Sans Serif")
$Group1 = GUICtrlCreateGroup("Browser Setting's", 16, 328, 377, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Main", 8, 96, 393, 209)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $msg = GUIGetMsg()
        If  $msg = -3 Then Exit


        If $msg = $Button1 And GUICtrlRead ( $Firefox ) = $GUI_CHECKED Then
                ;ScanFF()
                $Input1 = GUICtrlRead($input1)
                MsgBox ( 64, "lol", $Input1)
        EndIf
        If GUICtrlRead($input1) <> "" Then
    If BitAND(GuiCtrlGetState($input2), $GUI_ENABLE) <> $GUI_ENABLE Then
        GUICtrlSetState($Input2, $GUI_ENABLE)
        GUICtrlSetState($Input2,$GUI_DROPACCEPTED)
        EndIf
    EndIf
        If GUICtrlRead($input2) <> "" Then
    If BitAND(GuiCtrlGetState($input3), $GUI_ENABLE) <> $GUI_ENABLE Then
        GUICtrlSetState($Input3, $GUI_ENABLE)
        GUICtrlSetState($Input3,$GUI_DROPACCEPTED)
        EndIf
    EndIf
            If GUICtrlRead($input3) <> "" Then
    If BitAND(GuiCtrlGetState($input4), $GUI_ENABLE) <> $GUI_ENABLE Then
        GUICtrlSetState($Input4, $GUI_ENABLE)
        GUICtrlSetState($input4,$GUI_DROPACCEPTED)
        EndIf
    EndIf
            If GUICtrlRead($input4) <> "" Then
    If BitAND(GuiCtrlGetState($input5), $GUI_ENABLE) <> $GUI_ENABLE Then
        GUICtrlSetState($Input5, $GUI_ENABLE)
        GUICtrlSetState($Input5,$GUI_DROPACCEPTED)
        EndIf
    EndIf
WEnd



Func ScanFF()
Run("C:\Program Files\Mozilla Firefox\firefox.exe")
WinWaitActive("Mozilla Firefox")
MouseClick( "left" , 662, 68 )
Sleep ( 500 )
Send("http://scanner.novirusthanks.org/")
Send("{ENTER}")
WinWaitActive("NoVirusThanks - Free Online Virus & Malware Scan Service - Mozilla Firefox")
Sleep(1000)
MouseClick("left" ,482, 649)
MouseClick("left" ,821, 561)
Send($Input1)
Send("{ENTER}")
MouseClick("left" ,552, 606)

Ok, when the value of say for example "Input1" is read, i get a "0" or a number. I have managed to get the result the first time i drag the file into the inputbox and use my messagebox to show it but the second time it changes to a "0". Anyone know the problem?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...