Jump to content

Sending Text


Recommended Posts

Im trying to send a variable to a javascript input field. The problem is im having to use a mouseclick to make the field active, so my code mouseclicks to the field and then i use Send ($PolicyNumber).

The problem im having is the send command stops after it sends the 1st character.

Here is the bit of code for this.

MouseClick ( "left", 443,268, 1 )

Sleep ( 100 )

Send ($PolicyNumber)

Anyone see anything wrong with this or have another idea for sending the variable?

Link to comment
Share on other sites

  • Moderators

Im trying to send a variable to a javascript input field. The problem is im having to use a mouseclick to make the field active, so my code mouseclicks to the field and then i use Send ($PolicyNumber).

The problem im having is the send command stops after it sends the 1st character.

Here is the bit of code for this.

MouseClick ( "left", 443,268, 1 )

Sleep ( 100 )

Send ($PolicyNumber)

Anyone see anything wrong with this or have another idea for sending the variable?

I'm guessing this is on a webpage? If you could provide a link that might help us help you. Edited by big_daddy
Link to comment
Share on other sites

...The problem im having is the send command stops after it sends the 1st character.

It is more likely that your script is either not sending what you think it is sending or the app is not accepting input as quick as the script can send it (like a javascript input field that performs a lookup after each character is entered...)

Try this debug code:

MsgBox(0, "", $PolicyNumber)
;makes sure what you are sending

MouseClick("left", 443, 268, 1)
Sleep(100)

AutoItSetOption("SendKeyDelay", 300)
Send($PolicyNumber)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

as far as a link goes, i cant post one here, i could post the source code. its a company website related to my business with password protection.

It is a javascript input field, if i just goto the site and type it in there is no delay so as far as looking up after each char im not sure.

as var as the variable goes i know that my variable is sending the right data i have tested with msgbox.

i tried the sendkeydelay with no success.

<script LANGUAGE="VBScript" FOR="keyPanel" EVENT="ReadyStateChange(nReadyState)">
        if keyPanel.ReadyState = 4 then
            'Display ActiveX Control
            keyPanel.style.height = "200"
            document.getElementById("ActiveXLoadMsg").style.display = "none"
            
            keyPanel.AllowKeywordDuplication = true
            keyPanel.ShowRelations = True
            keyPanel.ShowOperators = True
            keyPanel.KeywordTypes = "<ElementCollection><Element NAME=""KeywordType""><PROPERTY DATATYPE=""Long"" NAME=""DataLength"">10</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""DataType"">2</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""distributionType"">0</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Hidden"">false</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""ID"">103</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""InformationOnly"">false</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Mask""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""MustExist"">true</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Name"">Policy Number</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""rawKeyTypeFlags"">81920</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Static""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""UseDataSet"">false</PROPERTY></Element><Element NAME=""KeywordType""><PROPERTY DATATYPE=""Long"" NAME=""DataLength"">51</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""DataType"">2</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""distributionType"">0</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Hidden"">false</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""ID"">113</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""InformationOnly"">false</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Mask""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""MustExist"">true</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Name"">Insured Name</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""rawKeyTypeFlags"">65536</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Static""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""UseDataSet"">false</PROPERTY></Element><Element NAME=""KeywordType""><PROPERTY DATATYPE=""Long"" NAME=""DataLength"">0</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""DataType"">4</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""distributionType"">0</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Hidden"">false</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""ID"">112</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""InformationOnly"">false</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Mask""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""MustExist"">true</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Name"">Effective Date</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""rawKeyTypeFlags"">65536</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Static""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""UseDataSet"">false</PROPERTY></Element><Element NAME=""KeywordType""><PROPERTY DATATYPE=""Long"" NAME=""DataLength"">5</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""DataType"">2</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""distributionType"">0</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Hidden"">false</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""ID"">115</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""InformationOnly"">false</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Mask""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""MustExist"">true</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Name"">Agent Number</PROPERTY><PROPERTY DATATYPE=""Long"" NAME=""rawKeyTypeFlags"">65536</PROPERTY><PROPERTY DATATYPE=""String"" NAME=""Static""></PROPERTY><PROPERTY DATATYPE=""String"" NAME=""UseDataSet"">false</PROPERTY></Element></ElementCollection>"
            keyPanel.ShowKeywordDropDown = False
            keyPanel.ElementQueryURL = "website"
        end if
        
    </SCRIPT>

