Jump to content

GUICtrlRichEdit_StreamToVar


Gax
 Share

Recommended Posts

Has anyone else had any success using GUICtrlRichEdit_StreamToVar and _StreamFomVar?

I am trring to grab the data from a GUICtrlRichEdit_Create, but I am missing something.

 here is my piece mealed code:

It is still a work in progress and also has something that is causing the submit button to take several clicks before working.

Anyhelp would be appreciated.

#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

$hGUI = GUICreate( "Create New Ticket", 468, 383, -1, -1)
$PC = GUICtrlCreateRadio( "PC", 220, 10, 60, 30)
$MAC = GUICtrlCreateRadio( "MAC", 220, 40, 112, 26)
$name = GUICtrlCreateInput( "", 60, 10, 120, 20)
$hLabel = GUICtrlCreateLabel( "Name:", 10, 10, 40, 20)
$local = GUICtrlCreateInput( "", 60, 50, 120, 20)
GUICtrlSetTip( -1, "Cube, Office or Desk#")
$hLabel2 = GUICtrlCreateLabel( "Location:", 10, 50, 50, 20)
$hLabel3 = GUICtrlCreateLabel( "Phone#:", 10, 80, 40, 20)
$phone = GUICtrlCreateInput( "", 60, 80, 120, 20)
$hLabel4 = GUICtrlCreateLabel( "Detailed Description:", 10, 150, 110, 20)
$submit = GUICtrlCreateButton( "Submit Ticket", 340, 340, 80, 20)
GUICtrlSetColor( -1, 0x000000)
GUICtrlSetBkColor( -1, 0x3FF711)
$describe = _GUICtrlRichEdit_Create( $hGUI,"", 10, 180, 450, 150)
$Short = GUICtrlCreateInput( "", 10, 130, 250, 20)
$hLabel5 = GUICtrlCreateLabel( "Enter A Short Description:", 10, 110, 160, 20)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            _GUICtrlRichEdit_Destroy($describe)
            Exit
    EndSwitch
    $msg = GUIGetMsg()
        Select
                ExitLoop
            Case $msg = $submit
                ShellExecute("chrome.exe", "https://mail.google.com/mail/u/0/?shva=1#inbox?compose=new""","","")
                Sleep ( 5000 )
                send ("tim.xxxxxx@xxxxxx.com")
                Sleep (500)
                Send ("{ENTER}")
                sleep (500)
                send ("{TAB}")
                $shrt = GUICtrlRead($short)
                send ($shrt)
                send ("{TAB}")
                  $nm = GUICtrlRead($name)
                  Send ("Name: ")
                  send($nm)
                  Send ("{ENTER 2}")
                $lcl = GUICtrlRead($local)
                send ("Location:" )
                send ($lcl)
                Send ("{ENTER 2}")
                  $phn = GUICtrlRead($phone)
                  send ("Phone number:" )
                  send ($phn)
                  Send ("{ENTER 2}")
                $dsc = _GUICtrlRichEdit_StreamToVar($describe)
                Send ("Detailed description: ")
                Send ("{ENTER}")
                  _GUICtrlRichEdit_SetText($describe, "")
                  _GUICtrlRichEdit_StreamFromVar($describe, $dsc)
                 ;send ($dsc)
               
       EndSelect
WEnd
Link to comment
Share on other sites

only use 1 GuiGetMsg and put all your cases under 1 select

#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

