Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Background processing : a definitive clarification
#1
Hi Gintaras, hi all,

Gintaras, we talked about that many times in previous help asking from my side, but I have really a hard understanding this one:
How tell QM to do a process in background, i.e, the function does it job independently from caller macro or function.

For example, I setup this to automate some tasks at USB disk insertion :

1. When disk is inserted, function DisqueMontéDémonté is triggered.

Quote:Macro DisqueMontéDémonté
Code:
Copy      Help
function event $name [$newname]
;event: 1 added, 2 removed, 4 renamed, 8 modified
_s=name
sel event
,case [8]:
,int attr=GetFileAttributesW(@F"{name}"); if(attr=-1) end "failed, %s" 0 _s.dllerror
,if(attr&FILE_ATTRIBUTE_REPARSE_POINT) CopierUSB(_s)

2. On certain conditions, function CopierUSB is launched:

Quote:Function CopierUSB
Function CopierUSB
Code:
Copy      Help
function str'&Nom
out
_s=Nom

.... some code


if(mes(F"Déplacer les fichiers vers ''{Dest}''?" "" "YN?") != 'Y') ret
LanceLaCopieUSB(Dest)

3. If I answer yes to last message box, function LanceLaCopieUSB is launched.

Quote:Function LanceLaCopieUSB
Code:
Copy      Help
function str&ff
run "C:\Program Files\TeraCopy\TeraCopy.exe" F"Move *q:\liste.txt ''{ff}'' /SkipAll" "" "" 0x10400
All 3 functions should run "in background", i.e not block other triggers, as my QM tray icon is red and I can't interact with other trigger while
the previous insertion disc cascading macros are over.

Hope your explanation will be clear enough so I won't ask again, and maybe will help others QM junkies too.

Thanks.
#2
DisqueMontéDémonté should be function, not macro.
#3
Then, if DisqueMontéDémonté is now a function,
would

DisqueMontéDémonté (launched as function) the same as mac "DisqueMontéDémonté" (is still a macro)??
#4
Not the same. Depends on item type, not on how launched.
#5
OK, then i'll stand to the simple:

Macro : launches, waits for all threads to terminat and then ends
Functions : launches and quit...


Forum Jump:


Users browsing this thread: 1 Guest(s)