Jump to content

Function Not Sending My $Firstline


Recommended Posts

Hello Gentleman,

I have a little problem. A buddy of mine just helped me out with a line of code that halfway works. Here it is.....GUICtrlSetData($Edit1,StringTrimLeft(GUICtrlRead($Edit1),StringInStr(GUICtrlRead($Edit1),@CRLF)+1)) located below in Func _Button2_Pressed. To those of you who are advanced, you'll see that I'm placing keywords in a edit box and calling(extracting) on them to be placed when I send them via $Firstline. I'm placing keywords in the editbox like so........

keyword 1

keyword 2

keyword 3

keyword 4

and so on.......

when the script encounters GUICtrlSetData($Edit1,StringTrimLeft(GUICtrlRead($Edit1),StringInStr(GUICtrlRead($Edit1),@CRLF)+1)). Its been programmed to delete keyword 1(aka $Firstline) and move the other keywords up 1 position. So keyword 2 becomes keywords 1, keyword 3 turns into 2 and so on. The latter works fine, its the sending of the next keyword that I'm having problems with. Keyword 1 gets deleted and keyword 2 moves up, when this rolls around ControlSend("Step 1 - Keyword Selection", "", "ThunderRT6TextBox1",$FirstLine). It still sends the keyword that was deleted. Could someone help me?

Func step_5()
sleep(5000)
ControlFocus("HyperVRE", "", "Button1");this is where the mouse over the Msgbox for 0 or 1 selected keywords.
ControlSend("HyperVRE", "", "Button1","{ENTER}")
sleep(5000)
MouseMove(741,17)
MouseDown("left")
MouseUp("left")
sleep(5000)
MouseMove(160,102)
MouseDown("left")
MouseUp("left")
sleep(3000)
GUICtrlSetData($Edit1,StringTrimLeft(GUICtrlRead($Edit1),StringInStr(GUICtrlRead($Edit1),@CRLF)+1))
sleep(3000)
_Button2_Pressed() 
EndFunc

Here is Func _Button2_Pressed()

