Sign in to follow this  
Followers 0
vin1

make text output selectable

4 posts in this topic

how can i make it so the text number output result can be selectable and copyable

; autoit version: 3.0
; language:       English
; author:         Larry Bailey
; email:          psichosis@tvn.net
; Date: November 15, 2004
;
; Script Function
; Creates a GUI based dice rolling program
; using the Random function

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>

_Main()

Func _Main()
    Local $button1, $button2, $button3, $button4, $button5
    Local $button6, $button7, $button8, $button9, $button10
    Local $output, $die, $msg, $results
    GUICreate("Dice Roller", 265, 150, -1, -1)

    $button1 = GUICtrlCreateButton("D2", 5, 25, 50, 30)
    $button2 = GUICtrlCreateButton("D3", 65, 25, 50, 30)
    $button3 = GUICtrlCreateButton("D4", 125, 25, 50, 30)
    $button4 = GUICtrlCreateButton("D6", 5, 65, 50, 30)
    $button5 = GUICtrlCreateButton("D8", 65, 65, 50, 30)
    $button6 = GUICtrlCreateButton("D10", 125, 65, 50, 30)
    $button7 = GUICtrlCreateButton("D12", 5, 105, 50, 30)
    $button8 = GUICtrlCreateButton("D20", 65, 105, 50, 30)
    $button9 = GUICtrlCreateButton("D100", 125, 105, 50, 30)
    $button10 = GUICtrlCreateButton("Clear Dice", 185, 105, 65, 30)
    $output = GUICtrlCreateLabel("", 185, 45, 70, 50, BitOR($BS_PUSHLIKE, $SS_CENTER))
    $die = GUICtrlCreateLabel("", 185, 25, 70, 20, 0x1000)
    GUICtrlSetFont($output, 24, 800, "", "Comic Sans MS")

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $button1
                $results = Random(1, 2, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "2 Sided Die")
            Case $msg = $button2
                $results = Random(1, 3, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "3 Sided Die")
            Case $msg = $button3
                $results = Random(1, 4, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "4 Sided Die")
            Case $msg = $button4
                $results = Random(1, 6, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "6 Sided Die")
            Case $msg = $button5
                $results = Random(1, 8, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "8 Sided Die")
            Case $msg = $button6
                $results = Random(1, 10, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "10 Sided Die")
            Case $msg = $button7
                $results = Random(1, 12, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "12 Sided Die")
            Case $msg = $button8
                $results = Random(1, 20, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "20 Sided Die")
            Case $msg = $button9
                $results = Random(1, 100, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "100 Sided Die")
            Case $msg = $button10
                GUICtrlSetData($output, "")
                GUICtrlSetData($die, "")
        EndSelect
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>_Main

dice.au3

Share this post


Link to post
Share on other sites



Why do you have BS_ styles on a label?

It should be:

$output = GUICtrlCreateLabel("", 185, 45, 70, 50, BitOR($SS_SUNKEN, $SS_CENTER))
$die = GUICtrlCreateLabel("", 185, 25, 70, 20, $SS_SUNKEN)

Try this...

; autoit version: 3.0
; language:       English
; author:         Larry Bailey
; email:          psichosis@tvn.net
; Date: November 15, 2004
;
; Script Function
; Creates a GUI based dice rolling program
; using the Random function

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

_Main()

Func _Main()
    Local $button1, $button2, $button3, $button4, $button5
    Local $button6, $button7, $button8, $button9, $button10
    Local $output, $die, $msg, $results
    GUICreate("Dice Roller", 265, 150, -1, -1)

    $button1 = GUICtrlCreateButton("D2", 5, 25, 50, 30)
    $button2 = GUICtrlCreateButton("D3", 65, 25, 50, 30)
    $button3 = GUICtrlCreateButton("D4", 125, 25, 50, 30)
    $button4 = GUICtrlCreateButton("D6", 5, 65, 50, 30)
    $button5 = GUICtrlCreateButton("D8", 65, 65, 50, 30)
    $button6 = GUICtrlCreateButton("D10", 125, 65, 50, 30)
    $button7 = GUICtrlCreateButton("D12", 5, 105, 50, 30)
    $button8 = GUICtrlCreateButton("D20", 65, 105, 50, 30)
    $button9 = GUICtrlCreateButton("D100", 125, 105, 50, 30)
    $button10 = GUICtrlCreateButton("Clear Dice", 185, 105, 65, 30)
    $output = GUICtrlCreateInput("", 185, 45, 70, 50, BitOR($ES_CENTER, $ES_READONLY))
    $die = GUICtrlCreateLabel("", 185, 25, 70, 20, $SS_SUNKEN)
    GUICtrlSetFont($output, 24, 800, "", "Comic Sans MS")

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $button1
                $results = Random(1, 2, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "2 Sided Die")
            Case $msg = $button2
                $results = Random(1, 3, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "3 Sided Die")
            Case $msg = $button3
                $results = Random(1, 4, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "4 Sided Die")
            Case $msg = $button4
                $results = Random(1, 6, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "6 Sided Die")
            Case $msg = $button5
                $results = Random(1, 8, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "8 Sided Die")
            Case $msg = $button6
                $results = Random(1, 10, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "10 Sided Die")
            Case $msg = $button7
                $results = Random(1, 12, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "12 Sided Die")
            Case $msg = $button8
                $results = Random(1, 20, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "20 Sided Die")
            Case $msg = $button9
                $results = Random(1, 100, 1)
                GUICtrlSetData($output, $results)
                GUICtrlSetData($die, "100 Sided Die")
            Case $msg = $button10
                GUICtrlSetData($output, "")
                GUICtrlSetData($die, "")
        EndSelect
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>_Main

_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

thank you

it works

Share this post


Link to post
Share on other sites

To mark the topic as solved select the post that helped you and click 'mark solved.'


_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