Sign in to follow this  
Followers 0
tmanone

Updating a picture in a GUI

1 post in this topic

Hello all,

I was hoping to get a little help on a script that has been causing me to pull the few remaining hairs i have left out.

I have a GUI with a GuiCtrlCreatePic showing a graphic in a dir. In this gui is a load button that goes to a sub to browse to a dir and select a new graphic to display in place of the original one displayed in the GUI.

It appears that I am selecting the image okay and truncating the file name back to the string that my GUI recognizes and is the same string as when the GUI was first created. However when I delete main gui and then restart it the image will not show up. It shows in the control input above it that shows the image path but the graphic will not display.

Thanks in advance for any help you can offer, later, Tmanone

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

 AutoIt Version: 3.2.12.1
 Author:         myName

 Script Function:
    Template AutoIt script.

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

; Script Start - Add your code below here

#region --- Program setups --- START
#include <GuiConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ListboxConstants.au3>
#include <ButtonConstants.au3>
#include <TabConstants.au3>
#include <StaticConstants.au3>
#include <ScreenCapture.au3>
;;;for trial period
#include<date.au3>
#include<string.au3>

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode
Opt("GUICoordMode", 1)          ;1=absolute, 0=relative, 2=cell
;Opt("GUIResizeMode", 1)
AutoItSetOption("WinTitleMatchMode", 2)
AutoItSetOption("MustDeclareVars", 1)
;;;
#region --- Program setups --- END

#region --- VARIABLE DEC   ---START
;;variable definitions
dim $tempimage
dim $adder
dim $adderstripped
dim $Button_50
dim $hGUI
dim $imagedefault
dim $location
dim $sleeptime=250
dim $usealtset
$usealtset = 0
dim $RLCclientALTchek
dim $imageurl
dim $Button_49
dim $dirslash = "\"
dim $ininame="setup"
dim $iniexten = ".ini"
dim $genphraseset
dim $var
dim $vartrimmed
dim $calledfrom
dim $iamatlocation
dim $mousepos
dim $altgui,$altCombo_1,$altset,$altButton_2,$altGroup_3,$altCheckbox_6,$altCheckbox_5
dim $trimresult,$altCheckbox_6state,$altCheckbox_5state,$altCombo_1state
dim $altsetdef=" "
dim $altdebugmode
$altdebugmode=0
;$altdebugmode=1
dim $message

dim $RLCdeftitle; = "Utherverse® 3D Client - "
dim $script1def
dim $script2def
dim $script3def
dim $totaldemodays=10
dim $demodaysremaining
dim $ask
dim $readhelp
dim $mywinlocation
dim $checkthiswin
dim $openxpos
dim $openypos
dim $wantdemomode
dim $startdate
dim $AZTbase
dim $BASEmodeenable
dim $PROGRAM="TammiTrans"
dim $mainwindow
dim $module1
dim $debugmodeREGISTRY
dim $tTRANSmodule1
dim $tTRANSbase

;;;;debug mode for images
dim $debugimage=0
dim $debugimage=1

;;;MAJORDEBUG
dim $debugmode
$debugmode=0
;$debugmode=1
dim $debugmodeTITLE
$debugmodeTITLE=0
;$debugmodeTITLE=1
;;
dim $debugmodePOSINI
$debugmodePOSINI=0
;$debugmodePOSINI=1

dim $debugmodeINPUT
$debugmodeINPUT=0
;$debugmodeINPUT=1


dim $Combo_1state
;dim $aTheme
dim $aTheme[38][2]
dim $aThemeINI[36][2]
;dim $aThemeINIfuck[38][2]
;dim $funclocset2def
dim $funclocset2def="default"
dim $readsetfromini
dim $RLCtitle
dim $AZTmodule1
dim $RLCclientstatus
dim $RLCtitledef
dim $RLCclientstatbypass
dim $RLCclientstatbypasschek
;dim $oktopaste
dim $scriptdef
dim $scriptset
dim $ctrlsetsep="|"
dim $funclocsetwas
dim $result
dim $msgboxmsg
dim $msgboxtitle="TammiSoft TRANS Debug"
dim $funclocset2
dim $Input_2state
dim $Input_7state
dim $Input_8state
dim $Input_9state
dim $Input_13state
dim $Input_14state
dim $Input_15state
dim $Input_16state
dim $Input_17state
dim $Input_18state
dim $Combo_42state
dim $Combo_43state
dim $Input_44state
dim $Input_22state
dim $Checkbox_23state
dim $Checkbox_24state
dim $Checkbox_25state
dim $Checkbox_26state
dim $Checkbox_27state
dim $Checkbox_28state
dim $Checkbox_29state
dim $Checkbox_30state
dim $Checkbox_31state
dim $Checkbox_32state
dim $Checkbox_33state
dim $Checkbox_34state
dim $Checkbox_35state
dim $Checkbox_36state
dim $Checkbox_37state
dim $Checkbox_38state
dim $Checkbox_39state
dim $Checkbox_40state
dim $Checkbox_41state
dim $Combo_1,$Input_2,$Input_7,$Input_8,$Input_9
dim $Input_13,$Input_14,$Input_15,$Input_16,$Input_17,$Input_18,$Input_45,$Input_46,$Input_47
dim $Group_20,$Group_21,$Input_22,$Checkbox_23,$Checkbox_24,$Checkbox_25,$Checkbox_26,$Checkbox_27
dim $Checkbox_28,$Checkbox_29,$Checkbox_30,$Checkbox_31,$Checkbox_32,$Checkbox_33,$Checkbox_34
dim $Checkbox_35,$Checkbox_36,$Checkbox_37,$Checkbox_38,$Checkbox_39,$Checkbox_40,$Checkbox_41
dim $Combo_42,$Combo_43,$Input_44,$Button_45,$Button_46,$Button_47,$Button_48,$Combo_44,$Combo_45,$Combo_46

