Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
filing qm object
#1
I don't know whether this should be in the "Wish List" or here so i'll put it here for now and you can move it if you wish.

I have about 200 macros and have several main folders that i'd like to dump macros into once i move them out of testing and into production. is there a way to move a macro into a folder programatically? if so i'd love to put that into the context menu (ie right-click) with several of my folders as options.
An old blog on QM coding and automation.

The Macro Hook
#2
Function QmItemMoveToFolder
Code:
Copy      Help
;\
function $folder

;Moves a macro to the folder.
;EXAMPLE
;QmItemMoveToFolder "\New\Users new"



def TVM_SELECTITEM (TV_FIRST + 11)
def TVGN_CARET 9

QMITEM q qc
int idf=qmitem(folder 0 q); if(!idf or q.itype!=5) mes- "folder not found"
int idcurr=qmitem("" 0 qc)

str s.format("Click the item within 10 s" folder)
OnScreenDisplay s 1
wait 10 ML ;err ret

Acc a=acc(mouse)
if(a.Role!=ROLE_SYSTEM_OUTLINEITEM) ret
;s=a.Name
;int iid=qmitem(s


int tv=id(2202 _hwndqm)
key Cx
SendMessage tv TVM_SELECTITEM TVGN_CARET q.htvi
key Cv
int h=wait(1 WA win("Quick Macros" "#32770" "" 0x401)); err ret
but 6 h
SendMessage tv TVM_SELECTITEM TVGN_CARET qc.htvi
SendMessage tv TVM_SELECTITEM TVGN_CARET q.htvi
SendMessage tv TVM_SELECTITEM TVGN_CARET qc.htvi
#3
thanks...works great.
An old blog on QM coding and automation.

The Macro Hook
#4
im now running 2.1.9.1 and this macro fails due to "Error in QmItemMoveToFolder: this name already exists." and highlights this line below.

Code:
Copy      Help
def TVM_SELECTITEM (TV_FIRST + 11)

can you take a look at it?

thanks so much.

Ken
An old blog on QM coding and automation.

The Macro Hook
#5
Remove this line. It is not necessary. The error is because somewhere (not in System) TVM_SELECTITEM is defined slightly differently, eg WM_USER+11, or somewhere is used WINAPI.TVM_SELECTITEM or WINAPI2.TVM_SELECTITEM.

In next QM version I'll try to change def and ref behavior to avoid such conflicts.
#6
Thanks!

note: it also errored out on the line below it (same error), so i commented it out as well and it works just fine.
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)