Jump to content

Write to ini from textbox/ then recall info


Recommended Posts

$answer = "500, 500"
$coords = StringSplit($answer, ",")
$x_coord = StringStripWS($coords[1], 8)
$y_coord = StringStripWS($coords[2], 8)
MouseClick("left", $x_coord, $y_coord, 1)

not to sound like a Smart A but, if I were to write it this way, wouldn't it just be easier to use " MouseClick("left", 500,500, 1)

If I had hard write it into the code anyway?

And I some what understand what you are saying about the direct value, but since i am still new at this ( how can you not tell ) My thinking is

even if a direct value is used to pull the information from the ini, WHY wont it read and insert the the correct value, like a copy/paste?

ie: if you enter xxx , xxx into the ini it should be able to read it the same way.

But thats what I am failing to understand.

I will try it kaot's way , but for a 1st time user it seems pretty time consuming, even on the final user.

Thanks everyone i will try it out and post my results.

Cue

Link to comment
Share on other sites

Ok here is what I have done now :(

$Box1X = InputBox("ESB", "Please use the window info tool to find the X location of box# 1. Enter it here ie: xxxx", "", default)

IniWrite("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","X", $Box1X)

$Box2Y = InputBox("ESB", "Please use the window info tool to find the Y location of box# 1. Enter it here ie: xxxx", "", default)

IniWrite("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","Y", $Box2Y)

^^^ not the problem, and works like a charm. creates the boxes, I enter the cords as a split, ie: 758 <enter> then 351 <enter>

and it saves to the ini

Now comes the fun part.

$x=IniRead("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","X", default)

$y=IniRead("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","Y", default)

MouseClick("left", $x,$y, 1)

Takes it to the far left of the screen. 3/4 the way up. :) , BTW, this script is in 2 parts, 1 that writes to the ini, and 1 that will read the ini and perform the actions. I know im on the right track, so i will keep playing with it some more, but the far left is driving me crazy lol.

thx

Cue

Link to comment
Share on other sites

Well after tearing it apart and redoing it I have located the problem. :(

$Box1X = InputBox("ESB", "Please use the window info tool to find the X location of box# 1. Enter it here ie: xxxx", "", default)

IniWrite("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","X", $Box1X)

$Box2Y = InputBox("ESB", "Please use the window info tool to find the Y location of box# 1. Enter it here ie: xxxx", "", default)

IniWrite("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","Y", $Box2Y)

I should have never inserted the "default" at the end of the line.

Same with below

$x=IniRead("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","X", default)

$y=IniRead("C:\Users\Main\Desktop\ESB\windowinfo.ini", "Box 1","Y", default)

MouseClick("left", $x,$y, 1)

so after removing the default on the 1st set and replacing it on the second set with $answer1 and $answer2 it was able to goto the correct "test " position.

Can we say Duh to the cue. lol

Thanks everyone who helped and pointed me in the right direction.

Cue

Link to comment
Share on other sites

it would be easier with only 1 input, but in your example how would i do that without writing it into the script?

Till i figure that out, I am using the 2/box/input method. box 1 for X and box 2 for Y.

that is till i can figure out how to get 2 lines on 1 box LOL. I will work on that later, but getting THIS part of it to work, has pushed me in the right direction and will let me continue what i was doing. I was only stuck on the 1 part, and Ease of use will come later i think .

Thx again

Link to comment
Share on other sites

not to sound like a Smart A but, if I were to write it this way, wouldn't it just be easier to use " MouseClick("left", 500,500, 1)

Guess, you sound exacly like one ...

the line :

$answer = "500, 500"

was there to substitute the value you were reading from your ini file (did you expect maybe to go all the way even create an ini file and such? with fries on top? :)) and what I offered you was a proof of concept. It was there just to save you further headaches by modifying the rest of your code ... and you used it very well :)

You'll understand later :(

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 :)

Link to comment
Share on other sites

Guess, you sound exacly like one ...

the line :

$answer = "500, 500"

was there to substitute the value you were reading from your ini file

well now that it was explained to me, i got it.

Thanks again for the assistance.

Link to comment
Share on other sites

How about using WinGetPos or MouseGetPos to get coords instead of the user getting them visually thru the info tool? See the Remember function in my MouseTrap script (the link I posted earlier) for an example (that works this time :( ).

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

How about using WinGetPos or MouseGetPos to get coords instead of the user getting them visually thru the info tool? See the Remember function in my MouseTrap script (the link I posted earlier) for an example (that works this time :( ).

the more i have played with what i am doing, the more i am starting to understand.

I will try both of those, and see if I can get them to work.

I tried the mouse trap code at 1st attempt and could not seem to get it to work. But now looking back at it, it seems to be a heck of a lot easier then using the windowinfo tool. Should save me TONS of time setting up the different pc's.

Thanks again, and I will post my results.

Cue

Link to comment
Share on other sites

ok i have changed it yet again.

this is the test code/example for future use.

Local $answer

$var = IniRead("C:\Users\Main\Desktop\test.ini", "SectionNameHere","keyNameHere", $answer)

$array = StringSplit($var, ",")

Mouseclick("left", $array[1], $array[2], 1)

And with this it is able to do exactly what i needed.

1st part

$answer = InputBox("Word Writer", "Please use the window info to find the location of box 1a. Enter those here", "", "")

IniWrite("C:\Users\Main\Desktop\test.ini", "SectionNameHere","keyNameHere"", $answer)

box pops up and then you can enter X/Y from info tool. ( still workin with getmousecord)

User ( me) enters position in X/Y xxx,yyy

then later in script it recalls it as

$var = IniRead("C:\Users\Main\Desktop\test.ini", "SectionNameHere","keyNameHere", $answer)

$array = StringSplit($var, ",")

Mouseclick("left", $array[1], $array[2], 1)

and goes to the correct position. When i first started using it , it would take me far left screen, but that was my fault. ( forgot 2nd array)

but i will keep trying with the getmousecords and cheer to myself silently.

Thanks again everyone. Great job :(:)

Edited by cueclub
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...