ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


2 posters

    สั่งให้submit ในโปรแกรมทำอย่างไรคับ

    pondzero
    pondzero
    มือใหม่เพิ่งสมัคร
    มือใหม่เพิ่งสมัคร


    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty
    จำนวนข้อความ : 5
    ความนิยม : 0
    เข้าร่วมเมื่อ : 23/11/2010

    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty สั่งให้submit ในโปรแกรมทำอย่างไรคับ

    ตั้งหัวข้อ by pondzero 08/12/10, 09:30 pm

    [You must be registered and logged in to see this image.]

    ถ้าเราจะสั้งให้กดปุ่ม submit ในโปรแกรม เราจะเขียนประมาณไหนหรอคับจะเอามาใส่ใน ปุ่มAcction แล้วก็เช็คว่าเวบที่เราเปิดมีทั้งหมดกี่ลิงค์อะคับ :(

    นี้โค้ชคับ

    #include <GUIConstants.au3>
    #include <IE.au3>
    $GUI = GUICreate("Simple Web Browser", 800, 450)
    $object = ObjCreate("Shell.Explorer.2")
    $object_ctrl = GUICtrlCreateObj($object, 16, 10, 780, 400)
    $url_button = GUICtrlCreateButton("URL", 166, 410, 400, 25, 0)

    $back_button = GUICtrlCreateButton("Back", 16, 410, 50, 25, 0) ; Creats Back GUI
    $forward_button = GUICtrlCreateButton("Forward", 66, 410, 50, 25, 0) ; Creates Forward GUI
    $action_button = GUICtrlCreateButton("Action", 116, 410, 50, 25, 0) ; Creates Refresh GUI
    $progressbar1 = GUICtrlCreateProgress ( 570, 415, 200, 20, 0) ; Creates Progress bar
    _IENavigate($object, "[You must be registered and logged in to see this link.]
    $oweb = _IENavigate($object, "[You must be registered and logged in to see this link.]
    GUISetState()

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $url_button
    $URL = Inputbox("Web Browser", "Enter the URL you want to visit.")
    _IENavigate($Object, $URL)
    Set_progress() ; Function
    Case $msg = $back_button ; Send browser to previous page
    $Object.GoBack
    Set_progress() ; Function
    Case $msg = $forward_button ; Send browser forward
    $Object.GoForward
    Set_progress() ; Function
    Case $msg = $action_button ; Action
    my_action()
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    WEnd

    Func Set_progress() ; Creates Progress bar
    For $pg = 0 To 100 Step 5
    GUICtrlSetData($progressbar1, $pg)
    Sleep(2)
    Next
    EndFunc

    Func my_action()

    EndFunc
    POS
    POS
    PSsix
    PSsix


    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty
    จำนวนข้อความ : 1152
    ความนิยม : 326
    เข้าร่วมเมื่อ : 19/07/2010

    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty Re: สั่งให้submit ในโปรแกรมทำอย่างไรคับ

    ตั้งหัวข้อ by POS 09/12/10, 07:20 am

    ผมไม่เข้าใจคำถาม จะสั่งคลิก หรือเช็คดูลิงก์กันแน่

    ถ้าจะเอาแค่ลิงก์ในเว็บมีกี่ลิงก์ก็ใช้คำสั่งตามตัวอย่างด้านล่างนี้



    Code:
    #include <IE.au3>
    #include <IE.au3>
    $oIE = _IECreate("[You must be registered and logged in to see this link.]
    $oLinks = _IELinkGetCollection ($oIE)
    $iNumLinks = @extended

    MsgBox(0, "เจอลิงก์", $iNumLinks & " ลิงก์")

    For $oLink In $oLinks
        MsgBox(0, "ลิงก์ที่จะคลิกคือ"  , $oLink.href)
    _IEAction ( $oLink, "click");สั่งคลิกลิงก์ที่แสดงด้านบน
    exit
        Next

    pondzero
    pondzero
    มือใหม่เพิ่งสมัคร
    มือใหม่เพิ่งสมัคร


    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty
    จำนวนข้อความ : 5
    ความนิยม : 0
    เข้าร่วมเมื่อ : 23/11/2010

    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty Re: สั่งให้submit ในโปรแกรมทำอย่างไรคับ

    ตั้งหัวข้อ by pondzero 09/12/10, 12:27 pm

    POS พิมพ์ว่า:ผมไม่เข้าใจคำถาม จะสั่งคลิก หรือเช็คดูลิงก์กันแน่

    ถ้าจะเอาแค่ลิงก์ในเว็บมีกี่ลิงก์ก็ใช้คำสั่งตามตัวอย่างด้านล่างนี้



    Code:
    #include <IE.au3>
    #include <IE.au3>
    $oIE = _IECreate("[You must be registered and logged in to see this link.]
    $oLinks = _IELinkGetCollection ($oIE)
    $iNumLinks = @extended

    MsgBox(0, "เจอลิงก์", $iNumLinks & " ลิงก์")

    For $oLink In $oLinks
        MsgBox(0, "ลิงก์ที่จะคลิกคือ"  , $oLink.href)
    _IEAction ( $oLink, "click");สั่งคลิกลิงก์ที่แสดงด้านบน
    exit
        Next


    คือว่าอยากให้ทำงานที่โปรแกรม Browser ที่เขียนอ่ะคับ ไม่ใช่ทำงานบน IE แบบว่ากดปุ่ม Action บนตัวโปรแกรม แล้วโปรแกรมก็จะทำงานโดย คลิกที่ปุ่ม "ค้นหาด้วย google"
    แล้วในหน้าต่างโปรแกรมก็จะเปลี่ยนเป็นอีกหน้า คือประเดนอยากให้ทำงานบนโปรแกรมที่เขียนอ่ะคับ ไม่ใช่ทำงานบน IE
    POS
    POS
    PSsix
    PSsix


    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty
    จำนวนข้อความ : 1152
    ความนิยม : 326
    เข้าร่วมเมื่อ : 19/07/2010

    สั่งให้submit ในโปรแกรมทำอย่างไรคับ Empty Re: สั่งให้submit ในโปรแกรมทำอย่างไรคับ

    ตั้งหัวข้อ by POS 09/12/10, 07:12 pm

    คุณเข้าใจผิดแล้ว ถึงไม่ได้เปิด IE แต่ตัวโปรแกรมนี่ก็ดึงเอา shell ของ IE มาใช้ ดังนั้นคำสั่งต่างๆ ใน IE ของ AutoIt จึงนำมาใช้ได้(ต้องนำมาใช้ถึงควบคุมได้)ลองแก้ไขคำสั่งตามตัวอย่างนี้

    ปล. ถ้าไม่เข้าใจอะไรอย่าเพิ่งข้ามไปทำเป็นโปรแกรมอย่างนี้ครับ ทำแบบเรียก IE ธรรมดาก่อนแล้วค่อยลองใช้คำสั่งจนได้ตามที่ต้องการก่อน แล้วค่อยเอาคำสั่งที่ได้ไปใส่ที่ตัวโปรแกรมทีหลัง

    Code:
    #include <GUIConstants.au3>
    #include <IE.au3>


    $GUI = GUICreate("Simple Web Browser", 800, 450)
    $object = ObjCreate("Shell.Explorer.2")
    $object_ctrl = GUICtrlCreateObj($object, 16, 10, 780, 400)
    $url_button = GUICtrlCreateButton("URL", 166, 410, 400, 25, 0)

    $back_button = GUICtrlCreateButton("Back", 16, 410, 50, 25, 0) ; Creats Back GUI
    $forward_button = GUICtrlCreateButton("Forward", 66, 410, 50, 25, 0) ; Creates Forward GUI
    $action_button = GUICtrlCreateButton("Action", 116, 410, 50, 25, 0) ; Creates Refresh GUI
    $progressbar1 = GUICtrlCreateProgress ( 570, 415, 200, 20, 0) ; Creates Progress bar
    ;~ _IENavigate($object, "[You must be registered and logged in to see this link.]
    $oweb = _IENavigate($object, "[You must be registered and logged in to see this link.]
    GUISetState()

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $url_button
    $URL = Inputbox("Web Browser", "Enter the URL you want to visit.")
    _IENavigate($Object, $URL)
    Set_progress() ; Function
    Case $msg = $back_button ; Send browser to previous page
    $Object.GoBack
    Set_progress() ; Function
    Case $msg = $forward_button ; Send browser forward
    $Object.GoForward
    Set_progress() ; Function
    Case $msg = $action_button ; Action
    my_action()
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    WEnd

    Func Set_progress() ; Creates Progress bar
    For $pg = 0 To 100 Step 5
    GUICtrlSetData($progressbar1, $pg)
    Sleep(2)
    Next
    EndFunc

    Func my_action()
    $oForm = _IEFormGetObjByName ($object, "f")
     _IEFormSubmit ($oForm)
    EndFunc
     

      เวลาขณะนี้ 28/03/24, 05:25 pm