anub13 Posted March 27, 2017 Author Share Posted March 27, 2017 Hi all, sorry for late reply... I have tried all post and seems nothing worked, when I execute it, checking is online is hanging(please take look at whole script), and Kickstarter15, Subz post, when I tried to choose one of the radio button it was triggered endless loop, I wonder why though even I have re-check that I wrote the same as you guys did.. Link to comment Share on other sites More sharing options...
anub13 Posted March 27, 2017 Author Share Posted March 27, 2017 Sorry for double post, I cant find the edit button As 232Showtime advised with $vRadio = ControlGetText($Form1_1, "", $radio1), I have tried it using IF THEN ... If $radio1 = $GUI_CHECKED Then $vRadio = ControlGetText($Form1_1, "", $radio1) Else $vRadio = ControlGetText($Form1_1, "", $radio2) EndIf the logic always fall to ELSE because the state is not choosen at all, but when I choose another option, the value from $vRadio is not changed, is there any function like jquery/javascript that if the option is change the value is changed also? I tried to google it but seems not having any luck.. Link to comment Share on other sites More sharing options...
Subz Posted March 28, 2017 Share Posted March 28, 2017 @anub13 The script requires a lot of work to tidy the code up, it's extremely difficult to read, here is what I can tell: The Select statement isn't in a loop and occurs during the Gui build so because by default no radio is selected, $chkPatrol = "". So try this, replace Func StartForm() with the following: What it does is checks the radio button when it's pressed and updates the edit box accordingly, if you switch radio options it will update the editbox again. By default Categ = "" since neither radio is selected. Hope that helps. expandcollapse popupFunc _CheckPatrol() Local $bChkPatrol = False Select Case GUICtrlRead($radio1) = $GUI_CHECKED $chkPatrol = $Wise $bChkPatrol = True Case GUICtrlRead($radio2) = $GUI_CHECKED $chkPatrol = $Internet $bChkPatrol = True EndSelect If $bChkPatrol = True Then GUICtrlSetData($txtInfo,"ADDITIONAL INFORMATION THAT WILL BE SENT WITH THE MESSAGE:" & @CRLF & ASDFGSystemInfo()) $bChkPatrol = False EndIf EndFunc func StartForm() GUICtrlSetData($txtInfo,"ADDITIONAL INFORMATION THAT WILL BE SENT WITH THE MESSAGE:" & @CRLF & ASDFGSystemInfo()) GUISetState(@SW_SHOW) AdlibRegister("_CheckPatrol") While 1 $nMsg = GUIGetMsg() Select case $nMsg = $txtEmailAddress GUICtrlSetData($txtInfo,"ADDITIONAL INFORMATION THAT WILL BE SENT WITH THE MESSAGE:" & @CRLF & ASDFGSystemInfo()) case $nMsg = $txtPhone GUICtrlSetData($txtInfo,"ADDITIONAL INFORMATION THAT WILL BE SENT WITH THE MESSAGE:" & @CRLF & ASDFGSystemInfo()) case $nMsg = $txtFullName GUICtrlSetData($txtInfo,"ADDITIONAL INFORMATION THAT WILL BE SENT WITH THE MESSAGE:" & @CRLF & ASDFGSystemInfo()) Case $nMsg = $cmdScreenShot $gScreenShotFile = SaveScreenShot() case $nMsg = $cmdSubmit if ValidateForm() then if ASDFGSubmit() Then UpdateStatus("Your request has been sent successfully") MsgBox(0,"Help Requested","Your request has been sent successfully") ExitLoop Else MsgBox(0,"Help Failed","Something is wrong you request was not sent, please try again") Endif endIf case $nMsg = $cmdAttach $gAttachFile = AttachFile() Case $nMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd AdlibUnRegister("_CheckPatrol") EndFunc Link to comment Share on other sites More sharing options...
anub13 Posted March 28, 2017 Author Share Posted March 28, 2017 Hi Subz, Thank you for the explanation, I tried your code and when choose the radio button output from ASDFGSystemInfo() , the $txtInfo GUI keep scrolling back up.. I can't see the result.... I think the problem is with the ASDFGSystemInfo(), please take a look at this code if $isAdminVersion=0 then $ASDFGInfo = $ASDFGInfo & @CRLF & " Ticket Tags:" & @CRLF $ASDFGInfo = $ASDFGInfo & "~userphone='" & GUICtrlRead($txtPhone) & "'" & @CRLF $ASDFGInfo = $ASDFGInfo & "~submitterphone='" & GUICtrlRead($txtPhone) & "'" & @CRLF dim $MachineID $MachineID = KaseyaIni($gKIniFile,"SERVER COMMUNICATIONS","User_Name","NotFound") $ASDFGInfo = $ASDFGInfo & "~machineid='" & $MachineID & "'" & @CRLF dim $OrgGroups $OrgGroups= StringSplit($MachineID,".") dim $OrgGroupIndex $OrgGroupIndex = UBound($OrgGroups) - 1 $ASDFGInfo = $ASDFGInfo & "~organization='" & $OrgGroups[$OrgGroupIndex] & "'" & @CRLF dim $EmailUser $EmailUser = GUICtrlRead($txtEmailAddress) $EmailUser = StringMid($EmailUser,1,StringInStr($EmailUser,"@") - 1) $ASDFGInfo = $ASDFGInfo & "~username='" & $EmailUser & "'" & @CRLF dim $categ $categ = $bChkPatrol $ASDFGInfo = $ASDFGInfo & "~category='" & $categ & "'" & @CRLF $ASDFGInfo = $ASDFGInfo & "~afterhour='" & $AfterHour & "'" & @CRLF endif If the $categ = $bChkPatrol it was giving error like this(please see pict) and If I change the $categ = $chkPatrol the script can be complied and showing bug? as I said in first sentence. Sorry if I am slow learner be easy on me. Link to comment Share on other sites More sharing options...
anub13 Posted March 28, 2017 Author Share Posted March 28, 2017 Sorry for double post again, I really cant find edit button I have changed the $bChkPatrol to Global still showing the same symptoms Link to comment Share on other sites More sharing options...
Subz Posted March 28, 2017 Share Posted March 28, 2017 Change it to $chkPatrol, $bchkPatrol is only for the _CheckPatrol function it shouldn't be used anywhere else otherwise it won't allow you to scroll the editbox, when you compiled the script and run it, click either of the radio buttons it should update. Link to comment Share on other sites More sharing options...
anub13 Posted March 28, 2017 Author Share Posted March 28, 2017 1 minute ago, Subz said: Change it to $chkPatrol, $bchkPatrol is only for the _CheckPatrol function it shouldn't be used anywhere else otherwise it won't allow you to scroll the editbox, when you compiled the script and run it, click either of the radio buttons it should update. As I said in the previous reply I have tried that and the $txtInfo GUI keep scrolling back up when I tried to see the value.. just to confirm you meant the $categ = $chckPatrol right? Link to comment Share on other sites More sharing options...
Subz Posted March 28, 2017 Share Posted March 28, 2017 Can you replace _CheckPatrol with the following and yes please leave $categ = $chkPatrol Func _CheckPatrol() Local $bChkPatrol = False Select Case GUICtrlRead($radio1) = $GUI_CHECKED If GUICtrlRead($radio1, 1) <> $chkPatrol Then $chkPatrol = $Wise $bChkPatrol = True EndIf Case GUICtrlRead($radio2) = $GUI_CHECKED If GUICtrlRead($radio2, 1) <> $chkPatrol Then $chkPatrol = $Internet $bChkPatrol = True EndIf EndSelect If $bChkPatrol = True Then GUICtrlSetData($txtInfo,"ADDITIONAL INFORMATION THAT WILL BE SENT WITH THE MESSAGE:" & @CRLF & ASDFGSystemInfo()) $bChkPatrol = False EndIf anub13 1 Link to comment Share on other sites More sharing options...
anub13 Posted March 28, 2017 Author Share Posted March 28, 2017 OMG! It did the trick! You are awesome Subz! Thanks people who are responding and spent your time reading and try to help my problem! Very much appreciated! I can't say anymore word beside thank you very much. In some future I might ask more problem Link to comment Share on other sites More sharing options...
KickStarter15 Posted March 28, 2017 Share Posted March 28, 2017 As I told you in your first post that this forum can help you if you can provide more codes and details. Cheerss..!! Glad to help and welcome to autoit. I can assure you that Subz is one of the best in this forum. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
anub13 Posted March 28, 2017 Author Share Posted March 28, 2017 (edited) @KickStarter15 Thanks, yea I was hestitate because it contains important link I just altered all important one. again thank you for all people who is helping me. EDIT: edit typos, btw now I can edit Edited March 28, 2017 by anub13 Link to comment Share on other sites More sharing options...
232showtime Posted March 28, 2017 Share Posted March 28, 2017 4 hours ago, anub13 said: Sorry for double post, I cant find the edit button As 232Showtime advised with $vRadio = ControlGetText($Form1_1, "", $radio1), I have tried it using IF THEN ... If $radio1 = $GUI_CHECKED Then $vRadio = ControlGetText($Form1_1, "", $radio1) Else $vRadio = ControlGetText($Form1_1, "", $radio2) EndIf the logic always fall to ELSE because the state is not choosen at all, but when I choose another option, the value from $vRadio is not changed, is there any function like jquery/javascript that if the option is change the value is changed also? I tried to google it but seems not having any luck.. it will jump to else because the line is waiting for $GUI_CHECKED, you can try it like this If $radio1 = $GUI_CHECKED Then $vRadio = ControlGetText($Form1_1, "", $radio1) EndIf If $radio2 = $GUI_CHECKED Then $vRadio = ControlGetText($Form1_1, "", $radio2) EndIf anyway its working... cheers... ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
anub13 Posted March 28, 2017 Author Share Posted March 28, 2017 @232showtime Hi Just tried, it doesnt give anything.. even when I change the option. Appreciated the help @232showtime . Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now