Extracting and Calculating using VB

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.
Post Reply
rkrox907
Posts: 1
Joined: Mon Mar 27, 2017 1:15 am

Extracting and Calculating using VB

Post by rkrox907 » Mon Mar 27, 2017 3:37 pm

The macro that i build take a value from 'position #1' and pasting the same value in 'position #2'

How can i have imacro take the value from 'position #1' then performing some calculation using this VB code

Code: Select all

 Function TSPrice(Cost As String) As Integer
    Dim vCost As Double
    Dim vCostRoundUp As Double
    Dim vCostAdded As Double
    If IsNumeric(Cost) Then
        vCost = val(Cost)
        vCostRoundUp = Round_Up(vCost)
        If vCostRoundUp > 1000 Then
            vCostAdded = vCostRoundUp + (vCostRoundUp * 0.12) + 20
        Else
            vCostAdded = vCostRoundUp + (vCostRoundUp * 0.14) + 10
        End If
        TSPrice = Round_Down(vCostAdded)
    Else
        MsgBox ("Cost Must Be Numeric")
    End If
End Function

Function Round_Up(ByVal d As Double) As Integer
    Dim result As Integer
    result = Math.Round(d)
    If result >= d Then
        Round_Up = result
    Else
        Round_Up = result + 1
    End If
End Function


Function Round_Down(ByVal d As Double) As Integer
    Dim result As Integer
    result = Math.Round(d)
    If result >= d Then
        Round_Down = result - 1
    Else
        Round_Down = result
    End If
then pasting the new value (that just came from VB)into 'position #2'

Any help will be appreciated

i'm using iMacros for Firefox 9.0.3
Windows 10 PRO
Firefox 52.0.1 (32-bit)
Post Reply