Sign in to follow this  
Followers 0
Regency

Doing a math problem with pulling info from web

5 posts in this topic

<input type=hidden value=4 name=1>
<input type=hidden value=5 name=2>
<input type=hidden value=+ name=sym>
4 + 5 = <input type=text name=total value=0><br>
<input type=submit value=Go!>

I dunno how to pull out the value 1, value 2 or even value 3 my script keeps getting a blank answer. I checked it and it cant even read the values with the way i wrote it.

$oVerify = _IEGetObjByName($ie, "total")
If IsObj($oVerify) Then
    ScriptAdd()
EndIf
    
Func ScriptAdd()
    Global $FirstVar = _IEGetObjByName($ie,"1")
    Global $SecondVar = _IEGetObjByName($ie,"2")
    Global $SymbolVar = _IEGetObjByName($ie,"sym")
    
    $FirstVar1 = ConsoleWrite($FirstVar)
    $SecondVar1 = ConsoleWrite($SecondVar)
    $SymbolVar1 = ConsoleWrite($SymbolVar)
    if $SymbolVar1 = "-" Then
        MsgBox('','',$firstvar) ;                         used to see if it even got the first var's
    ElseIf $SymbolVar1 = "x" Then
        MsgBox('','',"Its ")
    Elseif $SymbolVar1 = "+" Then
        MsgBox('','',"Its addition")
    Elseif $SymbolVar1 not = + Then
        MsgBox('','',"its not +")
    Elseif $SymbolVar1 not = "x" Then
        MsgBox('','',"its not x")
    Elseif $SymbolVar1 not = "-" Then
        MsgBox('','',"its not -")
    EndIf
EndFunc

anyone got any ideas?

Share this post


Link to post
Share on other sites



<input type=hidden value=4 name=1>
<input type=hidden value=5 name=2>
<input type=hidden value=+ name=sym>
4 + 5 = <input type=text name=total value=0><br>
<input type=submit value=Go!>

I dunno how to pull out the value 1, value 2 or even value 3 my script keeps getting a blank answer. I checked it and it cant even read the values with the way i wrote it.

$oVerify = _IEGetObjByName($ie, "total")
If IsObj($oVerify) Then
    ScriptAdd()
EndIf
    
Func ScriptAdd()
    Global $FirstVar = _IEGetObjByName($ie,"1")
    Global $SecondVar = _IEGetObjByName($ie,"2")
    Global $SymbolVar = _IEGetObjByName($ie,"sym")
    
    $FirstVar1 = ConsoleWrite($FirstVar)
    $SecondVar1 = ConsoleWrite($SecondVar)
    $SymbolVar1 = ConsoleWrite($SymbolVar)
    if $SymbolVar1 = "-" Then
        MsgBox('','',$firstvar) ;                         used to see if it even got the first var's
    ElseIf $SymbolVar1 = "x" Then
        MsgBox('','',"Its ")
    Elseif $SymbolVar1 = "+" Then
        MsgBox('','',"Its addition")
    Elseif $SymbolVar1 not = + Then
        MsgBox('','',"its not +")
    Elseif $SymbolVar1 not = "x" Then
        MsgBox('','',"its not x")
    Elseif $SymbolVar1 not = "-" Then
        MsgBox('','',"its not -")
    EndIf
EndFunc

anyone got any ideas?

If the tags are inside a Form or Frame then you need a reference to that first, then you can get:

$oForm = _IEFormGetCollection($oIE, 0)
$oVerify = _IEFormElementGetObjByName($oForm, "total")
$sValue = _IEFormElementGetValue($oVerify)

:)


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

Share this post


Link to post
Share on other sites

OK so i fixed the script with your snippits help :) now i got another problem, the button doesnt have a name.

Func ScriptAdd()
    $oForm = _IEFormGetCollection($IE, 0)
    $oVerify = _IEFormElementGetObjByName($oForm, "1")
    $FirstVar = _IEFormElementGetValue($oVerify)
    $oVerify2 = _IEFormElementGetObjByName($oForm, "2")
    $SecondVar = _IEFormElementGetValue($oVerify2)
    $oVerify3 = _IEFormElementGetObjByName($oForm, "sym")
    $SymbolVar = _IEFormElementGetValue($oVerify3)
    $oVerify4 = _IEFormElementGetObjByName($oForm, "")
    $Go = _IEFormElementGetValue($oVerify4)
    
    
    If $SymbolVar = "+" Then
    $Answer1 = $FirstVar + $SecondVar
    $Total = _IEGetObjByName($ie, "total")
    _IEFormElementSetValue($Total, $Answer1)
    $gobtn = _IEGetObjByName($ie, $Go)
    _IEAction($gobtn, "click")
ElseIf $SymbolVar = "-" Then
    $Answer2 = $FirstVar - $SecondVar
    $Total = _IEGetObjByName($ie, "total")
    _IEFormElementSetValue($Total, $Answer2)
    $gobtn = _IEGetObjByName($ie, $Go)
    _IEAction($gobtn, "click")
 ElseIf $SymbolVar = "x" Then
    $Answer3 = $FirstVar * $SecondVar
    $Total = _IEGetObjByName($ie, "total")
    _IEFormElementSetValue($Total, $Answer3)
    $gobtn = _IEGetObjByName($ie, $Go)
    _IEAction($gobtn, "click")
    endif
EndFunc

as stated before this is all i get even with debugbar >_<

<input type=submit value=Go!>

anyone have any idea how to click it?

Share this post


Link to post
Share on other sites

291 Views and 1 reply

serious guys?

Share this post


Link to post
Share on other sites

OK so i fixed the script with your snippits help :) now i got another problem, the button doesnt have a name.

as stated before this is all i get even with debugbar :idiot:

<input type=submit value=Go!>

anyone have any idea how to click it?

Then you may have to get the collection of "input" tags with _IETagNameGetCollection() then a For/Next loop through the collection looking for .value = "Go!"

>_<


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

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  
Followers 0