tom35i Posted November 11, 2009 Posted November 11, 2009 Hey all I am trying to create a program that will display if the current user has admin rights or not I can get If IsAdmin() Then MemoWrite("User Has Admin Rights") but i want it to display is the user dos not have admin rights which i think would be the following If IsAdmin() Then MemoWrite("User Has Admin Rights") else MemoWrite("User Does Not Have Admin Rights") but i keep getting an error when i compile any ideas thank you YEA BOIhttp://www.myspace.com/comeoutfiringhttp://www.last.fm/music/comeoutfiringhttp://www.facebook.com/pages/comeoutfiring/75676261698http://www.reverbnation.com/comeoutfiringhttp://www.purevolume.com/comeoutfiringhttp://www.twitter.com/comeoutfiringhttp://www.youtube.com/comeoutfiring
water Posted November 11, 2009 Posted November 11, 2009 (edited) AutoIt doesn't allow this syntax to be written in one line. This should work: If IsAdmin() Then MemoWrite("User Has Admin Rights") else MemoWrite("User Does Not Have Admin Rights") endif Edited November 11, 2009 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
GodlessSinner Posted November 11, 2009 Posted November 11, 2009 (edited) #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #RequireAdmin #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("User privilegies", 292, 67, 577, 717) $Input1 = GUICtrlCreateInput("", 16, 8, 257, 24, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x008000) If IsAdmin() Then GUICtrlSetData($Input1, "User have admin rights") GUICtrlSetBkColor($Input1, 0x008000) Else GUICtrlSetData($Input1, "User haven't admin rights") GUICtrlSetBkColor($Input1, 0xFF0000) EndIf GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd (Use #RequireAdmin if needed) Edited November 11, 2009 by Godless _____________________________________________________________________________
tom35i Posted November 12, 2009 Author Posted November 12, 2009 cheers guys very useful YEA BOIhttp://www.myspace.com/comeoutfiringhttp://www.last.fm/music/comeoutfiringhttp://www.facebook.com/pages/comeoutfiring/75676261698http://www.reverbnation.com/comeoutfiringhttp://www.purevolume.com/comeoutfiringhttp://www.twitter.com/comeoutfiringhttp://www.youtube.com/comeoutfiring
spudw2k Posted December 15, 2009 Posted December 15, 2009 cheers guys very usefulIf you really want to code things in one line the _Iif func might be of use to you. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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