Jump to content

selection function


AppTux
 Share

Recommended Posts

is there a function that if you select a gui input that you can change a var?

i need this because i have a gui with a browse button, and if you select the first input, then changes it a var. And if you select a other input, then changes it the var to another value

If the var is 1, then goes it do something else than if the var is 2 :)

is this possible (i hope that i explain it good enough ;) )

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

Can you post the code you have so far? It makes analyzing what you want a bit easier.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         AppTux

 Script Function:
    Run a program and open a folder, document or Internet Adress.

#ce ----------------------------------------------------------------------------

#NoTrayIcon
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GUIEdit.au3>
#include <File.au3>

Opt('MustDeclareVars', 1)

XRUN()

Func XRUN()
    Local $A1[26],$GUI1,$pSD,$pNORM,$pNORM2,$pOPT,$pOPT2,$tBAN,$tEXP,$cINP,$bOK,$bCAN,$bBRO,$cINP2
    Local $msg,$rINF,$rBIN,$ST = 0,$inpVAR
    If FileExists("Data\Xtreme.xdata") Then
        ;
    Else
        MsgBox(16,"Error","The data file doesn't exists."& @CRLF &"Please install again!")
        Exit
    EndIf
    _FileReadToArray("Data\Xtreme.xdata",$A1)
    
    $GUI1 =     GUICreate("Xtreme Run 1.01 bèta",$A1[2], $A1[3],-1,-1)
                GUISetBkColor(0xffffff,$GUI1)
    ;----------------------------------------Side tabs-------------------------------------------------;
    $pSD =      GUICtrlCreatePic("Data\Images\side.bmp",0,60,30,$A1[3])
    $pNORM =    GUICtrlCreatePic("Data\Images\side-normal1.bmp",0,0,30,30)
    $pNORM2 =   GUICtrlCreatePic("Data\Images\side-normal2.bmp",0,0,30,30)
    $pOPT =     GUICtrlCreatePic("Data\Images\side-options1.bmp",0,30,30,30)
    $pOPT2 =    GUICtrlCreatePic("Data\Images\side-options2.bmp",0,30,30,30)
    ;----------------------------------------Normal controls-------------------------------------------;
    $tBAN =     GUICtrlCreateLabel("Xtreme Run",$A1[5],$A1[6],260,40)
                GUICtrlSetFont($tBAN,12)
    $tEXP =     GUICtrlCreateLabel("Type a program, document, folder or Internet Adress,"& @CRLF &"and Xtreme Run will open it for you",40,50)
    $cINP =     GUICtrlCreateInput("",40,85,250,20)
    $bOK =      GUICtrlCreateButton("OK",$A1[9],$A1[10],$A1[12],$A1[13])
    $bCAN =     GUICtrlCreateButton("Cancel",$A1[15],$A1[16],$A1[18],$A1[19])
    $bBRO =     GUICtrlCreateButton("Browse...",$A1[21],$A1[22],$A1[24],$A1[25])
    ;----------------------------------------Options controls------------------------------------------;
    $cINP2 =    GUICtrlCreateInput("",40,85,100,20)
    ;----------------------------------------Set state of GUICtrls-------------------------------------;
    GUICtrlSetState($pNORM2,$GUI_HIDE)
    GUICtrlSetState($pOPT,$GUI_HIDE)
    GUICtrlSetState($cINP2,$GUI_HIDE)
    ;----------------------------------------End of controls and setting state of controls-------------;
    GUISetState()

    Do
        GUISetState()
        $msg = GUIGetMsg()
        $rINF = _GUICtrlEdit_GetText($cINP)
        If GUICtrlGetState($bOK) = 144 Then
            If $rINf <> "" Then
                GUICtrlSetState($bOK, $GUI_ENABLE)
                GUICtrlSetState($bOK, $GUI_DEFBUTTON)
            EndIf
        ElseIf GUICtrlGetState($bOK) = 80 Then
            If $rINF = "" Then
                GUICtrlSetState($bOK, $GUI_DISABLE)
            EndIf
        EndIf
        If $msg = $pNORM2 Then
            If $ST = 0 Then
                ;
            ElseIf $ST = 1 Then
                ;-------------------------Set state of images-----------------------------;
                GUICtrlSetState($pNORM,$GUI_SHOW)
                GUICtrlSetState($pNORM2,$GUI_HIDE)
                GUICtrlSetState($pOPT,$GUI_HIDE)
                GUICtrlSetState($pOPT2,$GUI_SHOW)
                ;-------------------------Set state of controls----------------------------;
                GUICtrlSetState($cINP2,$GUI_HIDE)
                GUICtrlSetData($cINP,$inpVAR)
                GUICtrlSetState($cINP,$GUI_SHOW)
                GUICtrlSetData($tBAN,"Xtreme Run")
                GUICtrlSetState($tEXP,$GUI_SHOW)
                $ST = 0
            EndIf
        ElseIf $msg = $pOPT2 Then
            If $ST = 1 Then
                ;
            ElseIf $ST = 0 Then
                ;-------------------------Set state of images-----------------------------;
                GUICtrlSetState($pNORM,$GUI_HIDE)
                GUICtrlSetState($pNORM2,$GUI_SHOW)
                GUICtrlSetState($pOPT,$GUI_SHOW)
                GUICtrlSetState($pOPT2,$GUI_HIDE)
                ;-------------------------Set state of controls----------------------------;
                GUICtrlSetState($cINP,$GUI_HIDE)
                GUICtrlSetData($tBAN,"Options")
                GUICtrlSetState($tEXP,$GUI_HIDE)
                GUICtrlSetState($cINP2,$GUI_SHOW)
                $inpVAR = _GUICtrlEdit_GetText($cINP)
                GUICtrlSetData($cINP,"-")
                $ST = 1
            EndIf
        ElseIf $msg = $bOK Then
            If $ST = 0 Then
                Sleep(100)
                ShellExecute($rINF)
            ElseIf $ST = 1 Then
                ;
            EndIf
        ElseIf $msg = $bCAN Then
            Exit
        ElseIf $msg = $bBRO Then
            If $ST = 0 Then
                $rBIN = FileOpenDialog("Browse...",@DesktopDir,"All Files (*.*)")
                GUICtrlSetData($cINP,$rBIN)
            ElseIf $ST = 1 Then
                ;
            EndIf
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc

The second input is to import another .xdata file so you can change the dimensions and other things :)

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

As I don't have the Data\Xtreme.xdata the GUI is rather small (just a few pixels wide).

But I think what you need is something like:

$Input1 = GUICtrlRead($cINP)
$Input2 = GUICtrlRead($cINP2)
If $Input1 <> "" Then
 ; Your action for Input 1 goes here
Elseif $Input2 <> "" Then
 ; Your action for Input 2 goes here
Endif
GUICtrlSetData($cINP,"") ; clear the input field 
GUICtrlSetData($cINP2,"") ; clear the input field

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

no, unfortanely not.

but the full resources and data are in the .zip archive.

maybe can that help.

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
Link to comment
Share on other sites

I stop with that.

i go do it with a single small browse button :)

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.
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...