Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ressource in macro, not exe
#1
Hi Gintaras, hi all

after reading QM reference, i'm not sure if i can attach an exe file to a macro, to preserve a certain version of this exe, and preventing
code failure when software is uptaded; it's a portable exe btw

It's the opposite of binding file resource to an QM exe...

I read about icons and image files, but nothing about exe file.

If yes, is it availbale as image resource, via resource:xxx syntax?

ty
#2
In Resources dialog:
Click the Add link and import the exe file.
Click the imported exe link and select menu item Insert name in code -> String or comments.
It inserts code like this:
Code:
Copy      Help
;"resource:<Macro274>csc.exe"
You can remove the <Macro274> part if the resource belongs to the same macro.

Many QM file functions support such strings. For example, use str.getfile to get file data:

Code:
Copy      Help
str s
;get exe file data from macro resources
s.getfile("resource:csc.exe")
;save as file
s.setfile("$temp$\csc.exe")
#3
cool, ty
#4
hmmm

function $files
"resource:<MKV>mkvmerge.exe"
str s
get exe file data from macro resources
s.getfile("resource:<MKV>mkvmerge.exe")
out s

MZЍ
MZЍ
MZЍ


something's wrong...
#5
This is what you should see when using out with binary data.
Function outb displays bytes in hex, optionally with text.
#6
i fully understand that, but s is supposed to be the exe name, so passed to function, no?

<so, there, it sys as expected that exe is missing or not found....
#7
Macro Macro274
Code:
Copy      Help
str s
;get exe file data from macro resources
s.getfile("resource:csc.exe")
;what is exe size?
out s.len
;save as file
s.setfile("$temp$\csc.exe")
;file exists?
out FileExists("$temp$\csc.exe") ;;says 1
#8
ok, seems i misunderstood the way you tell me to use it.

In fact, you show how to store it in macro, Qm can't use it as stored resource in the macro directly, must save it to disk, use the extracted exe, and then i
must delete it at the end of use of it.

Sorry, my bad, did not understand properly the proper way to do....i wanted the resource exe to be usable directly from the macro it's binded to...
#9
OS does not allow to execute exe and dll files directly from memory. Need a temporary file.
#10
Acknowledged, thread closed
#11
How can I get the full path from $temp$\csc.exe?
#12
Found it:
 
Code:
Copy      Help
 
str v1
v1 = "$temp$\banorte_logo_slim.jpg"
out v1.expandpath


Forum Jump:


Users browsing this thread: 1 Guest(s)