Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why mouse wheel F/B ok, but with <CTL> first needs rel
#1
Hi all,

I am pretty new to QM and its programming.

My problem is that configuring a macro to be called on mouse wheeling (forward and backward) works fine; but when configured together with a modifier key (e.g. CTL), the macro is not called until that key is also released. Further, it works only this only well when Eat is enabled. When Eat is disabled the macro is not called at all, even when the CTL key is afterwards released.

Can somebody explain to me why this is the case, and what I can do to get things to work without the key being released (at all).

Another question: I am writing a suite of macros for FreeHand 9, and could not get the outp function to paste text into a selected toolbar field. It did nothing. The same macro works great for another app (Corel Draw 9). After a lot of time and hair pulling (during which I was coming to the conclusion that QM does not work with FreeHand 9) I eventually found the key command, which actually worked, allowing me to type text straight into to the output object. But why does the outp command not work?

tia

Avraham
#2
Ctrl+wheel

Download QM 2.1.8.

outp

You probably noticed that you cannot use Ctrl+V to paste text in some text fields. To paste, you have to right click and select Paste in the menu. outp uses Ctrl+V.
#3
So the function names out and outp are misleading. They should have been called paste.

When I started using the API I went looking for functions called write, print (printf!), and of course, out.
out doesn't out; it outs the clipboard.

Anyway, is the key function I found the most appropriate thing to use?

Maybe at some point introduce a paste function that is identical to out, but keep out just for backward compatibility.

Thanks,

avraham
#4
out and outp are identical except:
out displays the text in the QM output pane;
outp stores the text into the clipboard and presses Ctrl+V.

I also think outp should be renamed to paste.

key does not use the clipboard.

Try also "Set text of control", "Set text of acc obj" actions in the Text dialog.
#5
QuickMacros is an incredible application. Congratulations!

avraham
#6
>> Download QM 2.1.8.
That is a good, checked version?

>> I also think outp should be renamed to paste.
Maintain out and outp for a while for backward compatibility and recommend not using it in new coding.

>> Try also "Set text of control", "Set text of acc obj" actions in the Text dialog.
Er...where are those functions located? and maybe this is connected to my next question.

Question: if I have captured an event using a macro, and the event is that I have mouse clicked on a control within an app (in my case, I have mouse middle clicked on an editable field within the Freehand main window) then is there any way of getting the Windows ID (handle ?) of the control beneath the mouse pointer at the point where I clicked?

Thanks,

avraham
#7
Don't afraid, 2.1.8 is not less stable than 2.1.6.

Floating toolbar -> Text
or
Floating toolbar -> Windows, controls, menus -> Window actions
Floating toolbar -> Windows, controls, menus -> Accessible object actions

Get handle of control under mouse:
int handle=child(mouse)
If using filter function, it would be f.hwnd2.
#8
>> Get handle of control under mouse:
>> int handle=child(mouse)
>> If using filter function, it would be f.hwnd2.

OK, very good.

Now, is there a way of getting from handle some sort of unique name that I can use it to identify that particular control. What I am doing right now is that the user has to provide an initialization click (I use a wheel (middle button) click for this) on the control to tell my suite of macros where the control is located during this instance of running the program. Of course, if I then resize the FreeHand application window, I will then have to again provide the initialization click so that I know where to simulate mouse clicks on the editable field and paste text into it.

Btw, it's about time I told you what I am trying to do. FreeHand 9 does not come with a wheel zoom. This is important to me. So your QM offers an excellent tool for 'creating' all the events by rolling the wheel. So, for example, when I wheel forward, I catch this event and add a percentage to the current Zoom factor (e.g., 100 + 25) held in a global variable and the macro generates a click on the Zoom field and then writes there the new Zoom value, in the case of the example, this being now 125. I have four of these macros: Zoom In Fine (+25%), Zoom Out Fine (-25%), Zoom In Coarse (+100%), Zoom Out Coarse (-100%), and the Init macro I already mentioned.

tia

avraham
#9
I think you don't need to initialize or get name from handle. You can identify the control by id.

Function FreehandZoom:
Code:
Copy      Help
;/
function size action ;;action: 0 set, 1 add, -1 sub

int handle=id(432 "FreeHand")
str s
if(action)
,s.getwintext(handle)
,int i=val(s)
,if(action>0) size=i+size
,else size=i-size
s=size
act handle
BlockInput 1
key- CSAW
key (s) Y
BlockInput 0

