Sign in to follow this  
Followers 0
Chimaera

Updating a label

6 posts in this topic

#1 ·  Posted (edited)

This is doing my sweed in atm ive tried numerous ways and it wont update the label

bottom bit of the gui creation

$sourcelabel = GUICtrlCreateLabel( "", 250, 190)
$sourceButton = GUICtrlCreateButton("...", 450, 185, 30, 25)   ;<<<<<<<<<<<<
        If $source <> "C:\" Or "D:\" Or "E:\" Then   ;<<<<<<<<<<<<
            GUICtrlSetData( $sourcelabel,"Select Backup Source")   ;<<<<<<<<<<<<
        Else
            GUICtrlSetData( $sourcelabel, "Drive Selected Is " & $source)   ;<<<<<<<<<<<<
        EndIf


EndIf
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    Case $sourceButton   ;<<<<<<<<<<<<
            $source = FileSelectFolder("Pick a Drive","")   ;<<<<<<<<<<<<
            MsgBox(0,"test", $source)   ;<<<<<<<<<<<<
        Case $check_button
            For $I = 0 To 10
                If BitAND(GUICtrlRead($Checkbox[$I]), $GUI_Checked) Then _Install($I)
            Next
    EndSwitch
WEnd

The message box in the case shows correctly the drive but if i have the set data lower down it dosent show on the gui and it dosent show $source correctly at the top

I dont really want to have to write an A:\ to Z:\ to cover the drives avail

when i had source at the top like MsgBox(0,"test", $source) source was always blank, hence why i was trying to update the label

All im trying to do is to get it to say Select Backup Source until the source has been done by the button then to say Drive Selected Is C:\ etc

Chimaera

Edited by Chimaera

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If $source <> "C:\" Or $source <> "D:\" Or $source <> "E:\" Then

Or

Switch $Source

    Case "C:\","D:\","E:\"
        GUICtrlSetData( $sourcelabel, "Drive Selected Is " & $source)
    Case Else
        GUICtrlSetData( $sourcelabel,"Select Backup Source")

EndSwitch
Edited by ChrisL

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks ChrisL

Ive put it in the while loop as it dosent work outside of that well it shows "Select Backup Source" all the time and dosent change.

Within the loop it dosent show "Select Backup Source" only the result after the button has been used

So i changed this

$sourcelabel = GUICtrlCreateLabel( "", 250, 190)

To

$sourcelabel = GUICtrlCreateLabel( "Select Backup Source", 250, 190) which kinda doubles up but it works as required

Thx

Edit

Just found a flaw in the plan

If i select c:\Documents and settings for eg it just shows "Select Backup Source" again :)

is there a way to just show the source without the labelling? C:\ etc

Edited by Chimaera

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Do you mean something like this Chimaera? OR _PathSplit() in the Help File.

MsgBox(0, "_GetDrive()", _GetDrive("C:\Documents and Settings\"))
MsgBox(0, "_GetDrive()", _GetDrive("D:\Backup\"))

Func _GetDrive($sPath)
    Return StringRegExpReplace($sPath, ":.*$", "") & ":\" ; Thanks to MrCreator.
EndFunc   ;==>_GetDrive
Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok all im after is next to the button on the gui it says "Select Backup Source"

and when the button is pressed using $source = FileSelectFolder("Pick a Drive","")

it then changes "Select Backup Source" to "Drive Selected Is " & $source e.g Drive Selected Is C:\ or Drive Selected Is C:\Whatever folder was clicked

The problem i am having is the $source = FileSelectFolder("Pick a Drive","" dosent update the label further up the gui

I just want $source to work above the while/wend loop so i can reuse it

The code i have atm

$main  = GUICreate("", 800, 600)
$header = GUICtrlCreatePic(@ScriptDir & "\exe_includes\data-secure_backup_header.jpg", 0, 0, 799, 70)
GUISetFont(11, 800, "", "Tahoma")
GUICtrlCreateGroup("Backup Choices", 10, 125, 220, 465)
Global $Programs[6][2] = [[5, 2],["Save All User Files", 150],["Save Database Files", 180],["Save CadCam Files", 210],["Save Backup Files", 240],["Save Archive Files", 270]]
Global $Checkbox[$Programs[0][0] + 1]
For $i = 1 To $Programs[0][0]
    $Checkbox[$i] = GUICtrlCreateCheckbox($Programs[$i][0], 30, $Programs[$i][1], 180, 35)
Next
$check_button = GUICtrlCreateButton("Start Backup", 56, 544, 105, 33)
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


$sourcelabel = GUICtrlCreateLabel( "Select Backup Source", 250, 190,150,35)
$sourceButton = GUICtrlCreateButton("...", 650, 185, 30, 25)
EndIf
GUISetState()
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     CHECKBOX FUNCTIONS
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $sourceButton
            $source = FileSelectFolder("Pick a Drive","")
        Switch $Source
            Case "A;\","B:\","C:\","D:\","E:\","F:\","G:\","H:\","I:\","J:\","K:\","L:\","M:\","N:\","O:\","P:\","Q:\","R:\","S:\","T:\","U:\","V:\","W:\","X:\","Y:\","Z:\"
                GUICtrlSetData( $sourcelabel, "Drive Selected Is  " & $source)
            Case Else
                GUICtrlSetData( $sourcelabel,"Select Backup Source")
        EndSwitch
;~          MsgBox(0,"test", $source)
        Case $check_button
            For $I = 0 To 10
                If BitAND(GUICtrlRead($Checkbox[$I]), $GUI_Checked) Then _Install($I)
            Next
    EndSwitch
WEnd

I just want $source to work higher up so i can addit into the label or create a new label at the side of it etc

Edited by Chimaera

Share this post


Link to post
Share on other sites

The code you provided isn't working as Includes are missing and variables aren't declared. :) I managed to change things around but I am not totally understanding the problem. When I select the button labeled "..." it changes the only label in the GUI named $sourcelabel to the Drive I selected e.g. C:\

Plus, you are missing GUICtrlCreateGroup("", -99, -99, 1, 1) which Closes the Group, I presume this should be placed after $sourceButton = GUICtrlCreateButton("...", 650, 185, 30, 25)

dosent update the label further up the gui

I can only see one label in the Script.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

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