Sign in to follow this  
Followers 0
Ram

Calling same Function with different values.

10 posts in this topic

#1 ·  Posted (edited)

Hey,

I am trying to call this code with different $a, and $b values.. How should I go about doing it?

for example: the below is calling $a = 20, $b = 100 this value is used in the function - Now I would like to call this again with different values like $a = 50, $b = 400 and used in the same function...

I tried putting the same code and put different variables eg: instead of $a, $b... I put $x, $y but it kept saying duplicate function.. so what would have been wrong? Please let me know?

$a = 20

$b = 100

_MouseClick(ControlGetHandle("Book", "", "menubar1"), "left", $a, $:whistle:

Func _MakeLong($LoWord, $HiWord)

Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))

EndFunc

Func _MouseClick($hWnd, $button, $a, $b, $times=1, $delay=250)

If $hWnd = 0 Then

SetError(-1)

Return

EndIf

Local $ix

Local $lParam = _MakeLong($a, $:)

Local $user32 = DllOpen("user32.dll")

$button = StringLower($button)

If $button = "left" Then

For $ix = 1 To $times

DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam)

DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x201, "int", 1, "long", $lParam)

DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x202, "int", 0, "long", $lParam)

If $ix < $times Then Sleep($delay)

Next

ElseIf $button = "right" Then

For $ix = 1 To $times

DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam)

DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x204, "int", 2, "long", $lParam)

DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x205, "int", 0, "long", $lParam)

If $ix < $times Then Sleep($delay)

Next

Else

SetError(-2)

If $user32 <> -1 Then DllClose($user32)

Return

EndIf

If $user32 <> -1 Then DllClose($user32)

EndFunc

Awaiting your response!

Thanks!

Edited by Ram

Share this post


Link to post
Share on other sites



#forceref $a, $b

I tried to look for #forceref but without success. I couldn't find anything on the AutoIT online help page or SciTE help and the forum doesn't have a topic for this (the search returned something but on different topics.

My questions: there is another place to look for extra knowledge? The online help page/SciTE are not complete? there are other functions/macros/keywords not included there?

Thank you for answering any of my questions.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'm just wondering, enaiman... You are aware that there is a offline helpfile of AutoIt as well, right ?

And the chance that you already have it on your computer is...pretty damn high.

Edited by Helge

Share this post


Link to post
Share on other sites

I am sorry to ask this, but can someone point to #forceref - I searched the help that was installed on the computer and could not find this or forceref - is there another search word?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

I am sorry to ask this, but can someone point to #forceref - I searched the help that was installed on the computer and could not find this or forceref - is there another search word?

#forceref is a directive used by AU3CHECK. See here:

http://www.autoitscript.com/forum/index.ph...st&p=284032

http://www.autoitscript.com/forum/index.ph...rceref&st=0

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hey,

I am trying to call this code with different $a, and $b values.. How should I go about doing it?

for example: the below is calling $a = 20, $b = 100 this value is used in the function - Now I would like to call this again with different values like $a = 50, $b = 400 and used in the same function...

$a = 20

$b = 100

_MouseClick(ControlGetHandle("Book", "", "menubar1"), "left", $a, $:whistle:

maybe I don't understand, but wouldn't this do what you asked for?

$a = 20
$b = 100

_MouseClick(ControlGetHandle("Book", "", "menubar1"), "left", $a, $B)

$a = 50
$b = 400

_MouseClick(ControlGetHandle("Book", "", "menubar1"), "left", $a, $B)
Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

maybe I don't understand, but wouldn't this do what you asked for?

$a = 20
$b = 100

_MouseClick(ControlGetHandle("Book", "", "menubar1"), "left", $a, $B)

$a = 50
$b = 400

_MouseClick(ControlGetHandle("Book", "", "menubar1"), "left", $a, $B)
Nope.. I get _MouseClick already defined..

Share this post


Link to post
Share on other sites

You're not repeating this line anywhere are you?

Func _MouseClick($hWnd, $button, $a, $b, $times=1, $delay=250)

Share this post


Link to post
Share on other sites

I'm just wondering, enaiman... You are aware that there is a offline helpfile of AutoIt as well, right ?

And the chance that you already have it on your computer is...pretty damn high.

When I said "SciTE help" I meant the AutoIT help which can be accessed thru F1 command in the editor. I'm pretty sure that we're talking about same file.

I don't post for the sake of posts number or to ask something I can find very easy in the help or forum because I respect the time spent by many people here who try to help us the others - I call it "common sense".

If the reference to "#forceref" is present on last version help I appologize because I use 3.2.1.0 due to "ControlSend" faulty function in 3.2.2.0; anyway I couldn't find it on mine.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0