Chimaera Posted March 8, 2015 Share Posted March 8, 2015 Im trying to make a button that is hidden on a gui unless its my copy so i can check on work done by the other lads etc (and yes im in a position where i need to do that to keep an eye on stuff). Anyway i set the button up like this If FileExists( @ScriptDir & "\xtrabutton.dll") Then Local $ViewFolButton = GUICtrlCreateButton(" View Tech Edits ", 142, 475, 130, 30) EndIf So it has a hidden file on my pendrive that only i have which has to exist for the button to show All good so far, until i started adding a Case for the button Case $ViewFolButton ShellExecute(@AppDataDir & "\SaveFolder") Now the gui just flashes and dissapers when i have the Case in the script I cant find a way to allow the case statement when the button doesnt exist at the times when the hidden file doesnt exist Any suggestions? If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Solution JohnOne Posted March 8, 2015 Solution Share Posted March 8, 2015 (edited) Just declare the variable first, and give it some arbitrary value. Local $ViewFolButton = 45853997452 EDIT: A value that will not conflict with an actual control. Edited March 8, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
orbs Posted March 8, 2015 Share Posted March 8, 2015 before everything begins, declare $ViewFolButton and assign to it any meaningless value, like 9999 (or Dummy control i think will work also). then create it as you already do, but omit the Local keyword. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
TheSaint Posted March 8, 2015 Share Posted March 8, 2015 (edited) Something similar to what the others said. I often do this when I have a MORE / LESS button on a GUI, for all controls that are on the expanded MORE GUI. so If FileExists( @ScriptDir & "\xtrabutton.dll") Then Local $ViewFolButton = GUICtrlCreateButton(" View Tech Edits ", 142, 475, 130, 30) $exist = 1 Else $exist = 2 EndIf and then Case $ViewFolButton And $exist = 1 ShellExecute(@AppDataDir & "\SaveFolder" ' ' P.S. What is happening with your current setup, is that that Case argument always runs (i.e. Case = ""). Edited March 8, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
JohnOne Posted March 8, 2015 Share Posted March 8, 2015 Or just create the button in all cases, but hide it if the file does not exist. #include <GUIConstantsEx.au3> $gui = GUICreate("GUI") $Shownbutton = GUICtrlCreateButton("Shown", 10, 10) $Hiddenbutton = GUICtrlCreateButton("Shown", 10, 40) If FileExists(@ScriptDir & "\file.ext") Then GUICtrlSetState(-1, $GUI_SHOW) Else GUICtrlSetState(-1, $GUI_HIDE) EndIf GUISetState() Do Until GUIGetMsg() = -3 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Chimaera Posted March 8, 2015 Author Share Posted March 8, 2015 Ok guys thx for the input If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() 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