Saroset Posted June 19, 2008 Share Posted June 19, 2008 Func Function($Variable) Run($Variable) EndFuncoÝ÷ Ø"¶,²&åzÚ+º{(ëax0ØhºØZ¾)ටjg¬zا²Ú'y«¢+ÙIÕ¸ ÅÕ½ÐìÅÕ½Ðì°ÀÌØíYÉ¥± Would that work? Link to comment Share on other sites More sharing options...
someone Posted June 19, 2008 Share Posted June 19, 2008 (edited) Yep, thats the nature of variables. Also you can pass the variable to a function just as you did above. When calling that function, pass whatever variable you want (which will ultimately end up in the Run command). Looking at code almost makes it easier to explain; $var1 = "notepad.exe" MsgBox(0, "", "After you click OK, notepad will run") Function($var1) $var2 = "cmd" MsgBox(0, "", "After you click OK, cmd prompt will open") Function($var2) Func Function($Variable) Run($Variable) EndFunc EDIT Whoops forgot to welcome you to the forum! Edited June 19, 2008 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Kerros Posted June 19, 2008 Share Posted June 19, 2008 RUN($Variable) This may work, but not the other way around. "Filename" is a required item. Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance. Link to comment Share on other sites More sharing options...
Saroset Posted June 19, 2008 Author Share Posted June 19, 2008 $var = "notepad" MyFunc($var) Func MyFunc($var) Run($var) endfuncoÝ÷ Ù8Z· +Æ®¶sbb33c´äÔTTDBÒuT7G&Ä7&VFTVFBgV÷C´fÆRæÖRgV÷C²Â#ÂÂ3Â#¢b33c´äÔU$TBÒuT7G&Å&VBb33c´äÔTTDB¤×gVæ2b33c´äÔU$TB ¤gVæ2×gVæ2b33c´äÔU$TB 'Vâb33c´äÔU$TB ¤VæDgVæ0 That doesn't. I'm positive I'm entering "notepad" in the correct field. Any idea why? Error: Unable to execute external program. Access is denied. Link to comment Share on other sites More sharing options...
Saroset Posted June 19, 2008 Author Share Posted June 19, 2008 (edited) Nevermind! I messed up with a variable =P. Or... Not. It's still giving me the same error. Edited June 19, 2008 by Saroset Link to comment Share on other sites More sharing options...
someone Posted June 19, 2008 Share Posted June 19, 2008 I don't know why exactly that isn't working.... this works for me; $NAMEREAD = "notepad" MyFunc($NAMEREAD) Func MyFunc($NAMEREAD) Run($NAMEREAD) EndFunc Try to use some debugging, throw in a msgbox (or consolewrite) before the run function to check the value of $nameread, even an extra space could throw it off. I don't know why it would be saying access denied... are you running vista by chance? Does it change anything to run the script as an admin, or to change the workingdir of the run command? While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Saroset Posted June 19, 2008 Author Share Posted June 19, 2008 (edited) I don't know why exactly that isn't working.... this works for me; $NAMEREAD = "notepad" MyFunc($NAMEREAD) Func MyFunc($NAMEREAD) Run($NAMEREAD) EndFunc Try to use some debugging, throw in a msgbox (or consolewrite) before the run function to check the value of $nameread, even an extra space could throw it off. I don't know why it would be saying access denied... are you running vista by chance? Does it change anything to run the script as an admin, or to change the workingdir of the run command? XP. I'm writing a section to do some debugging atm. Edit: Checked the value while running, turns out it's either not reading correctly or not saving correctly. Probably a mistake somewhere. Edit2: Yup, turned out I made a mistake. Thanks! Edited June 19, 2008 by Saroset 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