antojuna | 29 Mar 2011 10:04
Favicon

two questions

I have two questions. I bought a Notebook HP with Windows 7 Started. The feature "Left click mouse when mouse
stops over contro" doesn't work at all, either a Hotkey for "*Exec Autopress". What can I do?. I don't find
anything in the Help File.

I have this little script: 

var1 = "copy"
var2 = "brandy"
Do("C:/Programs/metapad35/metapad.exe", "M:/query.txt")
Wait.for(1500,activewindow("*query*"))
wait.for(150)
Keys {Ctrl}h
wait.for(250)
win.sendkeys (var1)
wait.for(250)
Keys {Tab}
win.sendkeys (var2)
wait.for(500)
Keys {Alt}a

It works but I need more. My humble scrpipt manages a single "Replace" inside a file open with Metapad, a
small text editor. But it only does one "Replace". I need something more functional, more "Replaces"
again and again. I could keep on sending "Keys" but I suspect that there is a better way. I don't kown which.
Maybe plugins, scripts, a clever loop.... I have a forty years long learning curve before me. Please, a lot
of sun and sund all around here, I need some manna.

------------------------------------

PowerPro can be found here: http://www.ppro.org/
and here: http://ppro.pcrei.com/Yahoo! Groups Links
(Continue reading)

brother.gabriel | 29 Mar 2011 15:40
Gravatar

Re: two questions

A couple ideas for you... I used to use metapad, but switched to notepad2 because notepad2 has syntax
highlighting, is just a simple, and just as fast.

I don't know about windows 7; however as for multi-find-replace,
try copying the entire text to a variable, then use replacechars on the whole string, something like this:
--------------------------------------------------
local var1 = "copy"
local var2 = "brandy"

Do("C:/Programs/metapad35/metapad.exe", "M:/query.txt")
Wait.for(1500,activewindow("*query*"))
*keys ^a
local allthetext = clip.copy
allthetext = replacechars(allthetext, var1, var2)
clip.paste(allthetext)
--------------------------------------------------

--- In powerpro-beginners@..., "antojuna"
<h0dy2s.shotynt <at> ...> wrote:
>
> I have two questions. I bought a Notebook HP with Windows 7 Started. The feature "Left click mouse when
mouse stops over contro" doesn't work at all, either a Hotkey for "*Exec Autopress". What can I do?. I don't
find anything in the Help File.
> 
> 
> I have this little script: 
> 
> var1 = "copy"
> var2 = "brandy"
> Do("C:/Programs/metapad35/metapad.exe", "M:/query.txt")
(Continue reading)

antojuna | 29 Mar 2011 18:11
Favicon

Re: two questions

Thanks for your answer. Your script doesn't work on a computer running Windows 2000. I don't know why.
Firstly clip.paste(allthetext) returns "Need 0 arguments for clip.paste", then you need to erase
"(allthetext)" and the error message doesn't come out but nothing happens. The worst thing is that I'm not
sure if "replacechars" works or not. When I add

wait message 20,(allthetext) 

the message box is empty, "allthetext" is equal to nothing. 

After reading the help file looking for "replace", I tried:

allthetext = replacechars("allthetext", "var1", "var2")
allthetext .= replacechars(var1, var2)
allthetext = regex.replaceg("allthetext", "var1", "var2")
result = replacechars("allthetext", "var1", "var2")

Your script only selects all the text in "query.txt" but nothing changes, nothing is pasted, whatelse
"allthetext" I use. This is all the mess that I can understand.

--- In powerpro-beginners@..., "brother.gabriel"
<brgabriel <at> ...> wrote:
>
> A couple ideas for you... I used to use metapad, but switched to notepad2 because notepad2 has syntax
highlighting, is just a simple, and just as fast.
> 
> I don't know about windows 7; however as for multi-find-replace,
> try copying the entire text to a variable, then use replacechars on the whole string, something like this:
> --------------------------------------------------
> local var1 = "copy"
> local var2 = "brandy"
(Continue reading)

