-
Posts
3,374 -
Joined
-
Last visited
NELyon's Achievements

Universalist (7/7)
2
Reputation
-
HansHenrik reacted to a post in a topic: AutoIt Linux
-
Command3r reacted to a post in a topic: Perl + AutoIt?
-
I.. just... OH MY GOD I LOVE YOU. I completely forgot how to do that, it's been so long since I've AutoIt'd. Thanks for the help.
-
So I'm working on a colab project with multiple languages (which is the reason for my odd coding habits), and I'm trying to make a little CUI mp3 player. Now, it seems no matter what I do, it'll do all except play the file. All of the error checks seem to work fine, like a non-existant file, non-mp3, no file, etc, but when I pass an actual MP3 file to it, it just fails to open. I've used a blank script with just a SoundPlay("file.mp3") and it has played them fine, so that's not the problem. Here's the code. #Include <Sound.au3> #AutoIt3Wrapper_Change2CUI=y Global $fLog = FileOpen("soundplay.log", 1); If (Not $cmdline[0]) Then If(EnvGet("SOUND_PLAYING") and EnvGet("SOUND_NAME")) Then For $i = 1 to 5 step +1 if(ProcessClose("soundplayer.exe")) Then logWrite("Killed sound " & EnvGet("SOUND_NAME")); ExitLoop; Else logWrite("Attempted to kill sound " & EnvGet("SOUND_NAME") & ", but it failed."); EndIf Next EndIf logWrite("soundplayer.exe called without arguments."); Exit; EndIf If (Not StringInStr($cmdline[1], ".mp3")) Then logWrite("soundplayer.exe called for a non-mp3 sound file."); Exit; EndIf If (Not FileExists($cmdline[1])) Then logWrite("soundplayer.exe called for a non-existant file."); Exit; EndIf EnvSet("SOUND_PLAYING", 1); EnvSet("SOUND_NAME", $cmdline[1]); $sSound = _SoundOpen($cmdline[1]); If ($sSound) Then logWrite("Began playing sound " & $cmdline[1]); _SoundPlay($sSound, 1); Else logWrite("Could not open the sound " & $cmdline[1]) Exit EndIf logWrite("Ended playing sound " & $cmdline[1]); EnvSet("SOUND_NAME", 0); EnvSet("SOUND_PLAYING", 0); Func logWrite($msg) $tStamp = @Mon & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC; FileWrite($fLog, $tStamp & " - " & $msg & @CRLF); Return 0; EndFunc Here's the log output with no parameters, a non-mp3 parameter, an MP3 (but non-existant) parameter, and finally two with actual MP3 files passed. 05/10/2010 - 16:17:59 - soundplayer.exe called without arguments. 05/10/2010 - 16:18:04 - soundplayer.exe called for a non-mp3 sound file. 05/10/2010 - 16:18:12 - soundplayer.exe called for a non-existant file. 05/10/2010 - 16:18:48 - Could not open the sound feelthenoize.mp3 05/10/2010 - 16:19:02 - Could not open the sound E:\Code\Final Project\feelthenoize.mp3 Can anyone lend a hand?
-
Put #NoTrayIcon at the top of your script. EDIT: Typo.
-
FileWrite("test.txt", InputBox("Enter something", "Enter something"))
-
Hey guys, it's been a while since I've asked a question. It's actually been a while since I did anything in Autoit. Basically, I'm rewriting a bash script I wrote to upload images onto 4chan. I have an array of files to upload, but I cannot figure out how to strip any array elements that lack either ".jpg", ".png", or ".gif" at the end. EDIT: Oh yeah, the issue is that the recursive _FileListToArray-like function I am using adds the actual directories to the array along with the files themselves. I've tried something along the lines of: For $i=1 to UBound($aArray)-1 If StringRight($aArray, 3) <> "jpg" or ...etc _ArrayDelete(Yadda yadda yadda) EndIf Next But there's obviously the issue of the upper bound of the array changing when you delete the elements. I know, this is probably easy, but my brain is pretty fried right now and I can't figure it out.
-
As far as I know, the compiler most certainly is not open-sourced.
-
JPG to Binary/ASCII/HEX then back to JPG
NELyon replied to DarkBoost's topic in AutoIt General Help and Support
Try this. #include <SQLite.au3> #include <SQLite.dll.au3> Dim $fRead, $fOpen, $hQuery, $hRow $hHandle = FileOpen(@ScriptDir & "\photo.jpg", 16) $fRead = Binary(FileRead($hHandle)) _SQLite_Startup() _SQLite_Open() _SQLite_Exec(-1, "CREATE TABLE test (photo);") _SQLite_Exec(-1, "INSERT INTO test VALUES ('" & $fRead &"');") _SQLite_Query(-1, "SELECT rowid, * FROM test WHERE rowid = 1;", $hQuery) _SQLite_FetchData($hQuery, $hRow) $fOpen = FileOpen(@ScriptDir & "\photo_new.jpg", 2) FileWrite($fOpen, Binary($hRow[1])) _SQLite_ShutDown() FileClose($hHandle) FileClose($fOpen) EDIT: Forgot to mention, this works on my end. -
HotKeySet("e")
-
You're asking others to provide you with code without doing a bit of work yourself, and then biting their heads off after they give you perfectly good solutions to your problem. AutoIt is certainly not the language to be coding that in. VNC is without a doubt the solution.
-
Wait... don't keyboards do this by default?
-
Could you not just do: If WinActivate($ReplacedString) Then Send($_Key) Since it will just evaluate true anyway if WinActivate($ReplacedString) is non-zero?
-
While 1 If Not ProcessExists("server.exe") Then Run("server.exe") EndIf Sleep(200) WEnd
-
I, like Manadar, do not use an Anti-Virus. I'm smart with my downloading, and I make remote backups of all my files I cannot afford to lose (if I have to reformat for any reason).
-
Can you restate the question? I'm not entirely sure what you're asking. Are you trying to prevent SQL injection?
-
I did that intentionally, but forgot to change it when I posted it. For some reason, whenever I try to open a Web page via _IECreate(), it opens two IE windows (one pointing to the requested page, and the other to about:blank). I planned to change it before I posted.