<script LANGUAGE="VBScript">

        Sub formSubmit()
            
                dim keywordIDList
                keywordIDList = ""
                    
                dim keywordValueList
                keywordValueList = ""
                
                dim keywordOpList
                keywordOpList = ""
                
                dim keywordConnList
                keywordConnList = ""
        
                Dim keywordCount
                keywordCount = 0
                
                
                keywordCount = keyPanel.GetQueryKeywordCount()
                
                
                if keywordCount = 0 and document.frmCustomQuery.customQueryType.value = 3 then
                    MsgBox("This query is a keyword custom query.  One keyword must be entered in order to execute the query!")
                else
                    If False = true Then
                        'Check to see if any constraints have been applied.
                        If keywordCount = 0 Then
                            Dim dateFrom
                            Dim dateTo
                            Dim dateStock
                            
                            If Not frmCustomQuery.item("TEXT1DateFrom") Is Nothing Then
                                dateFrom = frmCustomQuery.TEXT1DateFrom.value
                            End If
                            
                            If Not frmCustomQuery.item("TEXT1Date") Is Nothing Then
                                dateStock = frmCustomQuery.TEXT1Date.value
                            End If
                            
                            If Not frmCustomQuery.item("TEXT1DateTo") Is Nothing Then
                                dateTo = frmCustomQuery.TEXT1DateTo.value
                            End If
                            
                            If dateFrom = "" AND dateTo = "" AND dateStock = "" Then
                                Dim ret
                                ret = MsgBox( "You are about to execute an unconstrained query.  Are you sure you want to continue?", 36, "Query Prompt" )
                                If ret <> 6 Then    '   vbYes
                                    Exit Sub
                                End If
                            End If
                        End If
                    End If
        
                    
                    for i = 0 to keywordCount - 1
                        dim keyword
                        set keyword = keyPanel.GetQueryKeywordAt(i)
                            
                        keywordIDList = keywordIDList & keyword.ID & "|"
                        keywordValueList = keywordValueList & keyword.value & "|"
                        keywordOpList = keywordOpList & keyword.OperatorString & "|"
                        keywordConnList = keywordConnList & keyword.RelationString & "|"
                    next
                    
                    
                    document.frmCustomQuery.keywordIDList.value = keywordIDList
                    document.frmCustomQuery.keywordValueList.value = keywordValueList
                    document.frmCustomQuery.keywordOpList.value = keywordOpList
                    document.frmCustomQuery.keywordConnList.value = keywordConnList
            
                    document.frmCustomQuery.target = "bottom"
                    document.frmCustomQuery.action = "./retrieval/HitList.asp" 
                    validateDate()

                end if
            End Sub

</SCRIPT>
Link to comment
Share on other sites

i just tried this also

MouseClick ( "left", 443,268, 1 )
        Sleep ( 100 )
        ClipPut ($PolicyNumber)
        Send ("^v")

it does the same thing, just send the first char.

but if i do ctrl + V on the website without script itll paste it.

so i dunno what the deal is

Link to comment
Share on other sites

ok another update :0, i tried msgbox again, now its only returning 1 char in the msgbox debug so i guess there is something wrong with my input field.

$PolicyNumber = GUICtrlCreateInput("Insert Policy Number Here", 8, 108, 145, 21, -1, $WS_EX_CLIENTEDGE)
Link to comment
Share on other sites

  • Moderators

ok another update :0, i tried msgbox again, now its only returning 1 char in the msgbox debug so i guess there is something wrong with my input field.

$PolicyNumber = GUICtrlCreateInput("Insert Policy Number Here", 8, 108, 145, 21, -1, $WS_EX_CLIENTEDGE)
Try using:

Send(GUICtrlRead ($PolicyNumber))

You were trying to send the control id of the input.

Edited by big_daddy
Link to comment
Share on other sites

thanks for the help that worked like a charm.

funny thing is with the following code

Send(GUICtrlRead ($PolicyNumber))

MsgBox(0, "", $PolicyNumber)

it puts the right number on the website but the msg box only shows 1 char :). oh well just as long as the inserting on the website works, thanks alot

1 more quesion.

Does the

Opt("MouseCoordMode", 0)

option fix the mouseclick to no matter what size someone has there window it would still click the same spot?

i need my script to click on the same spot on this website no matter what a person has there resolution set to or if they have there window maximized or not.

Link to comment
Share on other sites

  • Moderators

thanks for the help that worked like a charm.

funny thing is with the following code

Send(GUICtrlRead ($PolicyNumber))

MsgBox(0, "", $PolicyNumber)

it puts the right number on the website but the msg box only shows 1 char :). oh well just as long as the inserting on the website works, thanks alot

Thats because your still using just $PolicyNumber in the MsgBox

Try:

MsgBox(0, "", GUICtrlRead ($PolicyNumber))

1 more quesion.

Does the

Opt("MouseCoordMode", 0)

option fix the mouseclick to no matter what size someone has there window it would still click the same spot?

i need my script to click on the same spot on this website no matter what a person has there resolution set to or if they have there window maximized or not.

You also need to keep in mind that the person may not have as many or more toolbars in thier browser. You might want to look at tabbing to the input. Edited by big_daddy
Link to comment
Share on other sites

yes i tried tabbing, for some reason when i tab to it, it just highlights the whole Frameset , it wont tab in the frame? any ideas on the would be great. i really dislike the mouseclick command.

ive been at a loss, but if i could find a way for mouseclick to work no matter what type of screen someone uses i would prob be happy.

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