brother.gabriel | 29 Mar 2011 20:53
Gravatar

Re: two questions

Sorry! Try this (win.debug is your friend):

local var1 = "copy"
local var2 = "brandy"
Do("C:/Programs/metapad35/metapad.exe", "M:/query.txt")
Wait.for(1500,activewindow("*query*"))
*keys ^a
local allthetext = clip.copy
win.debug("before replacechars" ++ allthetext)
allthetext = replacechars(allthetext, var1, var2)
win.debug("after replacechars" ++ allthetext)
clip.textpaste(allthetext)

--- In powerpro-beginners@..., "antojuna"
<h0dy2s.shotynt <at> ...> wrote:
>
> Thanks for your answer. Your script doesn't work on a computer running Windows 2000. I don't know why.
Firstly clip.paste(allthetext) returns "Need 0 arguments for clip.paste", then you need to erase
"(allthetext)" and the error message doesn't come out but nothing happens. The worst thing is that I'm not
sure if "replacechars" works or not. When I add
> 
> wait message 20,(allthetext) 
> 
> the message box is empty, "allthetext" is equal to nothing. 
> 
> After reading the help file looking for "replace", I tried:
> 
> allthetext = replacechars("allthetext", "var1", "var2")
> allthetext .= replacechars(var1, var2)
> allthetext = regex.replaceg("allthetext", "var1", "var2")
(Continue reading)

Sheri | 29 Mar 2011 22:04
Picon

Re: Re: two questions

On 3/29/2011 2:53 PM, brother.gabriel wrote:
> Sorry! Try this (win.debug is your friend):
>
> local var1 = "copy"
> local var2 = "brandy"
> Do("C:/Programs/metapad35/metapad.exe", "M:/query.txt")
> Wait.for(1500,activewindow("*query*"))
> *keys ^a
> local allthetext = clip.copy
> win.debug("before replacechars" ++ allthetext)
> allthetext = replacechars(allthetext, var1, var2)
> win.debug("after replacechars" ++ allthetext)
> clip.textpaste(allthetext)
>
I would caution that you should have a wait after the ^a and after 
copying to the clipboard such as wait.for(50) .

Also if the focus is shifted away, e.g., with win.debug, you may need to 
reset the focus before pasting.

Another suggestion to help make it more reliable is to first clear the 
clipboard (add another wait), and after copying to the clipboard, test 
to see the length of clip.get to make sure the copy worked.

Regards,
Sheri

------------------------------------

PowerPro can be found here: http://www.ppro.org/
(Continue reading)

antojuna | 31 Mar 2011 18:30
Favicon

Re: two questions

Thanks again. Your script didn't work in my computer but your work and some gentle advice helped me. At last I
got some results with this script. Surely it seems less elegant than yours but it works, sometimes.
Yesterday it didn't, but this evening some magic happened. I guess.

local var1 = "copy"
local var2 = "brandy"
Do("C:/Programs/metapad35/metapad.exe", "M:/query.txt")
Wait.for(1500,activewindow("*query*"))
keys {Ctrl}a
wait.for(1250)
Clip Copy
wait.for(1250)
local allthetext = clip.get
wait.for(250)
;win.debug("before replacechars" ++ allthetext)
allthetext = replacechars(allthetext, var1, var2)
wait.for(2050)
;win.debug("after replacechars" ++ allthetext)
wait.for(250)
clip.setpaste(allthetext)
Window.Show("*query*")
keys {Ctrl}a
Clip Paste
wait.for(050)

I had to use "Window.Show("*query*")" at the end because I was unable to understand the syntax of "getfocus()".

I repeat now my first question. It's imposible that my case is an exception.  Someone else must use Windows 7
and PowerPro. Have anyone noticed this problem in the GUI control with "Left click mouse stops over
control"?. It's a good feature and it's easy to check and the computer will not crash in any case. I don't
(Continue reading)


Gmane