#region --- VARIABLE DEC   ---END--

AutoItSetOption("WinTitleMatchMode", 1)
If WinExists($PROGRAM) Then
    if $debugmode=1 then
         $msgboxmsg = "The program is already running error or call CLOSEAlreadyrunning() "
         MsgBox(0, $msgboxtitle&" archive in global check", $msgboxmsg)
    endif
    ;MsgBox(0, $PROGRAM&" IS ALREADY RUNNING", "Calling exit.", 5)
    CLOSEAlreadyrunning()
EndIf
if WinExists($PROGRAM&" Demo") Then
    if $debugmode=1 then
         $msgboxmsg = "The program is already running error or call CLOSEAlreadyrunning() "
         MsgBox(0, $msgboxtitle&" archive in global check", $msgboxmsg)
    endif
    ;MsgBox(0, $PROGRAM&" IS ALREADY RUNNING", "Calling exit.", 5)
    CLOSEAlreadyrunning()
EndIf

$aThemeINI = IniReadSection(@ScriptDir&"\Working Template\default.ini", "default")
;$aThemeINI = IniReadSection(@ScriptDir&"\Working Template\default.ini", GUICtrlRead($Combo_1))
If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file. Reinstall setup file. Backup you data first!")
Else
    if $debugmode = 1 then
        For $i = 1 To $aThemeINI[0][0]
            MsgBox(4096, "", "Key: " & $aThemeINI[$i][0] & @CRLF & "Value: " & $aThemeINI[$i][1])
        Next
    EndIf
EndIf


if $debugmode=1 then
    $msgboxmsg = "The values of $aThemeINI is : "
    MsgBox(0, $msgboxtitle, $msgboxmsg&$aThemeINI)
endif
;not sure ness for trans program
getRLCtitle()

if $RLCclientstatus = 0 Then
    ;;;;;;;;;;if it doesnt exist prompt the user if they wanna continue FUNC tells them its off and sets rlcclient doesn exits but then rlc bypass turns ok2past backon
    $RLCclientstatbypasschek = MsgBox(3, $PROGRAM&" Startup Message.", "Do you want to continue with outputs disabled, or select an alternate client! Yes continues, No selects alternate/Cancel Exits!")
    if $RLCclientstatbypasschek = 6 then    ;yes was pushed
        $RLCclientstatbypass= 1 ;set the bypass to enable
        ;$oktopaste=0
    endif
    if $RLCclientstatbypasschek = 7 then    ;no was pushed
        $RLCclientstatbypass= 0
        $RLCclientALTchek = MsgBox(3, $PROGRAM&" Startup Message.", "Do you want to select an alternate VWW client to output to! Yes to select, No/Cancel Exits!")
        if $RLCclientALTchek = 6 then   ;yes was pushed
            altclientmaker()
        endif
        if $RLCclientALTchek = 7 then   ;no was pushed
            CLOSEClicked()
        endif
        if $RLCclientALTchek = 2 then   ;cancel was pushed
            CLOSEClicked()
        endif
        ;CLOSEClicked()
        ;exit out of ENTIRE PROGRAM
    endif
    if $RLCclientstatbypasschek = 2 then    ;cancel was pushed
        $RLCclientstatbypass = 0
        $msgboxmsg = "Thank you for using "&$PROGRAM&" Calling exit."
        MsgBox(0, $PROGRAM&" Message", $msgboxmsg)
        CLOSEClicked()
    endif
;
    else
     ;;;;;;;;if it exists continue the execution
    ;$calledfrom="Start"
    ;TwTSmartChatGUI($calledfrom)
endif

;not sure ness for trans program


#region --- WELCOME SECTION ---START

#region --- WELCOME SECTION ---END--
;@DesktopWidth
$openxpos = IniRead(@ScriptDir&"\setup.ini", "setup", "$openxpos", "NotFound")
$openypos = IniRead(@ScriptDir&"\setup.ini", "setup", "$openypos", "NotFound")
;endif
;if $plset = NotFound means ini contains no plset user has never changed plset or ini is first run set a default
if $openxpos = "NotFound" Then
    $openxpos = "10";which is initialized defaults
endif
if $openypos = "NotFound" Then
    $openypos = "80";which is initialized defaults
endif


