Quinch Posted June 7, 2012 Share Posted June 7, 2012 Are there any guides on how to embed resources, such as additional icons or sound files, into the compiled .exe? I've looked at the example in the compiler, but I lack context for nearly all of it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 7, 2012 Moderators Share Posted June 7, 2012 Quinch,SciTE4AutoIt3 Help <SciTE Help - Extra Utilities - AutoIt3Wrapper - Adding Extra Ico's to the program resources>. M23 JScript 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Quinch Posted June 7, 2012 Author Share Posted June 7, 2012 That's what I meant. It's all kind of gibberish to me {plus the example script doesn't seem to work even with fixed paths, might be system differences?} The #AutoIt3Wrapper_Res_Icon_Add or File lines seem self-explanatory enough, but how do I subsequently call on those resources? For example, let's say I want to include cheese.ico, crepes.ico and abettermousetrap.ico as well as the Iamafish.mp3 in the executable, and then use TraySetIcon and SoundPlay to put them to use at an unspecified point in the script - how exactly do I refer to each of them? Link to comment Share on other sites More sharing options...
JScript Posted June 7, 2012 Share Posted June 7, 2012 Call like this:; First one will have number 3, then 4 ..etc #AutoIt3Wrapper_Res_Icon_Add=.ResourcesIconAbort.ico ; number 3 #AutoIt3Wrapper_Res_Icon_Add=.ResourcesIconAbsent1.ico ; 4 #AutoIt3Wrapper_Res_Icon_Add=.ResourcesIconAbsent2.ico ; 5 ;(...) Regards, João carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 7, 2012 Moderators Share Posted June 7, 2012 JScript,No, the first added icon with #AutoIt3Wrapper_Res_Icon_Add will be indexed as -5. Index 0 is the icon set by #AutoIt3Wrapper_Icon and -1 to -4 are filled by the default AutoIt tray icons. Look carefully at the example in SciTE help. M23 JScript 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Quinch Posted June 7, 2012 Author Share Posted June 7, 2012 Eh, no luck. Putting in a simple; #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Res_Icon_Add=Chat Baloon.ico #AutoIt3Wrapper_Res_Icon_Add=Clapper.ico #AutoIt3Wrapper_Res_Icon_Add=Clipboard.ico For $x = 1 To 10 TraySetIcon(@ScriptFullPath, -$x) Sleep(3000) Next Just cycles through the default AU3 icons and settles on the default one until the script finishes. Am I missing something obvious? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 7, 2012 Moderators Share Posted June 7, 2012 Quinch, I take it you are compiling the script? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Quinch Posted June 7, 2012 Author Share Posted June 7, 2012 (edited) Aaannnnd there it is. I compiled with the standard "compile script" command - apparently the wrapper completely ignores the includes unless the "compile with options" option is used, so that's the catch. So with that mystery solved, how do I refer to other types of included resources, like sounds in this case? Edited June 7, 2012 by Quinch Link to comment Share on other sites More sharing options...
JScript Posted June 7, 2012 Share Posted June 7, 2012 (edited) @Melba23Then there were changes and I had not seen yet, because these sentence I pulled out my SciTE help:;Add extra ICO files to the resources which can be used with TraySetIcon(@ScriptFullPath, 3) etc ; list of filename of the Ico files to be added, First one will have number 3, then 4 ..etc ; #AutoIt3Wrapper_Res_Icon_Add=Filename of ICO to be added.Thanks for your information!Regards,João Carlos. Edited June 7, 2012 by JScript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 7, 2012 Moderators Share Posted June 7, 2012 Quinch, When I run your code with my icons it works perfectly. Are you sure that you are adding the icons? Can you check with ResHacker? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Quinch Posted June 7, 2012 Author Share Posted June 7, 2012 @Melba: See a couple posts above. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 7, 2012 Moderators Share Posted June 7, 2012 (edited) Quinch,Sorry, missed that the first time round (although I now realise it was not there!). M23Edit: For sounds, look on the same SciTE Help page, but scroll down the icon code a bit to see Example 2. Edited June 7, 2012 by Melba23 Added sound advice Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JScript Posted June 7, 2012 Share Posted June 7, 2012 This example works for me:#AutoIt3Wrapper_Compression=n #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Icon_Add=1.ico #AutoIt3Wrapper_Res_Icon_Add=2.ico #AutoIt3Wrapper_Res_Icon_Add=3.ico #AutoIt3Wrapper_Res_Icon_Add=4.ico #AutoIt3Wrapper_Res_Icon_Add=5.ico For $x = 5 To 9 TraySetIcon("Test.exe", -$x) Sleep(2000) Next Regards, João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Quinch Posted June 8, 2012 Author Share Posted June 8, 2012 @Melba: Yeah, but again there's no explanation or context. The example goes ; Example 2 #AutoIt3Wrapper_Res_File_Add=C:WINDOWSMediatada.wav, SOUND, MYWAV Global Const $SND_RESOURCE = 0x00040004 Global Const $SND_ASYNC = 1 DllCall("winmm.dll", "int", "PlaySound", "str", "MYWAV", "hwnd", 0, "int", $SND_RESOURCE) DllCall("winmm.dll", "int", "PlaySound", "str", "MYWAV", "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC)) For $n = 1 To 100 Sleep(15) ToolTip("Asynch! " & $n) Next But other than the path to the file itself and some sort of dll call, none of this means anything to me, plus I'm inferring that I can't actually use these embedded files with the actual AutoIt functions. For a simpler solution, is it possible to embed the files on compile, then have the script extract them to a temp folder, call on them as needed and delete on exit? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 8, 2012 Moderators Share Posted June 8, 2012 Quinch,there's no explanation or contextYou have a working code example - how much more do you need? - 1. Use the directive to get the sound file into the exe resource table- 2. Declare the 2 constants (or you could use the values directly)- 3. Make the DllCall when you need the sound. Using ASYNC means your script continues as the sound plays - omitting it means the script pauses until the sound endsSeems pretty simple to me. If you want to load the sound files into the exe, extract them to a folder, and then play them directly - take a look at FileInstall and SoundPlay in the Help file. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
UEZ Posted June 8, 2012 Share Posted June 8, 2012 @Melba: Yeah, but again there's no explanation or context. The example goes ; Example 2 #AutoIt3Wrapper_Res_File_Add=C:WINDOWSMediatada.wav, SOUND, MYWAV Global Const $SND_RESOURCE = 0x00040004 Global Const $SND_ASYNC = 1 DllCall("winmm.dll", "int", "PlaySound", "str", "MYWAV", "hwnd", 0, "int", $SND_RESOURCE) DllCall("winmm.dll", "int", "PlaySound", "str", "MYWAV", "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC)) For $n = 1 To 100 Sleep(15) ToolTip("Asynch! " & $n) Next But other than the path to the file itself and some sort of dll call, none of this means anything to me, plus I'm inferring that I can't actually use these embedded files with the actual AutoIt functions. For a simpler solution, is it possible to embed the files on compile, then have the script extract them to a temp folder, call on them as needed and delete on exit? Have a look here for another way to Play a wave file from memory example. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Quinch Posted June 8, 2012 Author Share Posted June 8, 2012 Well, to break it down;#AutoIt3Wrapper_Res_File_Add=C:WINDOWSMediatada.wav, SOUND, MYWAVThe directive and the path are straightforward enough, but what's the purpose of the the SOUND and MYWAV parameters?Global Const $SND_RESOURCE = 0x00040004From the lines afterwards I'm guessing the $SND_RESOURCE refers to the soundfile embedded in the line above - but why that specific value? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 8, 2012 Moderators Share Posted June 8, 2012 quinch,Stop guessing and look at the code and the SciTE Help file in which you found it: In the SciTE Help file:; Add extra files to the resources #AutoIt3Wrapper_Res_File_Add= ; Filename[,Section [,ResName[,LanguageCode]]] to be addedSo looking at the code:#AutoIt3Wrapper_Res_File_Add=C:WINDOWSMediatada.wav, SOUND, MYWAVwe see that:- Filename = C:WINDOWSMediatada.wav (what we want to hear)- Section = SOUND (hardly surprising!)- ResName = MYWAV (how we refer to the resource later)The next bit of the code:Global Const $SND_RESOURCE = 0x00040004 Global Const $SND_ASYNC = 1You see the Const bit? That indicates that the value concerned is a constant which is usually used in some form of function call - it is easier for us mere humans to understand a textual constant than a "magic number".And now we play the sound:DllCall("winmm.dll", "int", "PlaySound", "str", "MYWAV", "hwnd", 0, "int", $SND_RESOURCE)Call the "winmm.dll" and ask it to run its internal "PlaySound" function on the resource known as "MYWAV" (which we set earlier) which it will find in the "SOUND" section of the resource table (because that is what the constant value means to the DLL).As I mentioned earlier, the script will pause while the sound plays. If we want it continue, we need to use the ASYNC constant as well - we use BitOR to combine them (see the Setting Styles tutorial in the Wiki to see why ). The loop just proves that the script does indeed continue:DllCall("winmm.dll", "int", "PlaySound", "str", "MYWAV", "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC)) For $n = 1 To 100 Sleep(15) ToolTip("Asynch! " & $n) NextClearer now? M23 coffeeturtle and Kiesp 2 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now