2o2 Posted June 17, 2007 Share Posted June 17, 2007 how do i declare a variable without executing it. i.e $cool = msgbox(0, "yarr", "wazzup") i want to put something like this at the beginning of my script but i do not want this to execute when it is declared. Rick rack ree, kick 'em in the knee.Rick rack rass, kick 'em in the other knee! Link to comment Share on other sites More sharing options...
Generator Posted June 17, 2007 Share Posted June 17, 2007 how do i declare a variable without executing it. i.e $cool = msgbox(0, "yarr", "wazzup") i want to put something like this at the beginning of my script but i do not want this to execute when it is declared.It doesn't work that way, either you don't put anything at all which in that case it will call a msg box out, or use a func. If you are thinking about just using $cool to call out msg box, it's not gonna work. A func can be done like this: Func _MsgBox() Msgbox(0, "yarr", "wazzup") EndFunc oÝ÷ Øò¢êìr¸©·*.q©ÜjYmçîÉbëaÆ®¶s`£µ7GVfbW&P¥ô×6v&÷²F2vÆÂF7Æ×6v&÷£µ7GVfbW&P Link to comment Share on other sites More sharing options...
2o2 Posted June 17, 2007 Author Share Posted June 17, 2007 thanks!! Rick rack ree, kick 'em in the knee.Rick rack rass, kick 'em in the other knee! Link to comment Share on other sites More sharing options...
2o2 Posted June 17, 2007 Author Share Posted June 17, 2007 that does not really help me. sry heres my script and it always gives me $progopen variable not declared expandcollapse popup#include <GUIConstants.au3> $12 = GUICreate ("iPad", 600, 400) HotKeySet("^v", "paste") HotKeySet("{TAB}", "tab") Hotkeyset("^c", "copy") HotKeySet("^s", "save") $menu = GUICtrlCreateMenu("File") $open = GUICtrlCreateMenuItem("Open", $menu) $save = GUICtrlCreateMenuItem("Save Ctrl + S", $menu) $saveas = Guictrlcreatemenuitem("Save As", $menu) $about = GUICtrlCreateMenuItem("About", $menu) $exit = GUICtrlCreateMenuItem("Exit", $menu) $edit = GUICtrlCreateMenu("Edit") $copy = GUICtrlCreateMenuItem("Copy Ctrl + C", $edit) $paste = GUICtrlCreateMenuItem("Paste Ctrl + V", $edit) $undo = GUICtrlCreateMenuItem("Undo Ctrl + Z", $edit) $write = GUICtrlCreateEdit("", 5, 5, 590, 370) GUISetState(@SW_SHOW) while 1 $sav = GUICtrlRead($write) $iResult = GUIGetMsg () Select case ($iResult = $open) $progopen = FileOpenDialog("Open",@desktopcommondir, "text files(*.txt;*.doc)", 1) If @error Then Sleep(10) else GUICtrlSetData($write, FileRead($progopen)) endif Case ($iResult = -3) Exit Case ($iResult = $exit) Exit Case ($iResult = $saveas) $progsaveas = FileSaveDialog("Save", @desktopcommondir, "text files (*.txt;*.doc)") FileDelete($progsaveas) FileWrite($progsaveas, GUICtrlRead($write)) Case ($iResult = $save) if fileexists($progopen) then FileDelete($progopen) FileWrite($progopen, GUICtrlRead($write)) EndIf if not fileexists($progopen) Then $progopen = FileSaveDialog("Save", @desktopcommondir, "text files (*.txt;*.doc)") FileDelete($progopen) FileWrite($progopen, GUICtrlRead($write)) EndIf case ($iResult = $about) msgbox(0, "iPad", "iPad, Created by Isaac Flaum is a notepad like tool compiled using Autoit v3" & chr(13) & chr(10) & "Thanks For Trying iPad! Updates Coming Soon" & chr(13) & chr(10) & "-Isaac") case ($iResult = $copy) ClipPut($sav) Case ($iResult = $paste) GUICtrlSendMsg($write, "^v", 1, 1) EndSelect WEnd Func tab() send(" ", $write) EndFunc func save() $input = InputBox("Save", "Please type the filename you desire") FileWrite($input & ".txt" , $sav) EndFunc Func copy() Clipput($sav) EndFunc Func paste() Send(ClipGet(), $write) EndFunc Rick rack ree, kick 'em in the knee.Rick rack rass, kick 'em in the other knee! Link to comment Share on other sites More sharing options...
Generator Posted June 17, 2007 Share Posted June 17, 2007 (edited) Just try to Global it at the beginning Global $Progmopen Edit: Typo Edited June 17, 2007 by Generator Link to comment Share on other sites More sharing options...
herewasplato Posted June 17, 2007 Share Posted June 17, 2007 (edited) Just try to Global it at the beginning Global $Progmopen oÝ÷ ØGbµ:-) Edit: 2o2 - welcome to the forum and nice script. Edited June 17, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
2o2 Posted June 17, 2007 Author Share Posted June 17, 2007 orGlobal $progopen:-) Edit: 2o2 - welcome to the forum and nice script.Thanks and Thanks! Rick rack ree, kick 'em in the knee.Rick rack rass, kick 'em in the other knee! Link to comment Share on other sites More sharing options...
systemhijack Posted June 19, 2007 Share Posted June 19, 2007 how do i declare a variable without executing it.i.e$cool = msgbox(0, "yarr", "wazzup")i want to put something like this at the beginning of my script but i do not want this to execute when it is declared.use global 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