Jump to content

Recommended Posts

  • 1 month later...
Posted

I'd like to have embedded icons in my compiled executable, that I can then call in my script to change the tray icon between

Do not want to use a temporary folder and do not use any GUI, only a tray icon.

How do I add the icons into my file for tray use and how do I call them without saving them temporary on the computer?

 

For this you don't need Resources UDF.

Nice similar example is in helpfile for AutoIt3Wrapper:

In Scite4AutoIt3 editor pres Ctrl+F1 and go to Extra Utilities/AutoIt3Wrapper/Adding icons to the program resources

; Example 1
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\au3.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype1.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype2.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype3.ico
#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype-blank.ico
#include <ButtonConstants.au3>
GUICreate("Demo resource ICO's")
$h_Button1 = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)
GUISetState()
For $x = 0 To 9
   $rc = TraySetIcon(@ScriptFullPath, -$x)
   $rc2 = GUICtrlSetImage($h_Button1, @ScriptFullPath, -$x)
   If $x < 5 Then
      TrayTip("Default ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)
   Else
      TrayTip("New ico:" & $x, "TraySetIcon rc:" & $rc & @LF & "GUICtrlSetImage rc:" & $rc2, 3)
   EndIf
   Sleep(2000)
Next
GUIDelete()
  • 2 months later...
Posted (edited)

Hello guys,

im not very familiar with autoit. can u guys help me on that one. the background still is black :(

thanks in advance.

#AutoIt3Wrapper_Res_File_Add=D:\test.jpg, rt_rcdata, TEST_JPG_1

#include <GuiconstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include "resources.au3"

Global Const $SC_DRAGMOVE = 0xF012

HotKeySet("{F11}", "Close")

Func Close()
   Exit
EndFunc

$hGUI = GUICreate("X", 300, 300, -1, -1, BitOR($WS_POPUP,$WS_BORDER), $WS_EX_TOPMOST)
$Pic = GUICtrlCreatePic("", 0, 0, 300, 300)
_ResourceSetImageToCtrl($Pic, "TEST_JPG_1")
GUISetState(@SW_SHOW)

GUICtrlSetState(-1, $GUI_DISABLE)
GUISetBkColor(0x000000, $hGUI)

GUICtrlCreateButton("Sample Button", 10, 10, 100, 30)

While 1
   Switch GUIGetMsg()
Case $GUI_EVENT_PRIMARYDOWN
   _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
   EndSwitch
WEnd
Edited by bazinga
Posted (edited)

>C:program filesautoit3aut2exeaut2exe.exe /in "C:UsersBazingaDesktoptest.au3"
Der Befehl "C:program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
>Exit code: 1    Time: 0.343

in english: The command "C:program" is either wrong or couldnt found.

 

EDIT: its becuz of the space in "C:\Program Files\AutoIt3\Aut2Exe\aut2exe.exe" i guess :s

Edited by bazinga
Posted

i reinstalled autoit to "C:AutoIt" and still same error. i never had problems before. i have absolutely no idea whats going on. maybe theres something wrong in the registry.

  • Developers
Posted (edited)

What version of AutoIt3 did you install?

It seems the double-quotes around the program are missing:

"C:\program files\autoit3\aut2exe\aut2exe.exe" /in "C:\Users\Bazinga\Desktop\test.au3"
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • 3 months later...
Posted

Can anyone help me with this udf?

I follow the examples and it just won't work..  :ermm:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=Phonemes\a.wav, rt_rcdata, A
#AutoIt3Wrapper_Res_File_Add=Phonemes\t.wav, rt_rcdata, T
#AutoIt3Wrapper_Res_File_Add=Phonemes\k.wav, rt_rcdata, K
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


_ResourcePlaySound("A", 0, 1)

 

  • Moderators
Posted

GeekIT,

Firstly, why not save the files as "sound" rather than "rt_rcdata"? That is how Zedna does it in his example in the first post. ;)

Secondly, have you actually included the UDF file in that script? I see no sign of it in the snippet you posted. :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

GeekIT,

Firstly, why not save the files as "sound" rather than "rt_rcdata"? That is how Zedna does it in his example in the first post. ;)

Secondly, have you actually included the UDF file in that script? I see no sign of it in the snippet you posted. :huh:

M23

 

http://www.autoitscript.com/site/autoit-script-editor/downloads/

on this link its not an udf, but an exe. so I wasn't shore, I tried both (include and not)

here is an example of my code:

#include <Resources.au3>

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=Phonemes\a.wav, rt_rcdata, A
#AutoIt3Wrapper_Res_File_Add=Phonemes\t.wav, rt_rcdata, T
#AutoIt3Wrapper_Res_File_Add=Phonemes\k.wav, rt_rcdata, K
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


_ResourcePlaySound("A",0,1)
Edited by GeekIT
  • Moderators
Posted

GeekIT,

Slow down a bit - you are getting confused with inserting and accessing the resources. :wacko:

You need to download and install the full SciTE4Autoit3 package to which you linked (or strictly speaking the AutoIt3Wrapper utility within it) to insert the resources into the executable, but you also need to #include Zedna's Resources UDF to subsequently access them from within your script. Clearer now? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

GeekIT,

Slow down a bit - you are getting confused with inserting and accessing the resources. :wacko:

You need to download and install the full SciTE4Autoit3 package to which you linked (or strictly speaking the AutoIt3Wrapper utility within it) to insert the resources into the executable, but you also need to #include Zedna's Resources UDF to subsequently access them from within your script. Clearer now? :)

M23

 

ok thanks, it works now, I found out that it only works if its compiled to exe...

  • Moderators
Posted

GeekIT,

 

I found out that it only works if its compiled to exe...

Perhaps because it is only when compiled that you have a resource table in which to store and subsequently access the files you wish to use? :whistle:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • 4 weeks later...
Posted

Hello,
I'm new here!

Please answer the question in the code:

 

#AutoIt3Wrapper_Res_File_Add=test.wav, sound, Test

#include <resources.au3>
HotKeySet("{ESC}","ExitCode")


_ResourcePlaySound("Test",1)

While 1

    ;$SoundSate = Some way to know if the sound is still playing  <== How Can i Do this ??

    ; if $SoundSate = <Not playing> then
    ;       MsgBox(0,"","Sound Stopped",1)
    ;       ExitLoop
    ;   EndIf
    Sleep(50)
WEnd



Func ExitCode()
    Exit
EndFunc

Thank you!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...