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.

Moderators: Community Moderators, iMacros Moderators

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:


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.

Extracting and Calculating using VB

by rkrox907 on Mon Mar 27, 2017 8:37 am

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
            vCostAdded = vCostRoundUp + (vCostRoundUp * 0.14) + 10
        End If
        TSPrice = Round_Down(vCostAdded)
        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
        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
        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)
Posts: 1
Joined: Sun Mar 26, 2017 6:15 pm

Return to iMacros for Firefox

Who is online

Users browsing this forum: No registered users and 3 guests