Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 1,001
» Latest member: MacroMarco
» Forum threads: 6,347
» Forum posts: 34,248

Full Statistics

Online Users
There are currently 6 online users.
» 0 Member(s) | 6 Guest(s)

Latest Threads
Limit OpenSaveDialog to a...
Forum: General
Last Post: Gintaras
2 hours ago
» Replies: 1
» Views: 20
Dialog Style
Forum: General
Last Post: Gintaras
Yesterday, 06:21 AM
» Replies: 1
» Views: 60
Match word letter by lett...
Forum: General
Last Post: Gintaras
01-19-2018, 04:29 PM
» Replies: 1
» Views: 38
Running macro on backgrou...
Forum: General
Last Post: Gintaras
01-15-2018, 01:08 PM
» Replies: 2
» Views: 202
Find, click in search res...
Forum: Wish List
Last Post: r0n
01-15-2018, 10:38 AM
» Replies: 2
» Views: 63
Background send message, ...
Forum: General
Last Post: ilya1111
01-08-2018, 06:07 PM
» Replies: 2
» Views: 292
Hotkeys doesnt work
Forum: Bug Reports
Last Post: Gintaras
01-07-2018, 07:50 AM
» Replies: 1
» Views: 77
find only first image
Forum: General
Last Post: ilya1111
01-04-2018, 01:00 PM
» Replies: 3
» Views: 151
wait for image problem
Forum: General
Last Post: john_b
12-28-2017, 08:42 PM
» Replies: 1
» Views: 95
Values Populated in Incor...
Forum: Programming
Last Post: philipq
12-28-2017, 05:42 AM
» Replies: 5
» Views: 163

 
  Remove Carriage Line - copying from Excel
Posted by: frank - 12-20-2017, 05:25 PM - Forum: General - Replies (2)

I have a macro that copies excel cell then getclip to variable.

When I 'key' this variable it has a carriage return.

How can I strip out the carriage return?

Print this item

  Running macro on background
Posted by: tatsuoshu - 12-19-2017, 06:35 PM - Forum: General - Replies (2)

Hello,

I'm trying to make a macro that works on an application (game) and can run on the background. I've found some threads with the "SendKeyToWindow" function, however I can't get it implemented. The problem is that it works perfectly if I'm in a typing environment (like the chat in the game), but it doesn't do anything outside that environment (for example moving the target).
Does anyone has any ideas?
Below is the macro and the SendKeysToWindow function:

Macro

Code:
int w=act(win("APPLICATION_NAME" "D3D Window"))
rep
    SendKeysToWindow2 w key(6)
    SendKeysToWindow2 w key(V)
    SendKeysToWindow2 w key(V)
    SendKeysToWindow2 w key(V)
    wait 5

key(6) refers to an action and key(V) refers to pressing space.

Function
Code:
/
function hwnd ARRAY(KEYEVENT)'a

Sends keys to a child window using WM_KEYDOWN/WM_KEYUP messages.
The window can be inactive, but with some windows then does not work.

hwnd - child window handle. Or main window handle, if it receives keys.
a - the <help>key</help> function.

EXAMPLE
int hwnd=id(15 "Notepad")
SendKeysToWindow2 hwnd key("text[]" Cs)


int i lparam m up alt ati
str sk
ifk(A) alt=1

for i 0 a.len
    KEYEVENT k=a[i]
    if(k.flags&0x80) i+1; continue ;;wait
    sel(k.vk)
        case [16,17,18]
        int th1=GetCurrentThreadId
        int th2=GetWindowThreadProcessId(hwnd &i)
        ati=AttachThreadInput(th1 th2 1)
        sk.all(256)
        0.01
        break

for i 0 a.len
    k=a[i]
    
    if(k.flags&0x80) ;;wait
        i+1
        opt waitmsg -1
        wait (a[i].wt/1000.0)
        continue
    
    lparam=k.sc<<16|1
    if(k.flags&KEYEVENTF_EXTENDEDKEY) lparam|0x01000000
    if(k.flags&KEYEVENTF_KEYUP) lparam|0xC0000000; up=1; else up=0
    
    if(alt) m=iif(up WM_SYSKEYUP WM_SYSKEYDOWN); lparam|0x20000000
    else m=iif(up WM_KEYUP WM_KEYDOWN)
    
    if(k.vk=VK_RETURN) 0.01 ;;some controls, eg PSPad, would insert new line too early
    
    PostMessage hwnd m k.vk lparam
    0.01
    
    sel(k.vk)
        case [16,17,18] ;;modifier keys
         wait while processes prev keys
        if(i) SendMessage hwnd 0 0 0
        0.01
        
        GetKeyboardState sk
        sk[k.vk]=iif(up 0 0x80)
        SetKeyboardState sk
    
    if(k.vk=VK_MENU) alt=!up

if(ati) ati=AttachThreadInput(th1 th2 0)

Print this item

  Press and release trigger
Posted by: ilya1111 - 12-17-2017, 12:22 PM - Forum: General - Replies (2)

Hello.
Today my question is not stupid)
Can I make a trigger that would run the macro1 when I press the space key and macro2 when I release the space key?
How to do it?
Thx.
Love this forum)