#region --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~GuiBuilder code Start ---
Func CreateGui()
    Local $Label_3,$Label_4,$Label_5,$Label_6,$Label_10,$Label_11,$Label_12,$Label_19,$Label_49,$myguistyle,$myguistyleEXT
    Local $label_20,$label_21,$label_22

    $myguistyle = BitOr($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS,$WS_EX_ACCEPTFILES)
    $myguistyleEXT = $WS_EX_TOPMOST

    $mainwindow = GuiCreate($PROGRAM, 574, 503,$openxpos, $openypos , $myguistyle, $myguistyleEXT)
    comparectrlset()

    $Combo_1 = GuiCtrlCreateCombo($funclocset2def, 130, 10, 290, 21)
    GUICtrlSetData(-1, $funclocset2, $funclocset2def) ; default Jon
    $Input_2 = GuiCtrlCreateInput($aThemeINI[2][1], 130, 35, 290, 20)
    $Label_3 = GuiCtrlCreateLabel("Transport Location:", 20, 10, 110, 20)
    $Label_4 = GuiCtrlCreateLabel("Location URL:", 20, 35, 110, 20)

    $Button_45 = GuiCtrlCreateButton("Load", 435, 10, 60, 30)
    $Button_46 = GuiCtrlCreateButton("Save", 500, 10, 60, 30)
    $Button_47 = GuiCtrlCreateButton("Transport", 435, 60, 60, 30)
    $Button_48 = GuiCtrlCreateButton("Help", 500, 60, 60, 30)
    $Group_21 = GuiCtrlCreateGroup("Reference Image", 30, 90, 510, 400)
    $Input_22 = GuiCtrlCreateInput($aThemeINI[3][1], 40, 110, 480, 20);;;state box
    ;;;
    ;GuiCtrlCreatePic("Location Images\default\default.JPG",40,150, 256,256)
    ;$imageurl=IniRead(@ScriptDir&"\Working Template\Default.ini", "default", "imageurl", "NotFound")

    ;$openxpos = IniRead(@ScriptDir&"\setup.ini", "setup", "$openxpos", "NotFound")
    ;GuiCtrlCreatePic($imageurl,40,150, 256,256)
    if $debugimage = 1 Then
        MsgBox(4096,"","the value of $aThemeINI[3][1] is: " & $aThemeINI[3][1])
    endif
    ;GUICtrlSetState(-1, $GUI_FOCUS)
    $imagedefault=GuiCtrlCreatePic($aThemeINI[3][1],40,150, 256,256,-1)
    ;$imagedefault=GuiCtrlCreatePic($var,40,150, 256,256)
    ;GuiCtrlSetImage($imagedefault, $aThemeINI[3][1])

    ;GuiCtrlSetImage($var, $aThemeINI[3][1])
    GUICtrlSetState(-1, $GUI_FOCUS)
    ;GUICtrlSetGraphic($mainwindow,"",$GUI_GR_REFRESH)
    ;GUICtrlSetState($imagedefault, $GUI_FOCUS)   ; the label is in disable state
    $Button_49 = GuiCtrlCreateButton("Load Image", 435, 160, 60, 30)
    $Button_50 = GuiCtrlCreateButton("Capture", 435, 200, 60, 30)
    ;$Label_49 = GuiCtrlCreateLabel("State boxes are reference only.", 440, 190, 110, 30)

    ;;;PLUGINS SECTION
    ;$Combo_45
    ;$Combo_46

    ;setcheckstates()
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
    GUICtrlSetOnEvent($Button_45, "loaddata")
    GUICtrlSetOnEvent($Button_46, "savedata")
    GUICtrlSetOnEvent($Button_47, "inputdata2client")
    GUICtrlSetOnEvent($Button_48, "help")
    GUICtrlSetOnEvent($Button_49, "loadimage")
    GUICtrlSetOnEvent($Button_50, "CaptureScreen")
    GUICtrlSetGraphic ( $imagedefault, $GUI_GR_REFRESH)
    ;GuiSetState()
    GUISetState(@SW_SHOW,$mainwindow)

EndFunc



#region --- INITIAL GUI STARTUP ---START
regcheck()
CreateGui()
#region --- INITIAL GUI STARTUP ---END

#region -----------------------------------------------restartgui SECTION ----------------------START
Func restartgui()
    ;this is here to restart the gui after input error
    if $debugmode = 1 Then
        MsgBox(4096, $msgboxtitle, "Restarting GUI")
    endif
    $checkthiswin=$mainwindow
    getwindowpos($checkthiswin)
    $openxpos=$mywinlocation[0]
    $openypos=$mywinlocation[1]
    GUIDelete($mainwindow)
    sleep(1000)
    CreateGui()
EndFunc
#region ------------------------------------------------restartgui SECTION ----------------------END

;;;;;;IDLER
;the following is the gui output section
While 1
  Sleep(1000)  ; Idle around
WEnd
;;;;;END IDLER
#endregion --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~GuiBuilder generated code End ---

#region --- BEGIN BUTTON FUNCTIONS ---

Func loaddata()
    ;;at dropin capture the state of the funcloc combo and the script level
    $Combo_43state=GUICtrlRead($Combo_43)
    ;;this will be the read variable for the ini section name
    ;;$var = IniReadSection("C:\Temp\myfile.ini", "section2")   referance for ini read
    $aThemeINI = IniReadSection(@ScriptDir&"\Working Template\default.ini", GUICtrlRead($Combo_1))
    $funclocset2def=$aThemeINI[1][1]
    $imageurl=$aThemeINI[3][1]
    restartgui()
EndFunc

Func savedata()
    $aTheme[1][1]=GUICtrlRead($Combo_1)
    $aTheme[2][1]=GUICtrlRead($Input_2)
    $aTheme[3][1]=GUICtrlRead($Input_22)
    $aTheme[1][0]="Function_Location"
    $aTheme[2][0]="url"
    $aTheme[3][0]="imageurl"
    for $count1 = 1 to 36
        ;IniWriteSection(@ScriptDir&"Working Template\default.ini", $aTheme[1][1], $aTheme[$count1][1])
        IniWrite(@ScriptDir&"\Working Template\default.ini", $aTheme[1][1], $aTheme[$count1][0],$aTheme[$count1][1])
    next
    $aThemeINI = IniReadSection(@ScriptDir&"\Working Template\default.ini", GUICtrlRead($Combo_1))
    $funclocset2def=$aTheme[1][1]
    $imageurl=$aThemeINI[3][1]
    restartgui()