;BlockInput and key- CSAW are used to prevent mixing modifier keys with Enter in case the trigger is a mouse trigger with "When released" unchecked.

It works with Macromedia Freehand MX 11.

Examples

Zoom +25%:
Code:
Copy      Help
FreehandZoom 25 1

Zoom -25%:
Code:
Copy      Help
FreehandZoom 25 -1

Zoom to 100%:
Code:
Copy      Help
FreehandZoom 100 0
#10
Gintaras Wrote:Ctrl+wheel

>> Download QM 2.1.8.
I downloaded and installed QM 2.1.8. Pretty much the same thing happened with CTL+Wheel: the macro would be invoked only once I had released the CTL button. However, now the action seems to be more reliable. With 2.1.6 I got the impression that sometimes the macro would not be invoked at all. Or maybe I was just imagining it...

Anyway, I am still left with the same problem of needing to release the CTL buttton before the macro is called.

>> outp

>> You probably noticed that you cannot use Ctrl+V to paste text in some text fields. To paste, you have to right click and select Paste in the menu.
outp uses Ctrl+V.

Yes, there is such a thing. However, I finally got around to trying out a right-click on this Zoom editable field, and you know what...the Paste command appears and works. So I can't understand why outp did not work. Well, whatever...we have something else that works.

avraham
#11
[quote="Anonymous"][quote="Gintaras"]Ctrl+wheel

>> Download QM 2.1.8.
>> Ok I just noticed that you changed the GUI for the properties window. Seems to me, that's important enough to warrant bumping up the version number to v2.2.

>> key -CAWS
That forces a release of all buttons?

avraham
#12
When I click the zoom edit field and press Ctrl+V, it pastes the number in the document, not in the field. Menu of course works. To simulate what the menu does, you can use

s.setsel(0 handle) ;;here s is a string variable containing the text to paste; handle is combo box control handle


key- CSAW releases all modifier keys. This not necessary for keyboard macros.
#13
>> It works with Macromedia Freehand MX 11

Freehand MX 11 also doesn't have a wheel zoom? (I can't be bothered to download and install the trial just to look...)
#14
doesn't have
#15
Gintaras Wrote:doesn't have

Wow! So you could sell QM and the suite of wheel zoom macros as a "solution" for the FreeHand zooming weakness.

Where I live, in Israel, FreeHand is the de facto vector graphics app used by all print shops and graphics studios (because the Hebrew version apparently handles the Hebrew well and is stable). However, that's on the Mac.

FreeHand for the PC is used by writers and graphics artists working in-house in hi-tech companies, where PCs are used almost exclusively.
#16
Gintaras Wrote:When I click the zoom edit field and press Ctrl+V, it pastes the number in the document, not in the field. Menu of course works. To simulate what the menu does, you can use

When I click the zoom edit field and press Ctrl+V, it successfully pastes the number in the field.

[quote="Gintaras"] s.setsel(0 handle) ;;here s is a string variable containing the text to paste; handle is combo box control handle

What is the zero handle thing?

key- CSAW releases all modifier keys. This not necessary for keyboard macros.
#17
>> I think you don't need to initialize or get name from handle. You can identify the control by id.

>> Function FreehandZoom:

<SNIP>
>> It works with Macromedia Freehand MX 11.

Ok, I have taken your code and tried it out. I took the part that activates the Zoom edit field from the ID, namely:

int handle=id(432 "FreeHand")
act handle
BlockInput 1
key- CSAW
key (s) Y
BlockInput 0

I found that as long as When Released is set, the code works fine. Every time I CTL click while wheeling forward and then release, the Zoom works correctly and reliably.

However, when I clear When Released, the problems start. On the first CTL-fwd, the macro is called but writes 96% to the zoom field, or sometimes 94%. I don't know where 96% or 94% come from. Then, on further CTL-fwd operations, it writes 64% and that's the way it stays for each further CTL-fwd macro call. My own debug statements show that internally everything in the macro is working the way it should be.

When I return to my own way of getting the location of the zoom factor (the user has to teach the macro suite by doing a middle click on the zoom field) then the results are as for your way: with When Released set, then things are fine; with When Released cleared, then things go weird.

So it is the CTL that is causing the problems.

