PureDispHelper UserLib - Update with Includefile for Unicode

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post 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 :(
ImageThe happiness is a road...
Not a destination
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post 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
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

Thats right

I have a messagebox error

Image
ImageThe happiness is a road...
Not a destination
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post 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
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post 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:
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

YEEEEEESSSSSS !!!!!

It's run perfectly

You are the best of the world :D
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post 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 ?
ImageThe happiness is a road...
Not a destination
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post 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:
ImageThe happiness is a road...
Not a destination
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post 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:
ImageThe happiness is a road...
Not a destination
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Post 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
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post 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
ImageThe happiness is a road...
Not a destination
Post Reply