EndFunc

Func inputdata2client()
    ;;;for trans rundown
    ;;;grab url to goto
    $aTheme[2][1]=GUICtrlRead($Input_2)
    ;;;add to launch internet explorer string to goto
    ShellExecute("iexplore.exe", $aTheme[2][1], "", "")
EndFunc
;

Func loadimage()
    GUISetState(@SW_HIDE,$mainwindow)
    $message = "Hold down Ctrl or Shift to choose multiple files."
    $var = FileOpenDialog($message, @ScriptDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )
    If @error Then
        MsgBox(4096,"","No File(s) chosen")
    Else
    #Region --- CodeWizard generated code Start ---
    ;SpashImage features: Title=Yes, Width=256, Height=256, Left=10, Top=80, Always On Top, Windows can be moved
    ;SplashImageOn("Image to load","C:\UTHERSTORAGE\TammiSoft\master TammiTrans\Location Images\default\default.jpg","256","256","10","80",16)
    ;$tempimage=SplashImageOn("Image to load",$var,"256","256","10","80",16)
    #EndRegion --- CodeWizard generated code End ---
    GUISetState(@SW_SHOW,$mainwindow)
    $var = StringReplace($var, "|", @CRLF)
        MsgBox(4096,"","You chose " & $var)
    EndIf
    ;;
    $location = StringInStr($var, "Location ", 0, 1)
    if $debugimage = 1 Then
        MsgBox(4096,"","position of location in the string is: " & $location)
    endif
    $vartrimmed=StringTrimLeft($var, 44)
    if $debugimage = 1 Then
        MsgBox(4096,"","the value of $vartrimmed is: " & $vartrimmed)
    endif
    $aThemeINI[3][1]=$vartrimmed
    if $debugimage = 1 Then
        MsgBox(4096,"","the value of $aThemeINI[3][1] is: " & $aThemeINI[3][1])
    endif
    ;;
    ;GUISwitch($mainwindow)
    ;GUISetState(@SW_SHOW,$mainwindow)
    ;GUISwitch($mainwindow)
    ;GUIDelete($mainwindow)
    ;GUICtrlSetGraphic ( $imagedefault, $GUI_GR_REFRESH)
    restartgui()
Endfunc