$hGUI = GUICreate( "Create New Ticket", 468, 383, -1, -1)
$PC = GUICtrlCreateRadio( "PC", 220, 10, 60, 30)
$MAC = GUICtrlCreateRadio( "MAC", 220, 40, 112, 26)
$name = GUICtrlCreateInput( "", 60, 10, 120, 20)
$hLabel = GUICtrlCreateLabel( "Name:", 10, 10, 40, 20)
$local = GUICtrlCreateInput( "", 60, 50, 120, 20)
GUICtrlSetTip( -1, "Cube, Office or Desk#")
$hLabel2 = GUICtrlCreateLabel( "Location:", 10, 50, 50, 20)
$hLabel3 = GUICtrlCreateLabel( "Phone#:", 10, 80, 40, 20)
$phone = GUICtrlCreateInput( "", 60, 80, 120, 20)
$hLabel4 = GUICtrlCreateLabel( "Detailed Description:", 10, 150, 110, 20)
$submit = GUICtrlCreateButton( "Submit Ticket", 340, 340, 80, 20)
GUICtrlSetColor( -1, 0x000000)
GUICtrlSetBkColor( -1, 0x3FF711)
$describe = _GUICtrlRichEdit_Create( $hGUI,"", 10, 180, 450, 150)
$Short = GUICtrlCreateInput( "", 10, 130, 250, 20)
$hLabel5 = GUICtrlCreateLabel( "Enter A Short Description:", 10, 110, 160, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
        Select
            Case $msg = $submit
                ShellExecute("chrome.exe", "https://mail.google.com/mail/u/0/?shva=1#inbox?compose=new""","","")
                Sleep ( 5000 )
                send ("tim.xxxxxx@xxxxxx.com")
                Sleep (500)
                Send ("{ENTER}")
                sleep (500)
                send ("{TAB}")
                $shrt = GUICtrlRead($short)
                send ($shrt)
                send ("{TAB}")
                  $nm = GUICtrlRead($name)
                  Send ("Name: ")
                  send($nm)
                  Send ("{ENTER 2}")
                $lcl = GUICtrlRead($local)
                send ("Location:" )
                send ($lcl)
                Send ("{ENTER 2}")
                  $phn = GUICtrlRead($phone)
                  send ("Phone number:" )
                  send ($phn)
                  Send ("{ENTER 2}")
                $dsc = _GUICtrlRichEdit_StreamToVar($describe)
                Send ("Detailed description: ")
                Send ("{ENTER}")
                  _GUICtrlRichEdit_SetText($describe, "")
                  _GUICtrlRichEdit_StreamFromVar($describe, $dsc)
                 ;send ($dsc)
            Case $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($describe)
                Exit
               
       EndSelect
WEnd

That should help the button issue

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I need to play around with this more, there's something seriously wrong. It keeps thinking the submit button is clicked after the first time. But I think you're passing the handle of the rich edit control through the stream instead of the contents. This is apparent using MsgBox to display what's in the $description and $dsc before it goes to stream.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

this is almost working

#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

$hGUI = GUICreate( "Create New Ticket", 468, 383, -1, -1)
$PC = GUICtrlCreateRadio( "PC", 220, 10, 60, 30)
$MAC = GUICtrlCreateRadio( "MAC", 220, 40, 112, 26)
$name = GUICtrlCreateInput( "", 60, 10, 120, 20)
$hLabel = GUICtrlCreateLabel( "Name:", 10, 10, 40, 20)
$local = GUICtrlCreateInput( "", 60, 50, 120, 20)
GUICtrlSetTip( -1, "Cube, Office or Desk#")
$hLabel2 = GUICtrlCreateLabel( "Location:", 10, 50, 50, 20)
$hLabel3 = GUICtrlCreateLabel( "Phone#:", 10, 80, 40, 20)
$phone = GUICtrlCreateInput( "", 60, 80, 120, 20)
$hLabel4 = GUICtrlCreateLabel( "Detailed Description:", 10, 150, 110, 20)
$submit = GUICtrlCreateButton( "Submit Ticket", 340, 340, 80, 20)
GUICtrlSetColor( -1, 0x000000)
GUICtrlSetBkColor( -1, 0x3FF711)
$describe = _GUICtrlRichEdit_Create( $hGUI,"", 10, 180, 450, 150)
$Short = GUICtrlCreateInput( "", 10, 130, 250, 20)
$hLabel5 = GUICtrlCreateLabel( "Enter A Short Description:", 10, 110, 160, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
        Select
            Case $msg = $submit
                ShellExecute("chrome.exe", "https://mail.google.com/mail/u/0/?shva=1#inbox?compose=new""","","")
                Sleep ( 5000 )
                send ("tim.xxxxxx@xxxxxx.com")
                Sleep (500)
                Send ("{ENTER}")
                sleep (500)
                send ("{TAB}")
                $shrt = GUICtrlRead($short)
                send ($shrt)
                send ("{TAB}")
                  $nm = GUICtrlRead($name)
                  Send ("Name: ")
                  send($nm)
                  Send ("{ENTER 2}")
                $lcl = GUICtrlRead($local)
                send ("Location:" )
                send ($lcl)
                Send ("{ENTER 2}")
                  $phn = GUICtrlRead($phone)
                  send ("Phone number:" )
                  send ($phn)
                  Send ("{ENTER 2}")
                $dsc = _GUICtrlRichEdit_StreamToVar($describe)
                MsgBox(0,"",$dsc)
                Send ("Detailed description: ")
                Send ("{ENTER}")
                  _GUICtrlRichEdit_SetText($describe, "")
                  _GUICtrlRichEdit_StreamFromVar($describe, $dsc)
                 ;send ($dsc)
            Case $msg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($describe)
                Exit

       EndSelect
WEnd

I have a msgbox in there so you can see that the text entered in the box shows up (look for the lines that end in /par)

however, it still wants to keep rerunning the $submit event each loop after the initial click. Maybe it's my machine?

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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...