K1nz Posted October 31, 2016 Share Posted October 31, 2016 Hey guys, Just working on my first koda gui and I'm having a strange issue with #RequirAdmin I was hoping you could help me out with. Every time I implement this the images in my gui disappear. The script is essentially the helpfile (#Include <MsgBoxConstants.au3>, #RequireAdmin, and some buttons images and checkboxes). It works flawlessly aside from the images nowhere to be found when I add #RequireAdmin. I'm new to autoit / koda so if there's somewhere I can find the answer to this please point me in the right direction. Thanks. Link to comment Share on other sites More sharing options...
AutoBert Posted October 31, 2016 Share Posted October 31, 2016 (edited) Put #RequirAdmin only once at first scriptline. If needing further help, post (reproducer ?) script showing the issue(s). Edited October 31, 2016 by AutoBert Link to comment Share on other sites More sharing options...
K1nz Posted October 31, 2016 Author Share Posted October 31, 2016 Here is the code, I just tested it again and the images vanished. expandcollapse popup#RequireAdmin #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form=z:\techtoolbox\gui.kxf $Form2 = GUICreate("Computer Cleanup", 492, 579, 232, 127) $Tab1 = GUICtrlCreateTab(8, 8, 473, 561) $TabSheet1 = GUICtrlCreateTabItem("AV SCANNERS") $Scanners = GUICtrlCreateLabel("Initial Anti-Virus Scanners", 124, 56, 255, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label2 = GUICtrlCreateLabel("Click start to download and install Malwarebytes, SUPERAntispyware and Spybot.", 62, 88, 389, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button1 = GUICtrlCreateButton("Start", 301, 120, 89, 41) $Label3 = GUICtrlCreateLabel("x64 Anti-Virus Scanners", 138, 195, 239, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label4 = GUICtrlCreateLabel("Click start to download and install HitmanPro, Roguekiller and CCleaner.", 86, 232, 342, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button2 = GUICtrlCreateButton("Start", 301, 262, 89, 41) $Label5 = GUICtrlCreateLabel("x86 Anti-Virus Scanners", 138, 340, 239, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label6 = GUICtrlCreateLabel("Click start to download and install HitmanPro, Roguekiller and CCleaner.", 86, 378, 342, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button3 = GUICtrlCreateButton("Start", 301, 408, 89, 41) $Label7 = GUICtrlCreateLabel("Click here to view the Anti-Virus check list.", 155, 488, 204, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button4 = GUICtrlCreateButton("Check List", 189, 512, 137, 25) $Pic4 = GUICtrlCreatePic("Z:\Downloads\Scanners1.jpg", 96, 104, 161, 89) $Pic5 = GUICtrlCreatePic("Z:\Downloads\Other.jpg", 98, 250, 137, 81) $Pic6 = GUICtrlCreatePic("Z:\Downloads\Other.jpg", 98, 399, 137, 81) $TabSheet2 = GUICtrlCreateTabItem("UTILITIES") $Label8 = GUICtrlCreateLabel("SFC /Scannow", 102, 223, 150, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label9 = GUICtrlCreateLabel("Click here to run SFC on your system files.", 101, 265, 201, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button5 = GUICtrlCreateButton("Start", 333, 217, 89, 41) $Label10 = GUICtrlCreateLabel("CHKDSK /b /x", 105, 410, 144, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label11 = GUICtrlCreateLabel("Click here to run CHKDSK on your hard-drive. (Reboot required)", 105, 454, 304, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button6 = GUICtrlCreateButton("Start", 333, 307, 89, 41) $Label12 = GUICtrlCreateLabel("DISM /?", 104, 315, 83, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label13 = GUICtrlCreateLabel("Click hear to run DISM on your Windows image.", 102, 359, 230, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button7 = GUICtrlCreateButton("Start", 334, 398, 89, 41) $Pic7 = GUICtrlCreatePic("Z:\Downloads\sfc.jpg", 141, 56, 233, 121) $TabSheet3 = GUICtrlCreateTabItem("SOFTWARE") $Label15 = GUICtrlCreateLabel("Basic Software Set", 164, 60, 187, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label16 = GUICtrlCreateLabel("Runtimes", 211, 342, 93, 29) GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) $Label17 = GUICtrlCreateLabel("Basic software set downloaded from Ninite including:", 131, 93, 252, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label18 = GUICtrlCreateLabel("Standalone runtime pack. (Java, .NET, Silverlight,Air, Shockwave)", 99, 381, 317, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button8 = GUICtrlCreateButton("Start", 290, 451, 89, 41) $Pic1 = GUICtrlCreatePic("Z:\Downloads\Runtimes.jpg", 136, 400, 113, 145) $Pic2 = GUICtrlCreatePic("Z:\Downloads\Basic.jpg", 136, 120, 121, 217) $Pic3 = GUICtrlCreatePic("Z:\Downloads\Runtimes.jpg", 272, 116, 113, 145) $Button9 = GUICtrlCreateButton("Start", 287, 267, 89, 41) $Pic9 = GUICtrlCreatePic("Z:\TechToolBox\NiniteLogo.jpg", 368, 528, 105, 33) $TabSheet4 = GUICtrlCreateTabItem("MISC. TOOLS") $TabSheet5 = GUICtrlCreateTabItem("Checklist") $Pic8 = GUICtrlCreatePic("Z:\Tool Box\AV Software\Checklist.jpg", 16, 40, 457, 497) $Checkbox1 = GUICtrlCreateCheckbox("", 400, 144, 17, 25) $Checkbox2 = GUICtrlCreateCheckbox("", 400, 168, 17, 25) $Checkbox3 = GUICtrlCreateCheckbox("", 400, 192, 17, 25) $Checkbox4 = GUICtrlCreateCheckbox("", 400, 216, 17, 25) $Checkbox5 = GUICtrlCreateCheckbox("", 400, 240, 17, 25) $Checkbox6 = GUICtrlCreateCheckbox("", 304, 424, 17, 25) $Checkbox7 = GUICtrlCreateCheckbox("", 352, 424, 17, 25) $Checkbox8 = GUICtrlCreateCheckbox("", 400, 424, 17, 25) $Checkbox9 = GUICtrlCreateCheckbox("", 304, 480, 17, 25) $Checkbox10 = GUICtrlCreateCheckbox("", 400, 480, 17, 25) $Checkbox11 = GUICtrlCreateCheckbox("", 184, 232, 17, 25) $Checkbox12 = GUICtrlCreateCheckbox("", 184, 208, 17, 25) $Checkbox13 = GUICtrlCreateCheckbox("", 184, 184, 17, 25) $Checkbox14 = GUICtrlCreateCheckbox("", 184, 160, 17, 25) $Checkbox15 = GUICtrlCreateCheckbox("", 184, 136, 17, 25) $Checkbox16 = GUICtrlCreateCheckbox("", 232, 232, 17, 25) $Checkbox17 = GUICtrlCreateCheckbox("", 232, 208, 17, 25) $Checkbox18 = GUICtrlCreateCheckbox("", 232, 184, 17, 25) $Checkbox19 = GUICtrlCreateCheckbox("", 232, 160, 17, 25) $Checkbox20 = GUICtrlCreateCheckbox("", 232, 136, 17, 25) $Checkbox21 = GUICtrlCreateCheckbox("", 184, 400, 17, 25) $Checkbox22 = GUICtrlCreateCheckbox("", 184, 376, 17, 25) $Checkbox23 = GUICtrlCreateCheckbox("", 184, 352, 17, 25) $Checkbox24 = GUICtrlCreateCheckbox("", 184, 328, 17, 25) $Checkbox25 = GUICtrlCreateCheckbox("", 184, 304, 17, 25) $Checkbox27 = GUICtrlCreateCheckbox("", 184, 496, 17, 25) $Checkbox28 = GUICtrlCreateCheckbox("", 184, 472, 17, 25) $Checkbox29 = GUICtrlCreateCheckbox("", 184, 448, 17, 25) $Checkbox30 = GUICtrlCreateCheckbox("", 184, 424, 17, 25) $Label1 = GUICtrlCreateLabel("Scan", 176, 120, 29, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label14 = GUICtrlCreateLabel("Quaratine", 216, 120, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label19 = GUICtrlCreateLabel("Installed", 176, 288, 43, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label20 = GUICtrlCreateLabel("Installed", 392, 120, 43, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Checkbox26 = GUICtrlCreateCheckbox("", 232, 256, 17, 25) $Checkbox31 = GUICtrlCreateCheckbox("", 184, 256, 17, 25) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("\\192.168.100.104\d\TechToolBox\Ninite.exe") Sleep(60000) Run("\\192.168.100.104\d\TechToolBox\AV Software\minimize.exe") Sleep(70000) Run("\\192.168.100.104\d\TechToolBox\sas_v01.exe") Sleep(60000) Run("\\192.168.100.104\d\TechToolBox\sp_v01.exe") EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Run("\\192.168.100.104\d\TechToolBox\RogueKiller_x64.exe") Sleep(1000) Run("\\192.168.100.104\d\TechToolBox\CCleaner_x64.exe") Sleep(1000) Run("\\192.168.100.104\d\TechToolBox\HitmanPro_x64.exe") EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button3 Run("\\192.168.100.104\d\TechToolBox\Roguekiller_x86.exe") Sleep(1000) Run("\\192.168.100.104\d\TechToolBox\CCleaner_x86.exe") Sleep(1000) Run("\\192.168.100.104\d\TechToolBox\HitmanPro_x86.exe") EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button5 EnvSet("SEE_MASK_NOZONECHECKS","1") If StringInStr(@OSArch, "64") Then Run(@ComSpec & " /k " & @WindowsDir & "\Sysnative\sfc /scannow", "", @SW_SHOW) Else Run(@ComSpec & " /k " & @WindowsDir & "\System32\sfc /scannow", "", @SW_SHOW) EndIf EnvSet("SEE_MASK_NOZONECHECKS","0") EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button9 Run("\\192.168.100.104\d\TechToolBox\NiniteSoftware.exe") EndSwitch $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button8 Run("\\192.168.100.104\d\TechToolBox\NiniteRuntimes.exe") EndSwitch WEnd I'm trying to use require admin so I can run sfc /scannow from the gui when clicking button5. Sorry it's pretty rough at the moment. Link to comment Share on other sites More sharing options...
BrewManNH Posted October 31, 2016 Share Posted October 31, 2016 Is the Z: drive a network share? If it is, try using the UNC path instead of the drive letter. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
K1nz Posted October 31, 2016 Author Share Posted October 31, 2016 I've simplified the script to just one button and one image for testing. #RequireAdmin #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 216, 96, 185, 89) $Pic1 = GUICtrlCreatePic("Z:\TechToolBox\NiniteLogo.jpg", 144, 224, 337, 129) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 EnvSet("SEE_MASK_NOZONECHECKS","1") If StringInStr(@OSArch, "64") Then Run(@ComSpec & " /k " & @WindowsDir & "\Sysnative\sfc /scannow", "", @SW_SHOW) Else Run(@ComSpec & " /k " & @WindowsDir & "\System32\sfc /scannow", "", @SW_SHOW) EndIf EnvSet("SEE_MASK_NOZONECHECKS","0") EndSwitch WEnd Image disappears everytime. Link to comment Share on other sites More sharing options...
spudw2k Posted November 3, 2016 Share Posted November 3, 2016 (edited) On 10/31/2016 at 7:51 AM, BrewManNH said: Is the Z: drive a network share? If it is, try using the UNC path instead of the drive letter. I second that. I also am assuming the Z: is a network mapped drive. If the drive was mapped without escalation the script won't see the mapped drive. You could have the script map the drive, but using the UNC should be as effective and simpler. edit: You can demonstrate/prove that this drive map is the issue by launching a CMD prompt with admin rights and executing 'net use' to see if the map exists (me thinks it won't show). Edited November 3, 2016 by spudw2k 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 BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
K1nz Posted November 4, 2016 Author Share Posted November 4, 2016 On 10/31/2016 at 9:51 AM, BrewManNH said: Is the Z: drive a network share? If it is, try using the UNC path instead of the drive letter. Not sure how I missed your post when I posted the second time, but I bet you both are right. I'll test this tonight when I get a chance and report back. Thanks for your help guys. 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