Sign in to follow this  
Followers 0
SomeStrangeIdiot70

Control click function combined with filereadline = Problems!

8 posts in this topic

#1 ·  Posted (edited)

So I have been working on a program for the last few days now. and decided I wanted a customize-able user input file for settings. But when I changed the vars within controlclick to say...

This would be at the start of the text file when it is opened...

$Inputs = FileOpen("CustomInputs.ini", 0)
$MousePosition10 = FileReadLine($Inputs, 57)
FileClose($Inputs)

and then later on when the control click comes around, It would have this.

ControlClick("WindowTitle", "", "", "left", 1, $MousePosition10)

It seems to get an Entirely different mouseposition for the window than it originally would if it were a locked predefined input.

So. Does anybody here know a way around this?... It is looking like I may have to leave customization out of this

Edited by SomeStrangeIdiot70

Share this post


Link to post
Share on other sites



Hi, SomeStrangeIdiot70, welcome to the forum. What is the value of $MousePosition10 once you read it in from $Inputs? You are only calling the X axis in your ControlClick, that may be the issue.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hi, SomeStrangeIdiot70, welcome to the forum. What is the value of $MousePosition10 once you read it in from $Inputs? You are only calling the X axis in your ControlClick, that may be the issue.

The value within the customization file is currently set to:

550, 600

I already converted all of the lines to send the output to a text file instead of to the controlclick so I could verify they are receiving the correct information, Each line appeared in the textfile exactly as they did in the settings file...So..It has to be a flaw within the software itself unless I am missing something...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You're calling this:

ControlClick("WindowTitle", "", "", "left", 1, $MousePosition10)

Which, in essence comes out like this:

ControlClick("WindowTitle", "", "", "left", 1, "550, 600")

It is taking your entire variable and putting it into the X axis value, it is not splitting it between X and Y (it reads your comma as part of the variable). Try putting one value on one line, and another on the next. Something like this:

$MousePositionX = FileReadLine($Inputs, 57)
$MousePositionY = FileReadLine($Inputs, 58)

ControlClick("WindowTitle", "", "", "left", 1, $MousePositionX, $MousePositionY)
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You're calling this:

ControlClick("WindowTitle", "", "", "left", 1, $MousePosition10)

Which, in essence comes out like this:

ControlClick("WindowTitle", "", "", "left", 1, "550, 600")

It is taking your entire variable and putting it into the X axis value, it is not splitting it between X and Y (it reads your comma as part of the variable). Try putting one value on one line, and another on the next. Something like this:

$MousePositionX = FileReadLine($Inputs, 57)
$MousePositionY = FileReadLine($Inputs, 58)

ControlClick("WindowTitle", "", "", "left", 1, $MousePositionX, $MousePositionY)

So there is no way around this at all to make it simply read one line?

like...something that would take the input from the line of text, And then break the numerical values into two seperate inputs within it?

Basicly...Something within the code that would go 304, 1200

Then after reading that line, it would recognize it as two individual numerical values and assign those with tages such as $MousePosition10x MousePosition10y

or anything along those lines?...Im certain this would be possible but would require generating a temporary text file, removing the first numerical group and assigning it to a value, deleting the ", " and then taking the second value and assigning it a value too.

There is a way to do it...I just cant recall how it is ><

Edit:

FileWrite("out.txt", StringRegExpReplace(FileRead("in.txt"), "(, *)", @CRLF) & @LF)

Something similar to that...but without an output file. And breaking apart the values so autoit can read them individually...

Yeah I know... My brain likes to complicate things with useless information

Edited by SomeStrangeIdiot70

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Yes, if the format is static (always xxx , xxx), you can split the string:

ControlClick("WindowTitle", "", "", "left", 1, StringLeft($MousePosition10, 3), StringRight($MousePosition10, 3))
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Yes, if the format is static (always xxx , xxx), you can split the string:

ControlClick("WindowTitle", "", "", "left", 1, StringLeft($MousePosition10, 3), StringRight($MousePosition10, 3))

Thank you <3 I will experiment with this when I get home from work.

And, I cant help but notice the 3 in there, Would that represent a 3 digit numerical variable in the string? As in using 4 or 2 would throw it off?

Share this post


Link to post
Share on other sites

3 represents the number of characters from the right or left that you are choosing. I would suggest looking the two functions (StringLeft and StringRight) in the help file so see all the different options you have available to you.


√-1 2^3 ∑ π, and it was delicious!

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