Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM file Export Options.
#1
I would like to have QM export it's entire current open project with one click of a button.

Right now I have to create a folder and then move every function, macro, folders, etc into that folder. Then export that folder. Moving files around in QM is very tedious...and I have to do it one by one...unless I missed something?

Usually from there I upload that file to an email composed to myself so I can easily access it from other computers.

It would be nice if I could just click a button that would export everything in my current QM straight to my default email account, or even a different specified account if I am sharing QM files with other people.

It would be helpful to export everything including the system folder because sometimes I make changes there or add in variations on existing functions. When the file is exported, I would like to have the "Open" option enabled. I often use multiple QM files to and open them so I can keep cross clutter down from multiple projects.

Thanks,
Jimmy Vig
#2
Macro Email qm files
Code:
Copy      Help
str my_qml system_qml files tzip

rget my_qml "file" "software\gindi\qm2\settings"
system_qml="$qm$\system.qml"

;save qml and wait while saving
men 2003 _hwndqm ;;Save All Now
0.1
;g1
__HFile f.Create(my_qml OPEN_EXISTING)
err 0.1; goto g1
f.Close

files.from(my_qml "[]" system_qml)
tzip.from("$temp$\" _s.getfilename(my_qml) ".zip")
zip tzip files

SendMail "[email protected]" "" "" 0 tzip
#3
Absolutely perfect Gintaras!

Now I would like to add some stuff that I'm thinking about. What different pieces of information can you get from a qm file with QM?
Like can you get the number of functions...the names of functions? Or anything else?

I was just thinking about populating a the body of the email with information about the qm file so I can use searches in my email to find and organize QM files.

Thanks,
Jimmy Vig
#4
Function GetQmItemNames
Code:
Copy      Help
;/
function $folder str&s [flags] ;;flags: currently not used

;Gets list of QM items in a QM folder and subfolders.
;Folders named "private" and "System" are excluded.

;folder - folder name or path ("\folder1\folder2"). Use "" to include all macros.
;s - variable that receives the list.


type __GQIN_DATA str*sp str'st level flags htv
__GQIN_DATA d.sp=&s
d.flags=flags
d.htv=id(2202 _hwndqm)
s.len=0

EnumQmFolder folder 1 &GQIN_Enum &d

Function GQIN_Enum
Code:
Copy      Help
;/
function# iid QMITEM&q level __GQIN_DATA&d

int i r f=q.itype=5

;skip some folders
if(f)
,sel(q.name) case ["private","System"] r=1; goto g1
,if(!SendMessage(d.htv TVM_GETNEXTITEM TVGN_CHILD q.htvi)) r=1; goto g1

d.st.all(level 2 '.') ;;indentation

if(f) d.sp.formata("%s[%s][]" d.st q.name)
else d.sp.formata("%s%s[]" d.st q.name)

;g1
d.level=level
ret r

example
Macro Macro1288
Code:
Copy      Help
out
str s
GetQmItemNames "" s
out s
#5
Wow...again absolutely beautiful.

Function QM_Export
Code:
Copy      Help
ARRAY(str) QMfunctions
QMITEM q; int i
rep
,i=qmitem(-i 2 &q 1|16|128)
,if(i=0) break
,str date=q.datemod
,str name=q.name
,_s.format("%-30s %-30s" date name)
,QMfunctions[]=_s
out QMfunctions

Anyway you could tag the datemod at the end of your example. I can't figure out how the nitty gritty works for yours. I got it to work in mine, but I like how yours has the folder names in brackets and the level indicated by dots.

Thanks bunches,
jimmy Vig
#6
Your code is faster.
Macro Macro1293
Code:
Copy      Help
out
ARRAY(str) QMfunctions
QMITEM q; int i j f
rep
,i=qmitem(-i 2 &q 1|16|128)
,if(i=0) break
,str date=q.datemod
,str name=q.name
,f=q.itype=5
,
,;indentation
,for(j 0 1000000000) if(!q.folderid or !qmitem(q.folderid 0 q 16)) break
,str si.all(j 2 '.')
,
,if(f) _s.format("%-30s %s[%s]" date si name)
,else _s.format("%-30s %s%s" date si name)
,QMfunctions[]=_s
out QMfunctions
#7
Here's what I've got worked up...works just how I want it to now. Thanks Gintaras!
Function QM_Export
Trigger @11     Help - how to add the trigger to the macro
Code:
Copy      Help
str email="[email protected]";;enter recieving email address


str my_qml system_qml files tzip subject body

rget my_qml "file" "software\gindi\qm2\settings"

system_qml="$qm$\system.qml"

;save qml and wait while saving
men 2003 _hwndqm ;;Save All Now
0.1
;g1
__HFile f.Create(my_qml OPEN_EXISTING)
err 0.1; goto g1
f.Close

files.from(my_qml "[]" system_qml)
tzip.from("$temp$\" _s.getfilename(my_qml) ".zip")
zip tzip files
_s=my_qml
_s.getfilename
subject.timeformat("{D} {TT}")
subject.from(_s " " subject)

ARRAY(str) QMfunctions
QMITEM q; int i j k
rep
,i=qmitem(-i 2 &q 1|16|128)
,if(i=0) break
,str date=q.datemod
,str name=q.name
,k=q.itype=5
,
,;indentation
,for(j 0 1000000000) if(!q.folderid or !qmitem(q.folderid 0 q 16)) break
,str si.all(j 2 '.')
,
,if(k) _s.format("[%s%s]" si name)
,else _s.format("  %-30s %s%s" date si name)
,QMfunctions[]=_s

body=QMfunctions

SendMail email subject body 0 tzip
#8
QM item/folder structure will be incorrect after adding new items.
Better use GetQmItemNames.


Forum Jump:


Users browsing this thread: 1 Guest(s)