Jump to content
Sign in to follow this  
nowayhome2

Help with variable in GET command

Recommended Posts

nowayhome2

#include <WindowsConstants.au3>



GUICreate("Please Input Question", 260, 50, 193, 125, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$i = GUICtrlCreateInput("Enter Question Here", 16, 8, 185, 21)
$b = GUICtrlCreateButton("OK", 216, 16, 33, 25, 0)
GUISetState(@SW_SHOW)

$s_URL = "http://nick761.mango12.com/oodles/api.php?clue=" & $i

while 1

If GUIGetMsg() = $b Then
    $WinHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")
    $WinHttpReq.Open("GET", $s_URL ,false)
    $WinHttpReq.Send()
    $c = $WinHttpReq.ResponseText
    MsgBox(1,"Answer", $c)
endif
wend

i want it to add the question at the end of the line for example the user types in "what is my name" it would send

http://nick761.mango12.com/oodles/api.php?clue=what is my name

but it does not all it it sends is

http://nick761.mango12.com/oodles/api.php?clue=

and returns with the answer

japan which is the default answer if you just type in

http://nick761.mango12.com/oodles/api.php?clue=
Edited by nowayhome2

Share this post


Link to post
Share on other sites
Malkey

#include <WindowsConstants.au3>



GUICreate("Please Input Question", 260, 50, 193, 125, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$i = GUICtrlCreateInput("Enter Question Here", 16, 8, 185, 21)
$b = GUICtrlCreateButton("OK", 216, 16, 33, 25, 0)
GUISetState(@SW_SHOW)

$s_URL = "http://nick761.mango12.com/oodles/api.php?clue=" & $i

while 1

If GUIGetMsg() = $b Then
    $WinHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")
    $WinHttpReq.Open("GET", $s_URL ,false)
    $WinHttpReq.Send()
    $c = $WinHttpReq.ResponseText
    MsgBox(1,"Answer", $c)
endif
wend

i want it to add the question at the end of the line for example the user types in "what is my name" it would send

http://nick761.mango12.com/oodles/api.php?clue=what is my name

but it does not all it it sends is

http://nick761.mango12.com/oodles/api.php?clue=

and returns with the answer

japan which is the default answer if you just type in

http://nick761.mango12.com/oodles/api.php?clue=

You were sending the controlid of the input control, and not the data from within the input control.

(See GUICtrlCreateInput in help file, or, double click on GUICtrlCreateInput in autoit script box below.)

;
#include <WindowsConstants.au3>

GUICreate("Please Input Question", 260, 50, 193, 125, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))

$i = GUICtrlCreateInput("Enter Question Here", 16, 8, 185, 21)
$b = GUICtrlCreateButton("OK", 216, 16, 33, 25, 0)

GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg() = $b Then
        $WinHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")
        $s_URL = "http://nick761.mango12.com/oodles/api.php?clue=" & GUICtrlRead($i)
        $WinHttpReq.Open("GET", $s_URL, False)
        $WinHttpReq.Send()
        $c = $WinHttpReq.ResponseText
        MsgBox(1, "Answer", $c)
    EndIf
WEnd
;

Edit: Make that single click on GUICtrlCreateInput in script.

Edited by Malkey

Share this post


Link to post
Share on other sites
nowayhome2

You were sending the controlid of the input control, and not the data from within the input control.

(See GUICtrlCreateInput in help file, or, double click on GUICtrlCreateInput in autoit script box below.)

;
#include <WindowsConstants.au3>

GUICreate("Please Input Question", 260, 50, 193, 125, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))

$i = GUICtrlCreateInput("Enter Question Here", 16, 8, 185, 21)
$b = GUICtrlCreateButton("OK", 216, 16, 33, 25, 0)

GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg() = $b Then
        $WinHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")
        $s_URL = "http://nick761.mango12.com/oodles/api.php?clue=" & GUICtrlRead($i)
        $WinHttpReq.Open("GET", $s_URL, False)
        $WinHttpReq.Send()
        $c = $WinHttpReq.ResponseText
        MsgBox(1, "Answer", $c)
    EndIf
WEnd
;

Edit: Make that single click on GUICtrlCreateInput in script.

thank you so much >_< that did the trick and i see what i did wrong now :( thanks for helping me out

Share this post


Link to post
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
Sign in to follow this  

×