Print this item

  Automated Catch on Game
Posted by: Trance-Man - 12-17-2017, 12:50 AM - Forum: General - Replies (1)

Online game: FishAO (This videos shows full example: youtube.com/watch?v=mkbrILC87K0)

Create automation to move keyboard keys, (left and right arrow keys) depends on which way I need to move left and right keyboard keys to keep my target in the middle of these two images. Once catching a fish... the fish pulls from left to right on screen, I need to move to keep the blue (on top and bottom of image attached) icon/indicator towards the middle.

Some help would be very much appreciated.

   
   

Print this item

  wintest when name is empty
Posted by: ssimop - 12-16-2017, 02:50 AM - Forum: General - Replies (4)

I understand that when in wintest window name is empty it implies "accept all". There exists a case of a third party application using an empty class #32770 window. I am in need to check in a filter function, namely :
Function FF_FlashFol_v0

Code:
;/
;Allows starting macro only in certain window.
function# iid FILTER&f
_s.getwintext(f.hwnd)
if(empty(_s)) ret iid
;if(wintest(f.hwnd "" "#32770")) ret iid

I concluded to this workaround. I wonder whether I can still use wintest somehow.
Many thanks in advance for any suggestion.

Print this item

  Writing string to file from Array.
Posted by: ScottF - 12-15-2017, 09:54 PM - Forum: Programming - Replies (1)

I am trying to setfile a str.
Not sure why it's not working. Code - output - and file, below:

CODE:
Macro Macro7

Code:
out
ARRAY(int) a; int i; str sc sn
out "[][9]ALL VISIBLE WINDOWS"
win("" "" "" 0 0 0 a)
for(i 0 a.len)
,sc.getwinclass(a[i])
,sn.getwintext(a[i])
,out "%i '%s' '%s'" a[i] sc sn
,sn.setfile("C:\wn.txt" 0 -1)

OUTPUT:

Start

QM TOOLBAR
Quick Macros - Main - [Macro6]
QM Help
Quick Macros Forum • Index page - Google Chrome
Local Disk (CSmile
UT
OC
Program Manager

FILE:

Program Manager

Print this item

  Filter Function for HID Device
Posted by: Jahandar - 12-13-2017, 05:09 AM - Forum: Wish List - Replies (2)

Would be great to create a filter function based on the USB HID device ID, so that pressing a trigger on one keyboard/mouse does one function, whereas pressing the same trigger on a different keyboard/mouse does a different function. Maybe someone has already written a template for this?

Print this item

  Screen edge tapping trigger
Posted by: Valentin - 12-12-2017, 07:27 AM - Forum: General - Replies (2)

Hello,

Can we use double edge tapping with mouse in a certain region as a trigger.

Thank you.

Print this item

  Changing Title for a OpenSaveDialog
Posted by: ScottF - 12-11-2017, 04:22 PM - Forum: Programming - Replies (3)

Hi Gintaras, I am looking for a way to customize Title for a OpenSaveDialog.
I see where you have:
Function OpenSaveDialog

Code:
;save - dialog type: 0 - "Open", 1 - "Save As".
;s - str variable that receives full path.
;;;If not empty on input:
;;;;;Sets initial content of the file name field.
;;;;;If full path, also sets initial directory.
;;;;;;;QM 2.3.3. Supports $special folders$.
;filter - file types displayed in dialog. Consists of description/pattern string pairs. See examples.
;defExt - default extension. The dialog uses it when the user types a filename without extension and does not select a file type from filter.
;initDir - str variable that sets initial directory and receives selected file's directory.
;;;The function may change the current directory, but if initDir is used, restores it when the dialog is closed.
;title - dialog box title.
;noDereferenceLinks - get path of shortcut file, not its target.
;multi - if used, Open dialog allows to select multiple files, and multi is populated with full paths. s can be 0.
;hwndOwner (QM 2.3.0) - handle of owner window. It will be disabled.
;;;If omitted or 0, will use the active window, if it belongs to current thread. To create unowned dialog, use GetDesktopWindow for hwndOwner.

But i can't find where to change it, if it is able to be modified.
I tried this in my macro:
Macro Macro2
Code:
str s
str sTitle="Pick a Text file"
if OpenSaveDialog(0 s "Text Files[]*.txt" sTitle)
,out s

Thanks in advance for any help.
S

Print this item

  Help to activate and close the correct folder.
Posted by: ScottF - 12-10-2017, 07:57 PM - Forum: Programming - Replies (5)

If I have C:\Windows\System and C:\Windows\SystemApps open,
and I want to activate C:\Windows\System using a string, the code will activate
C:\Windows\SystemApps instead. The string is populated by an input.

So the input is "C:\Windows\System" (No Quotes) and both windows are inactive, When I use the code:
Macro OC

Code:
str s1
int w1=act(win(sFolder "CabinetWClass"))

It always activates C:\Windows\SystemApps instead.
This must be a flaw of windows, but is there a work around?
Need to activate and close the correct folder.
Is there a way to figure out the difference between the two folders for certainty??

Much thanks in advance.

Print this item