litlmike Posted May 25, 2006 Share Posted May 25, 2006 Can anyone tell me why this line doesn't compile correctly? $sound_2_play = $install_destin & $file & $random expandcollapse popup#include <Misc.au3> $file1 = "cat.wav" $file2 = "meow.wav" $file3 = "Cat01.wav" $file4 = "cat-meow.wav" $file5 = "9_43B.wav" $file6 = "9_43D.wav" $install_source = "C:\Documents and Settings\[Name]\My Documents\Personal\AutoIt\Prank\" $install_destin = "C:\Temp\" ;AutoItSetOption ( "TrayIconHide", 1 ) Install_Meow () While 1 Sleep ( 150 ) If _IsPressed("23") Then $wait = Random ( 1000 , 2000) Sleep ($wait) $random = Random ( 1 , 6 ) $sound_2_play = $install_destin & $file & $random;$install_destin & ; RIGHT ABOVE HERE SoundPlay ( $sound_2_play ,1) MsgBox(0,"_IsPressed", "End Key Pressed", 1) EndIf WEnd Func Install_Meow () FileInstall ($install_source & $file1, $install_destin) FileInstall ($install_source & $file2, $install_destin) FileInstall ($install_source & $file3, $install_destin) FileInstall ($install_source & $file4, $install_destin) FileInstall ($install_source & $file5, $install_destin) FileInstall ($install_source & $file6, $install_destin) EndFunc _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 25, 2006 Moderators Share Posted May 25, 2006 The source file must be a string and not a variable so that the compiler can extract the filename to include. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
litlmike Posted May 25, 2006 Author Share Posted May 25, 2006 The interesting part about that, is that the files install perfectly. I am looking at them right now. It seems that this line is the issue, and I get this error. I could be wrong though $sound_2_play = $install_destin & $file & $random C:\Documents and Settings\[name]\My Documents\Personal\AutoIt\Prank.au3(23,43) : WARNING: $file: possibly used before declaration. $sound_2_play = $install_destin & $file & ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\[name]\My Documents\Personal\AutoIt\Prank.au3(23,43) : ERROR: $file: undeclared global variable. $sound_2_play = $install_destin & $file & ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\[name]\My Documents\Personal\AutoIt\Prank.au3 - 1 error(s), 1 warning(s) _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted May 25, 2006 Share Posted May 25, 2006 (edited) Execute, quotes: $sound_2_play = Execute($install_destin & "$file" & $random) Dale Edited May 25, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
litlmike Posted May 25, 2006 Author Share Posted May 25, 2006 Execute, quotes: $sound_2_play = Execute($install_destin & "$file" & $random) Dale Sadly, when I use that line, it sets my @Error to 1. I know there has to be a way to accomplish this. Thanks again, for everyone's help. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
DaleHohm Posted May 25, 2006 Share Posted May 25, 2006 Sadly, when I use that line, it sets my @Error to 1. I know there has to be a way to accomplish this. Thanks again, for everyone's help.I nested improperly and Doh! I assumed you were using Random properly... $random = Random ( 1 , 6 , 1) $sound_2_play = $install_destin & Execute("$file" & $random) Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 26, 2006 Moderators Share Posted May 26, 2006 (edited) FileInstall will work properly with variables x% of the time, but if this is going to be used on other computers as a native .exe you will be upset to have to re-write them all. Take this help file warning as a fact and not a suggestion. Edited May 26, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
litlmike Posted May 26, 2006 Author Share Posted May 26, 2006 I nested improperly and Doh! I assumed you were using Random properly... $random = Random ( 1 , 6 , 1) $sound_2_play = $install_destin & Execute("$file" & $random) DaleWell heck! I thought I was using random properly too! THanks! It works! _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
litlmike Posted May 26, 2006 Author Share Posted May 26, 2006 FileInstall will work properly with variables x% of the time, but if this is going to be used on other computers as a native .exe you will be upset to have to re-write them all. Take this help file warning as a fact and not a suggestion.Sir, yes Sir!Thanks for the help! _ArrayPermute()_ArrayUnique()Excel.au3 UDF 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