I vaguely remember that at some point in my test I got the warning message in the QM out area that if When Released is cleared then I could have problems with the macro interrupting normal operation -- or maybe it was that normal operation could interrupt the macro -- anyway I don't remember because I found I could not always repeat the message at will.

So it seems your FreeHand is not working the same as mine.

So do you have any more ideas?

Well, we still have done pretty well. I can now do a smooth zoom in and out, and a coarse zoom as long as I release the CTL button for every wheel roll, which is not so bad when you think that +/-100% zoom is a lot.

Alternatively, I could trap a function key (that FH does not use by default, e.g., F12) and use it to raise and lower the zoom increment/decrement factor, and all zooming will be done by a simple roll and the current zoom factor.

Btw, the FreeHand I am using is a local adaptation of v9.0.2, an English+Hebrew version developed here in Israel in collaboration with Macromedia. I am running on a ThinkPad T30 XP 2002 (SP 0, I think).

Regards,

Avraham
#18
This version does not use keys, and Ctrl should not interfere.

Code:
Copy      Help
;/
function size action ;;action: 0 set, 1 add, -1 sub

int handle=id(432 "FreeHand")
str s
if(action)
,s.getwintext(handle)
,int i=val(s)
,if(action>0) size=i+size
,else size=i-size
s=size
act handle
s.setsel(0 handle)
SendMessage(handle WM_KEYDOWN VK_RETURN 0)
#19
[quote="Gintaras"]This version does not use keys, and Ctrl should not interfere.

BINGO! IT WORKS!!!

I don't know whether to kiss you or to strangle you - I have been working on this for ages.

Question: in this code segment, what are the commas at the start of the lines?

if(action)
,s.getwintext(handle)
,int i=val(s)
,if(action>0) size=i+size
,else size=i-size

