Applications, Games, Tools, User libs and useful stuff coded in PureBasic
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 1:23 pm
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
The happiness is a road...
Not a destination
Kiffi
Addict
Posts: 1484 Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9
Post
by Kiffi » Thu Jun 07, 2007 1:45 pm
Kwaï chang caïne wrote: And nothing is run
please insert the following line at top of your snippet:
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
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 1:52 pm
Thats right
I have a messagebox error
The happiness is a road...
Not a destination
Kiffi
Addict
Posts: 1484 Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9
Post
by Kiffi » Thu Jun 07, 2007 2:03 pm
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
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 2:04 pm
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
The happiness is a road...
Not a destination
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 2:10 pm
YEEEEEESSSSSS !!!!!
It's run perfectly
You are the best of the world
The happiness is a road...
Not a destination
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 2:22 pm
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 ?
The happiness is a road...
Not a destination
ts-soft
Always Here
Posts: 5756 Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany
Post
by ts-soft » Thu Jun 07, 2007 2:31 pm
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.
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 2:45 pm
Thanks two for your help Ts-Soft
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"
The happiness is a road...
Not a destination
ts-soft
Always Here
Posts: 5756 Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany
Post
by ts-soft » Thu Jun 07, 2007 2:50 pm
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.
Kiffi
Addict
Posts: 1484 Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9
Post
by Kiffi » Thu Jun 07, 2007 2:58 pm
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
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 3:09 pm
@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"
The happiness is a road...
Not a destination
Kiffi
Addict
Posts: 1484 Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9
Post
by Kiffi » Thu Jun 07, 2007 3:16 pm
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
Kwai chang caine
Always Here
Posts: 5494 Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France
Post
by Kwai chang caine » Thu Jun 07, 2007 3:19 pm
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
The happiness is a road...
Not a destination