I have VB Code and MACRO Looper
Will this work? How to I send the value of phone to a screen field .. like the send>%phone% ???
VBSTART
set ShipDB = CreateObject("ADODB.Connection")
On Error Resume Next
ShipDB.Open "maketickets"
SQLString = "select * from FLINLAND"
set rsPickList = ShipDB.Execute(SQLString)
rsPickList.MoveFirst
Function GetNextRecord
If Not rsPickList.EOF then
clearing = rsPickList.Fields("Clearing#")
phone = rsPickList.Fields("tel#")
office = rsPickList.Fields("office")
msgBox phone
rsPicklist.movenext
else
GetNextRecord = 0
end if
end Function
VBEND
Label>looper
VBEval>GetNextRecord,phone,clearing,office
Message>phone
Message>clearing
Message>office
goto>looper
passing variables from VB to MACRO Language
Moderators: JRL, Dorian (MJT support)
-
- Newbie
- Posts: 9
- Joined: Tue Aug 09, 2005 3:39 pm
passing variables from VB to MACRO Language
Pinkpanther
One way to do it: Have your VBScript function set global VBScript variables. Run the function and then use VBEval to transfer the variables to MacroScript variables:
VBSTART
set ShipDB = CreateObject("ADODB.Connection")
On Error Resume Next
ShipDB.Open "maketickets"
SQLString = "select * from FLINLAND"
set rsPickList = ShipDB.Execute(SQLString)
rsPickList.MoveFirst
Dim clearing
Dim phone
Dim office
Function GetNextRecord
If Not rsPickList.EOF then
clearing = rsPickList.Fields("Clearing#")
phone = rsPickList.Fields("tel#")
office = rsPickList.Fields("office")
msgBox phone
rsPicklist.movenext
else
GetNextRecord = 0
end if
end Function
VBEND
Label>looper
VBEval>GetNextRecord,result
if>result=0,exit
VBEVal>phone,my_phone
VBEval>clearing,my_clearing
VBEval>office,my_office
MessageModal>my_phone
MessageModal>my_clearing
MessageModal>my_office
goto>looper
Label>exit
Another way is to have the VBScript function return a delimited list of strings and separate them afterwards:
VBSTART
set ShipDB = CreateObject("ADODB.Connection")
On Error Resume Next
ShipDB.Open "maketickets"
SQLString = "select * from FLINLAND"
set rsPickList = ShipDB.Execute(SQLString)
rsPickList.MoveFirst
Function GetNextRecord
If Not rsPickList.EOF then
clearing = rsPickList.Fields("Clearing#")
phone = rsPickList.Fields("tel#")
office = rsPickList.Fields("office")
msgBox phone
GetNextRecord = clearing & ";" & phone & ";" & office
rsPicklist.movenext
else
GetNextRecord = 0
end if
end Function
VBEND
Label>looper
VBEval>GetNextRecord,returnedstring
If>returnedstring=0,exit
Separate>returnedstring,;,fields
MessageModal>fields_1
MessageModal>fields_2
MessageModal>fields_3
goto>looper
Label>exit
I've also added the code necessary to avoid your MacroScript loop looping forever.
VBSTART
set ShipDB = CreateObject("ADODB.Connection")
On Error Resume Next
ShipDB.Open "maketickets"
SQLString = "select * from FLINLAND"
set rsPickList = ShipDB.Execute(SQLString)
rsPickList.MoveFirst
Dim clearing
Dim phone
Dim office
Function GetNextRecord
If Not rsPickList.EOF then
clearing = rsPickList.Fields("Clearing#")
phone = rsPickList.Fields("tel#")
office = rsPickList.Fields("office")
msgBox phone
rsPicklist.movenext
else
GetNextRecord = 0
end if
end Function
VBEND
Label>looper
VBEval>GetNextRecord,result
if>result=0,exit
VBEVal>phone,my_phone
VBEval>clearing,my_clearing
VBEval>office,my_office
MessageModal>my_phone
MessageModal>my_clearing
MessageModal>my_office
goto>looper
Label>exit
Another way is to have the VBScript function return a delimited list of strings and separate them afterwards:
VBSTART
set ShipDB = CreateObject("ADODB.Connection")
On Error Resume Next
ShipDB.Open "maketickets"
SQLString = "select * from FLINLAND"
set rsPickList = ShipDB.Execute(SQLString)
rsPickList.MoveFirst
Function GetNextRecord
If Not rsPickList.EOF then
clearing = rsPickList.Fields("Clearing#")
phone = rsPickList.Fields("tel#")
office = rsPickList.Fields("office")
msgBox phone
GetNextRecord = clearing & ";" & phone & ";" & office
rsPicklist.movenext
else
GetNextRecord = 0
end if
end Function
VBEND
Label>looper
VBEval>GetNextRecord,returnedstring
If>returnedstring=0,exit
Separate>returnedstring,;,fields
MessageModal>fields_1
MessageModal>fields_2
MessageModal>fields_3
goto>looper
Label>exit
I've also added the code necessary to avoid your MacroScript loop looping forever.
MJT Net Support
[email protected]
[email protected]
-
- Newbie
- Posts: 9
- Joined: Tue Aug 09, 2005 3:39 pm
almost :) so far...
Ok, I think I am getting it. What is the actual syntax to then send it to the screen program? The recorder shows this and I want where it shows Send>M to really Send>valueofphone .....from the loop
Is it just send>phone or send>%phone%
Wait>0.94
MouseMove>217,338
Wait>1.87
LClick
Wait>2.26
Send>m
Wait>2.63
MouseMove>423,368
Wait>2.41
LClick
Is it just send>phone or send>%phone%
Wait>0.94
MouseMove>217,338
Wait>1.87
LClick
Wait>2.26
Send>m
Wait>2.63
MouseMove>423,368
Wait>2.41
LClick
Pinkpanther
-
- Newbie
- Posts: 9
- Joined: Tue Aug 09, 2005 3:39 pm
messagemodal
This is what I have so far..but nothing is prompting on the screen.. I want to see the values of phone, office and clearing as it loops but I can't tell. Is that what Messagemodule does? is there a printscreen or debug.print?
VBSTART
set ShipDB = CreateObject("ADODB.Connection")
On Error Resume Next
ShipDB.Open "maketickets"
SQLString = "select * from FLINLAND"
set rsPickList = ShipDB.Execute(SQLString)
rsPickList.MoveFirst
Function GetData
If Not rsPickList.EOF then
phone = rsPickList.Fields("tel#")
clearing = rsPickList.Fields("clearing#")
office = rsPickList.Fields("office")
else
GetNextRecord = 0
end if
rsPickList.movenext
end function
VBEND
Label>looper
VBEval>GetData,result
if>result=0,exit
VBEVal>phone,my_phone
VBEval>clearing,my_clearing
VBEval>office,my_office
MessageModal>my_phone
MessageModal>my_clearing
MessageModal>my_office
goto>looper
label>exit
VBSTART
set ShipDB = CreateObject("ADODB.Connection")
On Error Resume Next
ShipDB.Open "maketickets"
SQLString = "select * from FLINLAND"
set rsPickList = ShipDB.Execute(SQLString)
rsPickList.MoveFirst
Function GetData
If Not rsPickList.EOF then
phone = rsPickList.Fields("tel#")
clearing = rsPickList.Fields("clearing#")
office = rsPickList.Fields("office")
else
GetNextRecord = 0
end if
rsPickList.movenext
end function
VBEND
Label>looper
VBEval>GetData,result
if>result=0,exit
VBEVal>phone,my_phone
VBEval>clearing,my_clearing
VBEval>office,my_office
MessageModal>my_phone
MessageModal>my_clearing
MessageModal>my_office
goto>looper
label>exit
Pinkpanther