Func CaptureScreen()
    ;;;LAUNCH CAPTURE IT UNTIL MINE IS FIGURED OUT
    ;MsgBox(4096,"","Launching external capture program, Thank you for using TammiTrans " & $PROGRAM)
    ;Run(@Scriptdir&"\CaptureIt\CaptureIt.exe", "", @SW_MAXIMIZE)

    ;;;;;; Capture window MY STUFF THAT DIDNT WORK
    GUISetState(@SW_HIDE,$mainwindow)
    ;Local $hGUI

    ; Create GUI
    ;$hGUI = GUICreate("Screen Capture", 256, 256)
    ;GUISetState()


    $adder=_Now()
    if $debugimage = 1 Then
        MsgBox(4096,"","the value of $adder is: " & $adder)
    endif
    $adderstripped = StringReplace($adder, "/", "_")
    $adderstripped = StringReplace($adderstripped, ":", "_")
    if $debugimage = 1 Then
        MsgBox(4096,"","the value of $adderstripped is: " & $adderstripped)
    endif
    getRLCtitle()
    _ScreenCapture_CaptureWnd (@ScriptDir & "\Location Images\"&$adderstripped&"Default.jpg", $RLCtitle)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
    ;;;;; Capture window MY STUFF THAT DIDNT WORK
EndFunc

Func help()
    ;
    ;;launch the included help file from the install directory if checked
    if $debugmode=1 then
        $msgboxmsg = "Getting read to launch notepad with file: "
        MsgBox(0, $msgboxtitle&" Help launch at ok function ", $msgboxmsg&@ScriptDir&"\help.txt")
    endif
    ;if $readhelpstate = 1 then ;the box was checked
        ;launch
        ShellExecute("help.txt", "", @ScriptDir, "edit")
    ;endif
EndFunc

#region ---   END BUTTON FUNCTIONS ---




#region --- BEGIN LOGIC FUNCTIONS ---

Func makectrlsetfromini()
    local $ct, $funclocset2make, $funclocdefaultset2
    $funclocset2 = "" ;in new way null out set so it will be created each time function is called from ini file
    if $debugmode=1 then
        $msgboxmsg = "at passed to makectrlsetfromini() function the variable $animationset2 "
        MsgBox(0, $msgboxtitle&@ScriptLineNumber&" animation set check ", $msgboxmsg&$funclocset2)
    endif

    $funclocdefaultset2 = IniRead(@ScriptDir&"\Working Template\default.ini", "setup", "default", "NotFound") ;OK THIS NEEDS TO BE THE INI READ TO ARRAY AND PUT INTO SET
    if $funclocdefaultset2 = "NotFound" Then
        ;$animationset2 = "walk2tv|stepadjust|turnleft"
        ;then the user has deleted the entry and you shoudld recreate it
        ;IniWrite                                   ;write the created default set to the ini file
    endif
    $readsetfromini = IniReadSectionNames(@ScriptDir&"\Working Template\default.ini")
    if $debugmode=1 then
        $msgboxmsg = "value of the variable $readsetfromini is "
        MsgBox(0, $msgboxtitle&@ScriptLineNumber&" funcloc set check ", $msgboxmsg&$readsetfromini[0])
    endif
    if $debugmode=1 then
        $msgboxmsg = "value of the variable $readsetfromini is "
        MsgBox(0, $msgboxtitle&@ScriptLineNumber&" funcloc set check of what is in ini file", $msgboxmsg&$readsetfromini[1])
    endif
    if $debugmode=1 then
        $msgboxmsg = "value of the variable $readsetfromini is "
        MsgBox(0, $msgboxtitle&@ScriptLineNumber&" funcloc set check of what is displayed", $msgboxmsg&$funclocset2)
    endif
    If @error Then
            MsgBox(4096, "", "Error occurred, probably no INI file.")
        Else


            For $ct = 1 To $readsetfromini[0]
                ;$animationset2=$animationset2&$ctrlsetsep&$readsetfromini[$i]
                $funclocset2make=$funclocset2make&$ctrlsetsep&$readsetfromini[$ct];&$ctrlsetsep;$animationset2&&$readsetfromini[$i]
                ;$animationset2=$readsetfromini[$i]&$ctrlsetsep&$readsetfromini[$i]
                ;$animationset2=$readsetfromini[$i]&$ctrlsetsep;&;&$readsetfromini[$i]
                ;$animationset2=$animationset2&$ctrlsetsep&$readsetfromini[$i];&;&$readsetfromini[$i]
                if $debugmode = 1 then
                    MsgBox(4096, "", $readsetfromini[$ct]&@ScriptLineNumber)
                    MsgBox(4096, "", $funclocset2&@ScriptLineNumber)
                endif
            Next

            $funclocset2=$funclocset2make;=$anisetwas
    EndIf
endfunc

Func comparectrlset()
    ;;verify $animationset2 is not null which would indicate firts run
    if $funclocsetwas = "" Then;this is the first run thru create the same ani set as in makectrset
        makectrlsetfromini()
    endif
    $result = StringCompare($funclocset2, $funclocsetwas)
    if $result = 0 then
        ;string 1 and string 2 are equal no need to make actrl set
        ;makectrlsetfromini()
        return ;from whence you came
    endif
    if $result > 0 then
        ;string 1 is greater than string 2 the strings dont match create a new set from the ini file
        ;makectrlsetfromini()
    endif
    if $result < 0 then
        ;string 1 is greater than string 2 the strings dont match create a new set from the ini file
        makectrlsetfromini()
    endif
EndFunc



Func getRLCtitle() ;sets global status variable $RLCclientstatus RETURNS $RLCtitle
    AutoItSetOption("WinTitleMatchMode", 1)
    ;$RLCdeftitle=IniRead(@ScriptDir&$dirslash&$ininame&$iniexten, "Setup", "$RLCdeftitle", "NotFound")
    if $usealtset = 0 then
        $RLCdeftitle=IniRead(@ScriptDir&$dirslash&$ininame&$iniexten, "Setup", "$RLCdeftitle", "NotFound")
    endif
    if $RLCdeftitle = "NotFound" Then
        $RLCdeftitle = "Utherverse VWW Client - "
    EndIf
    if $debugmodeTITLE=1 then
            $msgboxmsg = "The VALUE of @ERROR is "
            MsgBox(0, $msgboxtitle&" at RLCTITLE FUNCTION $debugmodeTITLE ", $msgboxmsg&@ERROR)
            ;MsgBox(0, "Mouse x,y:", $mousepos[0] & "," & $mousepos[1])
    endif
    If WinExists($RLCdeftitle) Then
        WinActivate($RLCdeftitle, "")
        WinWaitActive($RLCdeftitle, "", 5)
        $RLCtitle = WinGetTitle($RLCdeftitle, "")
        ;RLCclient window DOES exist
        ;SendKeepActive ($RLCtitle)
        if $debugmodeTITLE=1 then
            $msgboxmsg = "The "&$RLCtitle&" does exist "
            MsgBox(0, $msgboxtitle&" at RLCTITLE  FUNCTION getRLCtitle() says: ", $msgboxmsg)
        endif
        ;set variable to show client DOES exist
        $RLCclientstatus=1
        ;tell the user??????

        Return
    Else
        ;RLCclient window DOES NOT exist
        ;set variable to show client DOES NOT exists
        $RLCclientstatus=0
        ;set varialble $RLCtitle to default to display in message box
        ;$RLCtitle="TwT SmartChat"
        $RLCtitledef="Utherverse VWW Client - Utherverse Primary"
        if $debugmodeTITLE=1 then
            $msgboxmsg = "The "&$RLCtitledef&" does not exist "
            MsgBox(0, $msgboxtitle&" at RLCTITLE FUNCTION getRLCtitle() says: ", $msgboxmsg)
            ;MsgBox(0, "Mouse x,y:", $mousepos[0] & "," & $mousepos[1])
        endif
        ;tell the user?????
        if $RLCclientstatbypass = 0 then
            $msgboxmsg = "The "&$RLCtitledef&" does not exist "&@crlf&"OUTPUTS are DISABLED"&@crlf&"Restart the program with "&$RLCtitledef&" running to enable outputs."&@crlf&"However any locations entered will be saved for future use."
            MsgBox(0, $PROGRAM&" NOTIFICATION", $msgboxmsg)
        endif
    ENDIF
endfunc
#region ---   END LOGIC FUNCTIONS ---

#region ---   BEGIN SETUP FUNCTIONS ---

Func getwindowpos($checkthiswin)
    local $size
    $size = WinGetPos($checkthiswin)
    $mywinlocation = WinGetPos($checkthiswin)
    if $debugmodePOSINI=1 then
         MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
     endif
     ;$mywinlocation=$size
     ;$checkthiswin=$size
     $mywinlocation=$size
    IF $debugmodePOSINI = 1 Then
        ;;;;
        ;MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
        ;MsgBox(0, "Active window stats (x,y,width,height):", $checkthiswin[0] & " " & $checkthiswin[1] & " " & $checkthiswin[2] & " " & $checkthiswin[3])
        MsgBox(0, "Active window stats of $checkthiswin (x,y,width,height):", $checkthiswin)
    EndIf
    IF $debugmodePOSINI = 1 Then
        MsgBox(0, "Active window stats (x,y,width,height):", $mywinlocation[0] & " " & $mywinlocation[1] & " " & $mywinlocation[2] & " " & $mywinlocation[3])
        ;MsgBox(0, "Active window stats of $mywinlocation (x,y,width,height):", $mywinlocation)
    EndIf
    Return ($mywinlocation)
EndFunc  ;==>getwindowpos

Func regcheck()
    local $ri;, $wantdemomode
    ;;read registry entries to check if installer was ran and enable modules
    $tTRANSbase = _StringEncrypt(0, RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TwTSoft", "module8"), @ComputerName)
    $tTRANSmodule1 = _StringEncrypt(0, RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TwTSoft", "module9"), @ComputerName)
    if $debugmodeREGISTRY=1 then
        ;for $i = 1 to 6
            $msgboxmsg = "value of the variable $base is "
            MsgBox(0, $msgboxtitle&" reg read check "&@ScriptLineNumber, $msgboxmsg&$tTRANSbase)
            $msgboxmsg = "value of the variable $module1 is "
            MsgBox(0, $msgboxtitle&" reg read check "&@ScriptLineNumber, $msgboxmsg&$tTRANSmodule1)

        ;next
    endif
    ;
    if $tTRANSbase = "included" then                    ;MAIN PROGRAM
        ;;allow software to continue to run
        ;;set flag to enable program
        $BASEmodeenable=1
        ;;return to launch area and run gui
    EndIf
    if $tTRANSbase = "includednot" then
        ;;prevent software to run UNLESS IN DEBUG MODE and demo mode
            $wantdemomode = MsgBox(3, $PROGRAM&" Startup Message.", "Do You wish to DEMO the software with outputs disabled! Yes continues, No/Cancel Exits!")
            if $wantdemomode = 6 then   ;yes was pushed
                ;$RLCclientstatbypass= 1 ;set the bypass to enable
                ;$oktopaste=0
                $BASEmodeenable=1
            endif
            if $wantdemomode = 7 then   ;no was pushed
                $RLCclientstatbypass= 0
                ;$oktopaste=0
                CLOSEClicked()
                ;exit out of ENTIRE PROGRAM
            endif
            if $wantdemomode = 2 then   ;cancel was pushed
                $RLCclientstatbypass = 0
                $msgboxmsg = "Thank you for using "&$PROGRAM&" Calling exit."
                MsgBox(0, $PROGRAM&" Message", $msgboxmsg)
                ;$oktopaste=0
                CLOSEClicked()
            endif
    ;endif

            ;if $debugmode = 0 Then
                ;$BASEmodeenable=0
                ;CLOSEClicked()
            ;EndIf
            if $debugmode = 1 Then
                $BASEmodeenable=1
            EndIf
        ;;call closed exit function?
    EndIf
    if $tTRANSbase = "" then    ;;in demo mode this would be the standard operating condition
        ;;announce critical error
        $wantdemomode = MsgBox(262147, $PROGRAM&" Startup Message.", "Do you wish to DEMO the software? Yes continues, No/Cancel Exits!")
        if $wantdemomode = 6 then   ;yes was pushed
                ;$RLCclientstatbypass= 1 ;set the bypass to enable
                ;$oktopaste=1
                $BASEmodeenable=1
                $PROGRAM=$PROGRAM&" Demo"
                $tTRANSbase = _StringEncrypt(0, RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TwTSoft", "module8"), @ComputerName)
                If $tTRANSbase = "" Then
                    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\TwTSoft", "TwTSoft tTRANS", "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))
                    SetError(0)
                EndIf



                ;If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TwTSoft", "TwTSoft AZT") = "" Then
                    ;RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\TwTSoft", "TwTSoft AZT", "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))
                    ;SetError(0)
                ;EndIf
                $startdate = _StringEncrypt(0, RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TwTSoft", "TwTSoft tTRANS"), @ComputerName)

                If _DateDiff("D", $startdate, _NowCalc()) > $totaldemodays Then
                    MsgBox(0, "*TammiSoft TRANS*", "You're registration period has expired. Please Contact TammiSoft.")
                    CLOSEError()
                    ;Exit
                EndIf
                $demodaysremaining=$totaldemodays-_DateDiff("D", $startdate, _NowCalc())
                $PROGRAM=$PROGRAM&" Demo"&" (("&$demodaysremaining&") days remaining.)"
                MsgBox(262144, $PROGRAM&" Startup Message.", "Total Demo time is "&$totaldemodays&" days!"&@crlf&"You have "&$demodaysremaining&" days remaining.", 5)
        endif
        if $wantdemomode = 7 then   ;no was pushed
                $RLCclientstatbypass= 0
                ;$oktopaste=0
                CLOSEClicked()
                ;exit out of ENTIRE PROGRAM
        endif
        if $wantdemomode = 2 then   ;cancel was pushed
                $RLCclientstatbypass = 0
                $msgboxmsg = "Thank you for using "&$PROGRAM&" Calling exit."
                MsgBox(0, $PROGRAM&" Message", $msgboxmsg)
                ;$oktopaste=0
                CLOSEClicked()
        endif
        ;$msgboxmsg = "Critical files are missing or data is corrupt, "&$PROGRAM&" will exit. Contact author with this error message. Message # "&@ScriptLineNumber
        ;MsgBox(0, $PROGRAM&" ERROR", $msgboxmsg)
        ;;call closed exit function?
        ;CLOSEError()
    EndIf
    if $tTRANSmodule1 = "included" then             ;ANIMATION MODULE
        ;;allow software to continue to run
        ;;set flag to enable program
        ;$animodeOK=1
        ;$animationonenable=1
        ;;return to launch area and run gui
    EndIf
    if $tTRANSmodule1 = "includednot" then
        ;;prevent software to run
        ;$animodeOK=0
        ;;call closed exit function?
        ;if $debugmode = 0 Then
            ;CLOSEClicked()
        ;EndIf
    EndIf
    if $tTRANSmodule1 = "" then
        ;;announce critical error
        if $wantdemomode = 6 then   ;yes was pushed
                ;$RLCclientstatbypass= 1 ;set the bypass to enable
            ;$oktopaste=1
            ;$BASEmodeenable=1
            ;$animodeOK=1
            ;$animationonenable=1
        endif
        ;$animodeOK=0
        $msgboxmsg = "Critical files are missing or data is corrupt, "&$PROGRAM&" will exit. Contact author with this error message. Message # "&@ScriptLineNumber
        ;MsgBox(0, $PROGRAM&" ERROR", $msgboxmsg)
        ;;call closed exit function?
        ;CLOSEError()
    EndIf
endfunc

Func CLOSEClicked()
  ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
  ;and @GUI_WINHANDLE would equal $mainwindow
  ;;get the window position of the GUI so it will restart the next time
  ;if winexists ($mainwindow) then ;the gui was actually up when exit was called
    ;;save the window position of the GUI into the ini
    if @GUI_WINHANDLE = $mainwindow Then
        $checkthiswin=$mainwindow
        getwindowpos($checkthiswin)
        $openxpos=$mywinlocation[0]
        $openypos=$mywinlocation[1]
        if $openxpos < -2500 Then
            $openxpos = 10
        endif
        if $openypos < -2500 Then
            $openypos = 80
        endif
        IniWrite(@ScriptDir&"\setup.ini", "setup", "$openxpos",$openxpos)
        IniWrite(@ScriptDir&"\setup.ini", "setup", "$openypos",$openypos)
        ;cool to proceed to exit
        MsgBox(262144, $PROGRAM, "You clicked CLOSE! Exiting...Goodbye ((this box will close))", 5)
        Exit
    endif
    if @GUI_WINHANDLE = $hGUI Then
        ;;
        GUIDelete($hGUI)
        GUISetState(@SW_SHOW,$mainwindow)
    endif
EndFunc   ;==>CLOSEClicked

Func CLOSEError()
  ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
  ;and @GUI_WINHANDLE would equal $mainwindow
  MsgBox(262144, $PROGRAM, "The Base Package is not installed to run....Run the Lisence Manager to correct or contact TwTSoftl, Goodbye ((this box will close))", 5)
  Exit
EndFunc   ;==>CLOSEClicked

Func CLOSEAlreadyrunning()
  ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
  ;and @GUI_WINHANDLE would equal $mainwindow
  MsgBox(262144, $PROGRAM, "The program was already running exiting. Goodbye ((this box will close))", 5)
  Exit
EndFunc   ;==>CLOSEClicked


Func altclientmaker()
    local $helpgroupcheckstyle
    $helpgroupcheckstyle=Bitor($GUI_SS_DEFAULT_CHECKBOX,$BS_AUTORADIOBUTTON)
    $helpgroupcheckstyle=Bitor($GUI_SS_DEFAULT_CHECKBOX,$BS_AUTORADIOBUTTON)
    ;Opt("GUIOnEventMode", 0)
    ;;this function will prompt user for the name of the client to output to because the default does not exist
    ;;it should build a list of all alternate VWW clients to playback thru, then if none are open the next time prompt for a new one
    $altgui = GuiCreate($PROGRAM&" Alternate Client List", 382, 113,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    ;$altCombo_1 = GuiCtrlCreateCombo("Combo1", 30, 30, 330, 21)
    $altCombo_1 = GUICtrlCreateCombo ($altsetdef, 30,30,330,21) ; create first item
    $altset = IniRead(@ScriptDir&"\TammiSoftSmartChat.ini", "setup", "$altset", "NotFound")
    if $altset = "NotFound" Then
        $altset = "GET-AWAY - [Login] - 1.09.1728|Utherverse® 3D Client - [Login] - 1.09.1728";which is initialized defaults
    endif
    if $altset = "" Then
        $altset = "GET-AWAY - [Login] - 1.09.1728|Utherverse® 3D Client - [Login] - 1.09.1728";which is initialized defaults
    endif
    GUICtrlSetData(-1,$altset,$altsetdef)
    $altButton_2 = GuiCtrlCreateButton("OK", 290, 70, 60, 30)
    $altGroup_3 = GuiCtrlCreateGroup("Select or Enter Alternate VWW Client name.", 10, 10, 360, 50)
    ;$altButton_4 = GuiCtrlCreateButton("Remove", 30, 70, 60, 30)
    $altCheckbox_6 = GuiCtrlCreateCheckbox("Remove from Set list", 20, 80, 100, 20)
    $altCheckbox_5 = GuiCtrlCreateCheckbox("Set as Default", 160, 80, 100, 20)
    GuiSetState()
    GUICtrlSetOnEvent($altButton_2, "altokButton")

    GUISetOnEvent($GUI_EVENT_CLOSE, "altCLOSEClicked")
EndFunc



Func altokButton()
    ;;get state of combo box
    ;;get state of rem radio button
    $altCheckbox_6state= GUICtrlRead($altCheckbox_6)
    if $altdebugmode=1 then
        $msgboxmsg = "The state of the default check box  $altCheckbox_6state is "
        MsgBox(0, $msgboxtitle&" FUNCTION altokButton ", $msgboxmsg&$altCheckbox_6state)
    endif
    ;;get state of default radio button
    $altCheckbox_5state= GUICtrlRead($altCheckbox_5)
    if $altdebugmode=1 then
        $msgboxmsg = "The state of the default check box  $altCheckbox_5state is "
        MsgBox(0, $msgboxtitle&" FUNCTION altokButton ", $msgboxmsg&$altCheckbox_5state)
    endif
    ;;see if entry is in default set
    ;;add entry to default set if not there
    ;;write default set to ini file
            ;now get the state of the $genphrase2send variable
        $altCombo_1state = GUICtrlRead($altCombo_1)
        ;ClipPut($altCombo_1state)
            if $altdebugmode=1 then
              $msgboxmsg = "The FUNCTION altokButton is being called"
              MsgBox(0, $msgboxtitle&" FUNCTION altokButton ", $msgboxmsg)
            endif


        if $altCombo_1state = " " Then
            ;;do nothing dont notify and leave the gui up and alone
            ;$calledfrom="showtabzero"
            return
            ;restartgui($calledfrom)
        else
            ;clickthisspottwice($xpos,$ypos) ;twice was need here at testing
             if $altdebugmode=1 then
                $msgboxmsg = "The FUNCTION Tab0okButton variable $genphrase2sendstate is "
                MsgBox(0, $msgboxtitle&" FUNCTION Tab0okButton ", $msgboxmsg&$altCombo_1state)
             endif
        ;pastesequence()
            ;$calledfrom="showtabzero"
        endif
        ;;begin checking the string for set inclusion
        $result = StringInStr($altset,$altCombo_1state,0)
        if $result = 0 Then
            ;;entry is new does not appear in current string check it for length
            ;trimmyinputstring()
            ;then add it to the $genphraseset then continue
            ;$genphrasedef
            $altset = $altCombo_1state&$ctrlsetsep&$altset
            ;$genphraseset = $genphrase2sendstate&$ctrlsetsep&$genphraseset
            if $debugmode=1 then
                $msgboxmsg = "The $genphraseset is now set to "
                MsgBox(0, $msgboxtitle&" plset added routine ", $msgboxmsg&$genphraseset)
            endif

            IniWrite(@ScriptDir&$dirslash&$ininame&$iniexten, "Setup", "$altset",$altset)
            ;return
            ;$calledfrom="showtabzero"
            restartgui()
        endif
        if $result > 0 Then ;returns position of string so $result greater than 1 = string is there
        ;;entry is currently in the string genset and the process should now continue
        endif
        if $debugmode=1 then
           $msgboxmsg = "The search result of the altset is "
           MsgBox(0, $msgboxtitle&" altset string check "&@ScriptLineNumber, $msgboxmsg&$result)
       endif
       $mousepos=$iamatlocation
        if $debugmode=1 then
              $msgboxmsg = "The variable  $mousepos after assigning from variable $iamatlocation is "
              MsgBox(0, $msgboxtitle&" FUNCTION getMOUSEpos ", $msgboxmsg&"Mouse x,y: "&$mousepos[0] & "," & $mousepos[1])
        endif
        ;trimmyinputstring()
        $calledfrom="showtabzero"
        ;restartgui($calledfrom)
       ;return2clickloc($mousepos)
       ;if the thing for check is set

       $trimresult = StringTrimRight($altCombo_1state, 9)
        if $altdebugmode=1 then
            $msgboxmsg = "The state of the variable $trimresult is "
            MsgBox(0, $msgboxtitle&" FUNCTION altokButton ", $msgboxmsg&$trimresult)
        endif
       $RLCdeftitle=$trimresult ;;set it to default rlc title here is just for this session
       $usealtset=1
       if $altCheckbox_5state = 1 then
           ;;write the picked client to the ini as default
           IniWrite(@ScriptDir&$dirslash&$ininame&$iniexten, "Setup", "$RLCdeftitle",$RLCdeftitle);;set it to default rlc title here to write to ini file
           $usealtset=0
       endif

EndFunc
func altCLOSEClicked()
    ;;
    GUIDelete($altgui)
    ;$calledfrom="Start"
    ;TwTSmartChatGUI($calledfrom)
endfunc
#region ---   END SETUP FUNCTIONS ---

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