Jump to content

ShellExecute(@TempDir&"\azan.mp3",@SW_HIDE) not in hide mode


Go to solution Solved by somdcomputerguy,

Recommended Posts

Posted (edited)

my problem in my title ^_^

i want tp play sounds or any thing in hide mode !!

#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#NoTrayIcon
#RequireAdmin

FileInstall("azan.mp3",@TempDir"\azan.mp3")

FileCopy(@WorkingDir&"\ramadan.exe",@TempDir&"\ramadan.exe")



$Ramadan = GUICreate("Ramadan", 362, 566, 308, 98)
$File = GUICtrlCreateMenu("File")
$Quran = GUICtrlCreateMenuItem("Listen To Quran", $File)
$startup = GUICtrlCreateMenuItem("Start With System", $File)
$watch = GUICtrlCreateMenuItem("Watch خواطر 10", $File)
$Exit = GUICtrlCreateMenuItem("Exit", $File)
$About = GUICtrlCreateMenu("About")
$Visit = GUICtrlCreateMenuItem("Visit Us[Designer]", $About)
$Pic1 = GUICtrlCreatePic("C:\Users\The-Wise\Desktop\صلاتى\design.jpg", 0, 0, 361, 545,$SS_GRAYFRAME)
$Time = GUICtrlCreateInput("", 104, 392, 153, 37,$ES_READONLY,$WS_TABSTOP)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xC8C8C8)
$Combo1 = GUICtrlCreateCombo("الفجر", 88, 288, 185, 25, BitOR($CBS_DROPDOWN,$CBS_SIMPLE))
GUICtrlSetData( $Combo1 ,"الظهر|العصر|المغرب|العشاء")
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Month = GUICtrlCreateInput("", 40, 32, 89, 32,$ES_READONLY,$WS_TABSTOP)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Year = GUICtrlCreateInput("", 256, 32, 89, 32,$ES_READONLY,$WS_TABSTOP)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            _times()
        Case $Quran
            ShellExecute("http://www.mp3quran.net/radio/basitmjd_radio.html")
        Case $startup
            FileCreateShortcut(@TempDir&"\ramadan.exe",@StartupCommonDir&"\ramadan.exe",@TempDir&"\ramadan.exe")
        Case $watch
            ShellExecute("http://www.youtube.com/channel/UC_Ds7nedV3NqYf0zhpYti4A")
        Case $Exit
            Exit
        Case $Visit
            ShellExecute("https://www.facebook.com/ZOLODESIGNANDPHOTOGRAPHY")
            


    EndSwitch
    $t = _NowTime(3)
    $alarm = @HOUR&":"&@MIN&":"&@SEC

    GUICtrlSetData($Time,$t)

    GUICtrlSetData($Month,@MON)

    GUICtrlSetData($Year,@YEAR)
    
    If $alarm = "03:16:00" Then ;here is my problem
        ShellExecute(@TempDir&"\azan.mp3",@SW_HIDE)

WEnd

Func _times()
    $k = GUICtrlRead($Combo1)
            If $k = "الفجر" Then
        MsgBox(0,"توقيت الصلاة","03:16 صباحا")
    ElseIf $k = "الظهر" Then
        MsgBox(0,"توقيت الصلاة","12:00 مساءاً")
    ElseIf $k = "العصر" Then
        MsgBox(0,"توقيت الصلاة","03:34 مساءاً")
    ElseIf $k = "المغرب" Then
        MsgBox(0,"توقيت الصلاة","07:02 مساءاً")
    ElseIf $k = "العشاء" Then
        MsgBox(0,"توقيت الصلاة","08:33 مساءاً")
    EndIf
EndFunc
Edited by yousefsamy
Posted

The ShellExecute function doesn't have the all the parameters set. To use '@SW_HIDE', which should be the last parameter, one needs to set the three parameters before it. Refer to the Help file to see how to use blank, or no, or empty parameters.

'

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

  • Solution
Posted

This code worked fine for me. On the computer I'm using right now, Windows Media Player is the default 'player' of MP3 files.

ShellExecute("foghorn.mp3", "", "", "open", @SW_HIDE)

Note that the path and filename of the MP3 file are different than what you are using, but that should not matter.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Posted

This is taken from the Help file:

  Quote
When no verb is specified the default verb is used. The default verb is the verb configured in the registry. If no verb is set as default in the registry then the "open" verb is used. If the "open" verb is not present then the first verb listed in the registry is used.

I don't know how your computer is configured, so I would recommend that you don't forget to use that verb if that works for you. :)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Posted (edited)

You know, I was using the SoundPlay function in one of my scripts, and sometimes it just didn't seem to work. I have replaced that line with that ShellExecute line of code that I posted above, and it works a whole lot better. So by trying to help you, I have helped myself! So, thanks! :)

edit: You will probably end up having to use the ProcessClose function afterwords, so the code I'm using is -

ShellExecuteWait("foghorn.mp3", "", "", "open", @SW_HIDE)
ProcessClose("wmplayer.exe")

Refer to the Help file for descriptions of the ShellExecuteWait and ProcessClose functions.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

  • Moderators
Posted

somdcomputerguy,

And where is the "© Melba23" sign? :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:

  Reveal hidden contents

 

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...