Were they really tabs? (No, I didn't use that part of the code.)

Question: The 0 in s.setsel(0 handle) is a null format specifier? You don't need commas in QM API?

Question: In the parameter list in the statement
int handle=id(432 "FreeHand")"
wouldn't it be more appropriate for the (parent) app name (i.e., "FreeHand") to come first (i.e., on the left) before the child handle number rather than the other way around.


Btw, that QM GUI feature for displaying the Win ID numbers of app controls under the mouse is really great.

Btw, I noticed that online help did not always represent how a feature actually worked. Maybe it's a bit old here and there.

The name Quick Macros, when you get to know it, doesn't really do justice to your app. I would suggest "Macro Manager". But maybe Quick Macros is more attractive from a sales point of view.

Ok, now to get back to my real job and carry on earning a living...

Thanks,

Avraham
#20
Quote:I don't know whether to kiss you or to strangle you

how 'bout just buy him a coffee :lol:
#21
Hi,

Resuming this thread, if I may:

Now that we have succedded in providing mouse wheel zoom for FreeHand (a fantastic achivement that should interest all PC FreeHand users) I remembered that Adobe Acrobat 5, this being the version of Acrobat that I have, also does not have built-in wheel zoom. So I ran QM and moved the mouse pointer over Acrobat's zoom field to find out what its Id number is and I see that the QM status display (at the bottom) shows that Id=0, along with the rest of the controls on the toolbar. (A discovery that is itself worthy of some comment?)

Well, just to see what happens, I tried on Acrobat the same code we wrote for the FreeHand, but instead of:

int handle = id(432, "FreeHand 9")

I write:

int handle = id(0, "Adobe Acrobat")

And no surprises here in that the idea does NOT work. So any solutions for Acrobat 5? Or will I have to write our Wheel Zoom to handle two modes: a 'clever' mode and a 'teach QM' mode where at each run of Acrobat (and also each time you resize Acrobat's app window) you have to tell Wheel Zoom the X-Y coords of the Zoom edit field?

ken gray Wrote:
Quote:I don't know whether to kiss you or to strangle you

how 'bout just buy him a coffee :lol:

So if you ever come to Israel, look me up and I will buy the coffees (or maybe add a checkbox in the QM purchase area for buying coffee for Gintaras...)

tia

avraham
#22
I have only Adobe Reader 6. Ctrl/Shift/Alt+wheel also does not work. The zoom field also has 0 id. But it is the only control with RichEdit20A class.

int hwnd=child("" "RichEdit20A" "Adobe Reader -" 0x5)

Also, I can use menu View -> Zoom To (Ctrl+M).
#23
Gintaras Wrote:I have only Adobe Reader 6. Ctrl/Shift/Alt+wheel also does not work. The zoom field also has 0 id. But it is the only control with RichEdit20A class.

int hwnd=child("" "RichEdit20A" "Adobe Reader -" 0x5)

Also, I can use menu View -> Zoom To (Ctrl+M).


Thanks.
In Acrobat, the class, as you call it, is "Edit".

Good point about the View->Zoom <embarrassed chuckle>.
I am concerned about the time taken to display menu+dialog box each time I roll the wheel to do a smotth scroll.

My Ctrl+M has ben taken over by an add-in. I will have to find if/how I can restore it.

Question: How do I get the name of the application that currently has the focus? (Obviously I will need this info to properly control the zooming for each app.)

Thanks,

Avraham
#24
str s
s.getwinexe(win)
;out s
sel s 1
,case "prog1"
,...
case "prog2"
,...
...
#25
Code:
Copy      Help
spe
men 6068 "Adobe" ;;Zoom To... Ctrl+M
wait 10 "Zoom To"
key "100" Y
#26
Gintaras Wrote:
Code:
Copy      Help
spe
men 6068 "Adobe" ;;Zoom To... Ctrl+M
wait 10 "Zoom To"
key "100" Y

Thanks - for both answers.
#27
Hi! remember me?!

Well I have finally got around to actually using the Freehand zooming utility you helped me to write. So one issue has come up:

Although I can now do a repeated CTL+Wheel F/B without ever releasing the Control button, if I modify the Control button using a SHIFT or ALT then I get back to the same situation, i.e., I first have to release the modifier button in order to get QM to recognize the it at the next mouse wheel action. If I do not release the button, then only the CTL is recognized and the macro servicing CTL+Wheel is invoked.

So, again, how do I get CTL+ALT Wheel to work continuously without taking my finger off the ALT button?

tia

Avraham




amakeler Wrote:[quote="Gintaras"] This version does not use keys, and Ctrl should not interfere.

BINGO! IT WORKS!!!

I don't know whether to kiss you or to strangle you - I have been working on this for ages.

Question: in this code segment, what are the commas at the start of the lines?

if(action)
,s.getwintext(handle)
,int i=val(s)
,if(action>0) size=i+size
,else size=i-size

Were they really tabs? (No, I didn't use that part of the code.)

Question: The 0 in s.setsel(0 handle) is a null format specifier? You don't need commas in QM API?

Question: In the parameter list in the statement
int handle=id(432 "FreeHand")"
wouldn't it be more appropriate for the (parent) app name (i.e., "FreeHand") to come first (i.e., on the left) before the child handle number rather than the other way around.


Btw, that QM GUI feature for displaying the Win ID numbers of app controls under the mouse is really great.

Btw, I noticed that online help did not always represent how a feature actually worked. Maybe it's a bit old here and there.

The name Quick Macros, when you get to know it, doesn't really do justice to your app. I would suggest "Macro Manager". But maybe Quick Macros is more attractive from a sales point of view.

Ok, now to get back to my real job and carry on earning a living...

Thanks,

Avraham
#28
Hi,

QM has been working great for my use, thanks very much. I have been using version QM 2.3.1.9 doing automated input to input fields of various IE web pages and in the Outlook mail creation page.

outp works fine when IE/Outlook are running on some XP systems but not on some others. When it does not work, it inputs nothing into the field or the mail creation page. On these non-working systems I already checked to confirm that I could cut/paste text fine in notepad.exe. I assume this would mean the clipboard functionality is functioning...

a) Does the clipboard work differently in IE and Outlook?

b) What else I should check?

c) I tried to use SetText() to assign the field content but that does not work for some fields on all systems, anything I can do differently with SetText() so it would work for all input fields?

Thanks in advance.

Joe
#29
proberly diffrent i.e versions.
#30
I don't think that clipboard works differently in IE and Outlook. Does outp work in other programs on that computers?

SetText works not with all input fields.

Try this function instead of outp. Does it work?

Function outp22
Code:
Copy      Help
;/
function str'text

;Stores text into clipboard and presses Ctrl+V.


spe -1
text.setclip
key Cv


Forum Jump:


Users browsing this thread: 8 Guest(s)