Leaderboard
Popular Content
Showing content with the highest reputation on 08/24/2016 in all areas
-
I did this just for fun. #include <WinAPI.au3> #include <WinAPIEx.au3> #include <WinAPIMisc.au3> Beep() _Beep(500,1000,50) _Beep(500,1000,30) _Beep(500,1000,10) _Beep(500,1000,5) _Beep(500,1000,3) _Beep(500,1000,1) ;~ Traslated from http://stackoverflow.com/a/19772815 Func _Beep($iFrequency = 500, $imsDuration = 1000, $iVolume = 100);Volume 1 to 100 Local Const $PI = 3.141592653589 Local Const $TAU = 2 * $PI Local Const $iFormatChunkSize = 16 Local Const $iHeaderSize = 8 Local Const $iFormatType = 1 Local Const $iTracks = 1 Local Const $iSamplesPerSecond = 44100 Local Const $iBitsPerSample = 16 Local Const $iFrameSize = Floor($iTracks * (($iBitsPerSample + 7) / 8)) Local Const $iBytesPerSecond = $iSamplesPerSecond * $iFrameSize Local Const $iWaveSize = 4 Local Const $iSamples = Floor($iSamplesPerSecond * $imsDuration / 1000) Local Const $iDataChunkSize = Int($iSamples * $iFrameSize) Local Const $iFileSize = ($iWaveSize + $iHeaderSize + $iFormatChunkSize + $iHeaderSize + $iDataChunkSize) Local Const $sTagWAVHeader = "char ChunkID[4];int ChunkSize;char Format[4];char Subchunk1ID[4];" & _ "int Subchunk1Size;short AudioFormat;short NumChannels;int SampleRate;" & _ "int ByteRate;short BlockAlign;short BitsPerSample;char Subchunk2ID[4];" & _ "int Subchunk2Size;" Local $sTagWAVHeaderAndData = $sTagWAVHeader & "short AudioWave[" & $iDataChunkSize / 2 & "]" Local $tWAVHeader_Data = DllStructCreate($sTagWAVHeaderAndData) $tWAVHeader_Data.ChunkID = "RIFF" $tWAVHeader_Data.ChunkSize = $iFileSize $tWAVHeader_Data.Format = "WAVE" $tWAVHeader_Data.Subchunk1ID = "fmt " $tWAVHeader_Data.Subchunk1Size = $iFormatChunkSize $tWAVHeader_Data.AudioFormat = $iFormatType $tWAVHeader_Data.NumChannels = $iTracks $tWAVHeader_Data.SampleRate = $iSamplesPerSecond $tWAVHeader_Data.ByteRate = $iBytesPerSecond; $tWAVHeader_Data.BlockAlign = $iFrameSize $tWAVHeader_Data.BitsPerSample = $iBitsPerSample $tWAVHeader_Data.Subchunk2ID = "data" $tWAVHeader_Data.Subchunk2Size = $iDataChunkSize Local $iAmplitude = 16383 / (100 / $iVolume) Local $iShort = 0 $iTheta = $iFrequency * $TAU / $iSamplesPerSecond For $iStep = 0 To $iSamples - 1 $iShort = Int($iAmplitude * Sin($iTheta * ($iStep))) DllStructSetData($tWAVHeader_Data, "AudioWave", $iShort, $iStep + 1) Next _WinAPI_PlaySound(DllStructGetPtr($tWAVHeader_Data), $SND_MEMORY) EndFunc ;==>_Beep Saludos2 points
-
One-way XOR En/Decryption ( GUI )
argumentum and one other reacted to jchd for a topic
My remark was merely a warning to unsuspecting future readers of this post. Decrypting text XORed with a 1-byte key is sister kid level homework2 points -
Version 5.1
8,855 downloads
Features: Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize, Fullscreen, Menu) True borderless, resizeable GUI with full support for aerosnap etc. Many color schemes/themes included. See MetroThemes.au3 for more details. 2 type of Windows 8/10 style buttons. Modern checkboxes, radios, toggles and progressbar. All buttons, checkboxes etc. have hover effects! Windows 10 style modern MsgBox. Windows 10/Android style menu that slides in from left.1 point -
I use the beeps for something I use on a daily basis but the volume seems a bit high. I can't seem to find a way to adjust the volume of only this script. It does not show in my windows 10 volume mixer. SoundSetWaveVolume() doesn't seem to work.1 point
-
well, if the array contains something like "+1 112 345 6789" then it will match the first input, and that is a good result (if i get the initial intention right...). the second input is by no means a phone number, and the user who is ought to know that he is looking for a phone number should not expect any coherent result.1 point
-
ok, feel free to bash me in... how about this: step 1: traverse the array and strip all non-numeric characters for each element. step 2: strip all non-numeric characters for the input. step 3: traverse the array and try to match the input to each element from the right-hand-side of the string (start from the more specific digits sequence to the more general one). any good?1 point
-
#include <array.au3> #include <file.au3> Opt ('MustDeclareVars', 1) Local $aPhoneNumbers = _ ['+262 692 12 03 00', '1800 251 996', '+1 994 951 0197', _ '091 535 98 91 61', '2397865', '08457 128276', _ '348476300192', '05842 361774', '0-800-022-5649', _ '15499514891', '0096 363 0949', '04813137349', _ '06620 220168', '07766 554433', '047 845 44 22 94', _ '0435 773 4859', '(01) 882 8565', '00441619346434', _ '09314 367090', '0 164 268 0887', '0590995603', _ '991', '0267 746 3393', '064157526153', _ '0 719 829 7756', '+1-541-754-3012', '+441347543010', _ '03890 978398', '(31) 10 7765420', '020 8568 6646', _ '0161 934 6534', '0 637 915 1283', '+44 207 882 8565', _ '0800 275002', '0750 646 9746', '982-714-3119', _ '000 300 74 52 40', '023077529227', '1 758 441 0611', _ '0183 233 0151', '02047092863', '+44 20 7946 0321', _ '04935 410618', '048 257 67 60 79'] ; Reference: http://www.studyabroad.com/resources/international-telephone-country-codes / Country codes saved in countries.txt CSV format (;) seperator is used. Local $aPhoneCountry _FileReadToArray (@ScriptDir & "countries.txt", $aPhoneCountry, $FRTA_NOCOUNT) if @error Then Msgbox (0, "_FileReadToArray", @Error & " occured while trying to read: " & @ScriptDir & "countries.txt") Exit 1 EndIf Local $aCountryCode, $strPhoneNumber, $bPrint = False For $i = 0 To UBound ($aPhoneNumbers) - 1 $strPhoneNumber = StringReplace ( $aPhoneNumbers [$i], "+", "" ) $strPhoneNumber = StringReplace ( $strPhoneNumber, " ", "" ) $strPhoneNumber = StringReplace ( $strPhoneNumber, "-", "" ) For $j = 0 to UBound ( $aPhoneCountry ) - 1 $aCountryCode = StringSplit ($aPhoneCountry[$j], ";") If StringInStr ( $strPhoneNumber, $aCountryCode [1] ) = 1 Then $bPrint = True ConsoleWrite ( "==> " & $aCountryCode [1] & " " & $aCountryCode [2] & "Phone Number: " & StringRight ( $strPhoneNumber, StringLen ( $strPhoneNumber ) - StringLen ( $aCountryCode [1] ) ) & @CRLF ) EndIf Next If $bPrint = False Then ConsoleWrite ( "> " & $strPhoneNumber & @CRLF ) $bPrint = False Next Ok newbie One (me) starts: this is totally not perfect but a approach. Namely first detect the Country dial-numbers. Everything after the Country number is likely to be a phone number.1 point
-
How do I vertically and horizontally center gui buttons and labels?
mLipok reacted to JLogan3o13 for a topic
Ok, generally speaking, it depends....1 point -
ControlSend Messing up the string
killertone reacted to mikell for a topic
Did you use $hIE = _IEPropertyGet($oIE, "hwnd") before the ControlSend($hIE, ...) ? Edit did you try _IEPropertySet($element, "innertext", "your_text") ?1 point -
In SciTE, menu File > Encoding should be "UTF8 with BOM" since your file carries a BOM.1 point
-
Well, life isn't perfect and life isn't neat. That's why we need Jesus fuzzy logic and proper process to save us from hell runtime errors and friday-evening releases.1 point
-
@JohnOne the first number is found at array index 16. The prefix (01) might not be required for an internal call, but there is no way to know which country the number is in for this particular example. Hopefully someone will drop a hint or two before long.1 point
-
I suggest to change line 9 of @Melba23's script to: Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) with this change instead of a 'calendar popup button' a 'up down control' appears at the right of the date-control.1 point
-
DixkG, Example 3 on the GUICtrlCreateDate page of the Help file shows how to use GUICtrlSendMsg to send a $DTM_SETFORMATW style to a date control - that allows you to use whatever format you wish for the display, like this: #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 10, 10, 185, 20) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example M231 point
-
Vivaed, Glad it helped! Good luck and don't hesitate to seek advice. Kylomas1 point
-
Hi, I went looking for an algorithm and I found one thanks to jchd's links to OEIS. It is blindingly fast - I get the 14-bit result in ~150ms on my machine. Anyway, here it is for completion: #include "Array.au3" $nBegin = TimerInit() ; Set number of bits $iMax = 14 ; Create array to hold unique patterns $iArraySizeFactor = 500 Global $aUnique[$iArraySizeFactor] =[0] ; Find factors for the bit value $sFactors = "|1|" For $i = Ceiling($iMax / 2) To 2 Step -1 $nDiv = $iMax / $i If IsInt($nDiv) Then $sFactors &= $nDiv & "|" EndIf Next $sFactors &= $iMax & "|" ;ConsoleWrite($sFactors & @CRLF) ; Create initial pattern of all 1s Local $aBits[$iMax + 1] For $i = 1 To $iMax $aBits[$i] = 1 Next _SavePattern($aBits) ; Start algorithm While 1 ; Find rightmost 1 For $iIndex= $iMax To 1 Step -1 If $aBits[$iIndex] = 1 Then ExitLoop Next ; Set found 1 to 0 $aBits[$iIndex] = 0 ; Fill rest of pattern with repeats of the pattern up to the found index $iFiller = 0 For $i = $iIndex + 1 To $iMax $iFiller= Mod($iFiller, $iIndex) + 1 $aBits[$i] = $aBits[$iFiller] Next ; If the found index is a factor of the bit value - valid pattern If StringInStr($sFactors, "|" & $iIndex & "|") Then _SavePattern($aBits) EndIf ; If leftmost 1 changed to 0 then pattern must be all 0s so end If $iIndex = 1 Then ExitLoop EndIf WEnd ReDim $aUnique[$aUnique[0] + 1] ConsoleWrite(TimerDiff($nBegin) & @CRLF) _ArrayDisplay($aUnique, "", "", 8) Func _SavePattern($aArray) ; Convert pattern to string $sPattern = "" For $i = 1 to UBound($aArray) - 1 $sPattern &= $aArray[$i] Next ; Resize array if required $aUnique[0] += 1 If $aUnique[0] > UBound($aUnique) - 1 Then ReDim $aUnique[UBound($aUnique) + $iArraySizeFactor] EndIf ; Add pattern to array $aUnique[$aUnique[0]] = $sPattern EndFunc And please do not ask me to explain why it works - it took me long enough to work out how to get it to run! M231 point
-
IE screenx property messes up if you scroll, how to fix?
killertone reacted to jdelaney for a topic
Focus brings the object into view...no need for complicated movements _IEAction($oObj,"Focus")1 point