Func _Button2_Pressed
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
;shellexecute("D:\Objects To Burn\Documents\Document 2.txt");Right here instead going, I need a function to
;select(copy) the first keyword in the $List2.
shellexecute("D:\Program Files\HyperVRE\HyperVRE.exe")
sleep(30000)
ControlFocus("HyperVRE - Convert your content into cash", "", "ThunderRT6UserControlDC1")
ControlSend("HyperVRE - Convert your content into cash", "", "ThunderRT6UserControlDC1","{ENTER}")
sleep(5000)
ControlFocus("Step 1 - Keyword Selection", "", "ThunderRT6TextBox1" )
sleep(9000)
ControlSend("Step 1 - Keyword Selection", "", "ThunderRT6TextBox1",$FirstLine)
sleep(3000)
ControlFocus ("Step 1 - Keyword Selection", "", "ThunderRT6UserControlDC2" );This is the "Suggest Keywords"
ControlSend("Step 1 - Keyword Selection", "", "ThunderRT6UserControlDC2","{ENTER}")
sleep(3000)
ControlFocus("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC2" );This is were the mouse moves over the 'get keywords' button.
ControlSend("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC2","{ENTER}")
sleep(20000)
MouseMove(40,234);This is where the cursor moves over the first checkbox for the first keyword.
MouseDown("left")
MouseUp("left")
;Func dont_call()
;MouseMove(37,251)
;MouseDown("left")
;MouseUp("left")
;MouseMove(32,269)
;MouseDown("left")
;MouseUp("left")
;MouseMove(36,289)
;MouseDown("left")
;MouseUp("left")
;MouseMove(33,307)
;MouseDown("left")
;MouseUp("left")
;MouseMove(35,326)
;MouseDown("left")
;MouseUp("left")
;MouseMove(36,343)
;MouseDown("left")
;MouseUp("left")
;MouseMove(35,359)
;MouseDown("left")
;MouseUp("left")
;MouseMove(36,378)
;MouseDown("left")
;MouseUp("left")
;MouseMove(33,394)
;MouseDown("left")
;MouseUp("left")
;MouseMove(40,413)
;MouseDown("left")
;MouseUp("left")
;MouseMove(35,432)
;MouseDown("left")
;MouseUp("left")
;MouseMove(35,453)
;MouseDown("left")
;MouseUp("left")
;MouseMove(39,468)
;MouseDown("left")
;MouseUp("left")
;MouseMove(38,480)
;MouseDown("left")
;MouseUp("left")
;Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}")
;MouseMove(33,253)
;MouseDown("left")
;MouseUp("left")
;MouseMove(34,273)
;MouseDown("left")
;MouseUp("left")
;MouseMove(37,291)
;MouseDown("left")
;MouseUp("left")
;MouseMove(35,305)
;MouseDown("left")
;MouseUp("left")
;MouseMove(35,323)
;MouseDown("left")
;MouseUp("left")
;EndFunc
sleep(5000)
ControlFocus("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC6" );This is were the mouse moves over the add to master list button.
ControlSend("Keyword Suggestion Tool", "", "ThunderRT6UserControlDC6","{ENTER}")
;MouseMove(611,342)
;MouseDown("left")
;MouseUp("left")
;Opt("WinTextMatchMode", 1) ;1=complete, 2=quick
;Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
While 1

    If WinExists("HyperVRE", "20 Selected keywords")or WinExists("HyperVRE", "10 Selected keywords") Or WinExists("HyperVRE", "9 Selected keywords") Or WinExists("HyperVRE", "8 Selected keywords") Or WinExists("HyperVRE", "7 Selected keywords") Or WinExists("HyperVRE", "6 Selected keywords") Or WinExists("HyperVRE", "5 Selected keywords") Or WinExists("HyperVRE", "4 Selected keywords") Or WinExists("HyperVRE", "3 Selected keywords") Or WinExists("HyperVRE", "2 Selected keywords") Then
        script_2()
    EndIf

    If WinExists("HyperVRE", "0 Selected keywords") Or WinExists("HyperVRE", "1 Selected keywords") or WinExists("HyperVRE", "91 - Object variable ") or WinExists("HyperVRE","424 - Object require") Or WinExists("HyperVRE","92 - For loop not in")  Then
        script_1b()
    EndIf

    If WinExists("HyperVRE", "Run-time error") Then
        script_1c()
    EndIf
WEnd
 EndFunc
Link to comment
Share on other sites

So, where in there are you setting $FirstLine to anything at all? Removing the mounds of irrelevant stuff leaves this working fine:

#include <GuiConstantsEx.au3>

Opt("GuiOnEventMode", 1)

Global $hGUI = GUICreate("Test", 300, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
Global $Edit1 = GUICtrlCreateEdit("", 20, 20, 260, 210)
GUICtrlSetData($Edit1, "keyword 1" & @CRLF & _
        "keyword 2" & @CRLF & _
        "keyword 3" & @CRLF & _
        "keyword 4" & @CRLF & _
        "and so on......." & @CRLF)
Global $Button_2 = GUICtrlCreateButton("GO", 100, 250, 100, 30)
GUICtrlSetOnEvent($Button_2, "step_5")
GUISetState()

While 1
    Sleep(10)
WEnd

Func step_5()
    GUICtrlSetData($Edit1, StringTrimLeft(GUICtrlRead($Edit1), StringInStr(GUICtrlRead($Edit1), @CRLF) + 1))
    _Button2_Pressed()
EndFunc   ;==>step_5

Func _Button2_Pressed()
    Local $FirstLine = StringLeft(GUICtrlRead($Edit1), StringInStr(GUICtrlRead($Edit1), @CRLF) - 1)
    MsgBox(64, "Simulation", "Sending:  " & $FirstLine, 3)
EndFunc   ;==>_Button2_Pressed

Func _Quit()
    Exit
EndFunc   ;==>_Quit

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...