MarcoCastro Posted May 28, 2007 Share Posted May 28, 2007 Can help me with this code, was create in VB....... and i need the same in autoit. The scrip run in as400, and autoit is faster than change of screen. Please help. expandcollapse popupSub Macro3() ' ' Generated by the Reflection Macro Recorder on 05-25-2007 16:14:11.42 ' Generated by WRQ Reflection for IBM for Windows 12.0.185 ' With Session Dim i As Integer For i = 1 To 100 .WaitForEvent rcEnterPos, "30", "0", 10, 4 .WaitForDisplayString "?", "30", 10, 2 .TransmitTerminalKey rcIBMDownKey .TransmitTerminalKey rcIBMLeftKey .TransmitTerminalKey rcIBMLeftKey .TransmitANSI "c" .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 7, 17 .WaitForDisplayString ".", "30", 7, 13 .TransmitTerminalKey rcIBMTabKey .TransmitANSI "blk" .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 7, 17 .WaitForDisplayString ".", "30", 7, 13 .TransmitTerminalKey rcIBMF3Key .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 11, 2 .TransmitTerminalKey rcIBMUpKey .TransmitTerminalKey rcIBMRightKey .TransmitTerminalKey rcIBMRightKey .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 10, 4 .WaitForDisplayString "?", "30", 10, 2 .TransmitTerminalKey rcIBMDownKey .TransmitTerminalKey rcIBMUpKey Next End With End Sub Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2007 Share Posted May 28, 2007 Well, this will get you closer. But you didn't define 'session'. So I made it an object passed into the function. When you call this function, it you will have to get your object first then pass it to the function: expandcollapse popup$objApp = ObjCreate(SomeFunky.Application) $objSess = ObjGet($objApp.Session) Macro3($objSess) Func Macro3($Session) Local $i For $i = 1 To 100 With $Session .WaitForEvent rcEnterPos, "30", "0", 10, 4 .WaitForDisplayString "?", "30", 10, 2 .TransmitTerminalKey rcIBMDownKey .TransmitTerminalKey rcIBMLeftKey .TransmitTerminalKey rcIBMLeftKey .TransmitANSI "c" .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 7, 17 .WaitForDisplayString ".", "30", 7, 13 .TransmitTerminalKey rcIBMTabKey .TransmitANSI "blk" .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 7, 17 .WaitForDisplayString ".", "30", 7, 13 .TransmitTerminalKey rcIBMF3Key .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 11, 2 .TransmitTerminalKey rcIBMUpKey .TransmitTerminalKey rcIBMRightKey .TransmitTerminalKey rcIBMRightKey .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 10, 4 .WaitForDisplayString "?", "30", 10, 2 .TransmitTerminalKey rcIBMDownKey .TransmitTerminalKey rcIBMUpKey EndWith Next EndFunc ;==>Macro3 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 Link to comment Share on other sites More sharing options...
Zedna Posted May 28, 2007 Share Posted May 28, 2007 .WaitForEvent rcEnterPos, "30", "0", 10, 4oÝ÷ ÚÈhºW[y«¢+ع]¥Ñ½ÉٹСɹÑÉA½Ì°ÅÕ½ÐìÌÀÅÕ½Ðì°ÅÕ½ÐìÀÅÕ½Ðì°ÄÀ°Ð¤ with parentheses if it's function Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
MarcoCastro Posted May 29, 2007 Author Share Posted May 29, 2007 Well, this will get you closer. But you didn't define 'session'. So I made it an object passed into the function. When you call this function, it you will have to get your object first then pass it to the function: expandcollapse popup$objApp = ObjCreate(SomeFunky.Application) $objSess = ObjGet($objApp.Session) Macro3($objSess) Func Macro3($Session) Local $i For $i = 1 To 100 With $Session .WaitForEvent rcEnterPos, "30", "0", 10, 4 .WaitForDisplayString "?", "30", 10, 2 .TransmitTerminalKey rcIBMDownKey .TransmitTerminalKey rcIBMLeftKey .TransmitTerminalKey rcIBMLeftKey .TransmitANSI "c" .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 7, 17 .WaitForDisplayString ".", "30", 7, 13 .TransmitTerminalKey rcIBMTabKey .TransmitANSI "blk" .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 7, 17 .WaitForDisplayString ".", "30", 7, 13 .TransmitTerminalKey rcIBMF3Key .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 11, 2 .TransmitTerminalKey rcIBMUpKey .TransmitTerminalKey rcIBMRightKey .TransmitTerminalKey rcIBMRightKey .TransmitTerminalKey rcIBMEnterKey .WaitForEvent rcKbdEnabled, "30", "0", 1, 1 .WaitForEvent rcEnterPos, "30", "0", 10, 4 .WaitForDisplayString "?", "30", 10, 2 .TransmitTerminalKey rcIBMDownKey .TransmitTerminalKey rcIBMUpKey EndWith Next EndFunc ;==>Macro3 Thanks , session? i work with "Wmsp.rsf", my english is bad. Can you replace in the code my session? Thanks to all. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 29, 2007 Share Posted May 29, 2007 should be: expandcollapse popup.WaitForEvent (rcEnterPos, "30", "0", 10, 4)oÝ÷ Û«z{azǬøßÛºw-ÿªê-xj(v"Ò-)äêÞ}êÞȧÊ'²Ö§¶ÉbëazG²r^±úèë,yÕ¢¶ajا)Ý"·¡×ëb¶+,¶)eæ«j{^yÙè¶Ú0¢¹,w"¯zz"uæ°«Z¦+y«^²Øb²«¨¶Ç¬²*'ªê-¡¸ÞrÛ§²êÞ|°k(^íý²Ø^r©ë^,"Ø.zË·Z¶+p¢é]$)ü§Z(y¬!jÜÁêÞµ©dxnjëh×6; Declare constants for keyboard actions Global Const $rcIBMTabKey = 0x09 Global Const $rcIBMEnterKey = 0x0D Global Const $rcIBMLeftKey = 0x25 Global Const $rcIBMUpKey = 0x26 Global Const $rcIBMRightKey = 0x27 Global Const $rcIBMDownKey = 0x28 Global Const $rcIBMF3Key = 0x72 ; Constants for keyboard events Global Const $rcEnterPos = "0x???" Global Const $rcKbdEnabled = "0x???" $objApp = ObjCreate(SomeFunky.Application) $objSess = ObjGet($objApp.Session) Macro3($objSess) Func Macro3($Session) Local $i For $i = 1 To 100 With $Session .WaitForEvent ($rcEnterPos, "30", "0", 10, 4) .WaitForDisplayString ("?", "30", 10, 2) .TransmitTerminalKey ($rcIBMDownKey) .TransmitTerminalKey ($rcIBMLeftKey) .TransmitTerminalKey ($rcIBMLeftKey) .TransmitANSI ("c") .TransmitTerminalKey ($rcIBMLeftKey) .WaitForEvent ($rcKbdEnabled, "30", "0", 1, 1) .WaitForEvent ($rcEnterPos, "30", "0", 7, 17) .WaitForDisplayString (".", "30", 7, 13) .TransmitTerminalKey ($rcIBMTabKey) .TransmitANSI ("blk") .TransmitTerminalKey ($rcIBMEnterKey) .WaitForEvent ($rcKbdEnabled, "30", "0", 1, 1) .WaitForEvent ($rcEnterPos, "30", "0", 7, 17) .WaitForDisplayString (".", "30", 7, 13) .TransmitTerminalKey ($rcIBMF3Key) .WaitForEvent ($rcKbdEnabled, "30", "0", 1, 1) .WaitForEvent ($rcEnterPos, "30", "0", 11, 2) .TransmitTerminalKey ($rcIBMUpKey) .TransmitTerminalKey ($rcIBMRightKey) .TransmitTerminalKey ($rcIBMRightKey) .TransmitTerminalKey ($rcIBMEnterKey) .WaitForEvent ($rcKbdEnabled, "30", "0", 1, 1) .WaitForEvent ($rcEnterPos, "30", "0", 10, 4) .WaitForDisplayString ("?", "30", 10, 2) .TransmitTerminalKey ($rcIBMDownKey) .TransmitTerminalKey ($rcIBMUpKey) EndWith Next EndFunc ;==>Macro3 Your original code posted had: With Session And the references below that look like methods from a keyboard control object. All of those "rcIBM..." references are constants of keyboard codes for keys (I'm guessing). So I interpreted them that way at the top. But that's a complete guess. This is clearly not all of the code. Only YOU know what object is being used and YOU haven't chosen to share that with us... 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now