Page 12 of 18

Posted: Thu Jun 07, 2007 1:23 pm
by Kwai chang caine
Thanks for your answer, but i have wrote this code :

Code: Select all

RunProgram ("C:\Program Files\atra.exe") 

Define.l atra 
atra = dhCreateObject("atra.system") 

If atra 
 dhCallMethod(atra, "System.ActiveSession")
 dhPutValue (atra, "atra.Screen.Row = %d", 24) 
 dhPutValue (atra, "atra.Screen.Col = %d", 4) 
 dhCallMethod (atra, "atra.Screen.SendKeys(%T)", @"Coucou") 
 dhReleaseObject (atra) 
 atra = 0 
  
EndIf 
And nothing is run :(

Posted: Thu Jun 07, 2007 1:45 pm
by Kiffi
Kwaï chang caïne wrote:And nothing is run :(
please insert the following line at top of your snippet:

Code: Select all

dhToggleExceptions(#True)
Then a Messagebox will appear when a parameter is wrong.

// Edit:

Ah! Now i see you have to put your values and execute the method on the
Session-Object, not on the Atra-Object!

Greetings ... Kiffi

Posted: Thu Jun 07, 2007 1:52 pm
by Kwai chang caine
Thats right

I have a messagebox error

Image

Posted: Thu Jun 07, 2007 2:03 pm
by Kiffi
And what about this code?

Code: Select all

Define.l System
Define.l Session

dhToggleExceptions(#True)

System = dhCreateObject("ATRA.System")

If System
  
  dhGetValue("%o", @Session, System, ".ActiveSession")
  
  If Session
    
    dhPutValue  (Session, ".Screen.Row = %d", 24)
    dhPutValue  (Session, ".Screen.Col = %d", 4)
    dhCallMethod(Session, ".Screen.SendKeys(%T)", @"Coucou") 

    MessageRequester("", "Success!")
    
    dhReleaseObject(Session)
    
  Else
    MessageRequester("", "Couldn't create Session-Object")
  EndIf
  
  dhReleaseObject(System)
  
Else
  MessageRequester("", "Couldn't create System-Object")
EndIf
Greetings ... Kiffi

Posted: Thu Jun 07, 2007 2:04 pm
by Kwai chang caine
I have replace the "atra" by "session" and it's the same error

Code: Select all

RunProgram ("C:\Program Files\atra.exe") 

dhToggleExceptions(#True)
Define.l atra 
atra = dhCreateObject("atra.system") 

If atra 
 dhCallMethod(atra, "System.ActiveSession")
 dhPutValue (atra, "session.Screen.Row = %d", 24) 
 dhPutValue (atra, "session.Screen.Col = %d", 4) 
 dhCallMethod (atra, "session.Screen.SendKeys(%T)", @"Coucou") 
 dhReleaseObject (atra) 
 atra = 0 
  
EndIf 
Image

:cry:

Posted: Thu Jun 07, 2007 2:10 pm
by Kwai chang caine
YEEEEEESSSSSS !!!!!

It's run perfectly

You are the best of the world :D

Posted: Thu Jun 07, 2007 2:22 pm
by Kwai chang caine
I have a new problem

Atra will return a value with this function in VB

Code: Select all

If Session.Screen.Area(24, 37, 24, 55, , 1) = "Error of connection" then
.
.
.
endif
How you convert this line of code in pure, please ?

Posted: Thu Jun 07, 2007 2:31 pm
by ts-soft
is result a string test way:

Code: Select all

Define.l Result
dhGetValue("%T", @Result, "Screen.Area(d%, d%, d%, d%, ...)", 24, 37, ....)
Debug PeekS(Result)
dhFreeString(Result)
Is result a boolean test this way:

Code: Select all

Define.l Result
dhGetValue("%b", @Result, "Screen.Area(d%, d%, d%, d%, ...)", 24, 37, ....)
Debug Result

Posted: Thu Jun 07, 2007 2:45 pm
by Kwai chang caine
Thanks two for your help Ts-Soft 8)

I have wrote this code

Code: Select all

Define.l Result 
dhGetValue("%T", @Result, ".Screen.Area(d%, d%, d%, d%)", 8, 8, 8, 22) 
And i have a message error , "Bad parameter type: a string is expected" :cry:

Posted: Thu Jun 07, 2007 2:50 pm
by ts-soft
Read the documentation or use a tool like oleviewer to get the parameter.

VB uses Variant, so another way is using of Varianthelper_Include.pbi

Posted: Thu Jun 07, 2007 2:58 pm
by Kiffi
Kwaï chang caïne wrote:

Code: Select all

dhGetValue("%T", @Result, ".Screen.Area(d%, d%, d%, d%)", 8, 8, 8, 22)

Code: Select all

If Session.Screen.Area(24, 37, 24, 55, , 1) = "Error of connection" then

As you see, the function expected 6 parameters, not only 4 as you wrote.

The 5th parameter can be empty. Using the disphelper you can write
something like this:

Code: Select all

dhGetValue("%T", @Result, ".Screen.Area(%d, %d, %d, %d, %m, %d)", 8, 8, 8, 22, 1)
And: Don't swap the percent-sign and the identifier type!
Use %d and not d% ;-)

Greetings ... Kiffi

Posted: Thu Jun 07, 2007 3:02 pm
by ts-soft
Kiffi wrote: And: Don't swap the percent-sign and the identifier type!
Use %d and not d% ;-)

Greetings ... Kiffi
http://www.purebasic.fr/english/viewtop ... 478#198478
:oops:

Posted: Thu Jun 07, 2007 3:09 pm
by Kwai chang caine
@Kiffi

I have wrote this line :

Code: Select all

dhGetValue("%T", @Result, ".Screen.Area(%d, %d, %d, %d, %m, %d)", 8, 8, 8, 22, 1)
And i have always a message error , "Bad parameter type: a string is expected" :cry:

Posted: Thu Jun 07, 2007 3:16 pm
by Kiffi
Kwaï chang caïne wrote:And i have always a message error , "Bad parameter type: a string is expected"
now it's difficult to help you without knowing the exact meaning of the
parameters.

As ts-soft wrote, now it is time to read and understand the documentation of
your tool.

Greetings ... Kiffi

Posted: Thu Jun 07, 2007 3:19 pm
by Kwai chang caine
Ok, thank you very much for your help Kiffi and Ts-Soft.
I try to understand the documentation.

I wish you a very good day