Jump to content

Recommended Posts

Posted (edited)

Hey guys ,

I created a check box and a button which opens cmd.

My script is not working 

Case $fucj
 If _IsChecked ($Check) Then
ShellExecute("cmd.exe","","runas")
Else
ShellExecute("cmd.exe")
EndIf

And when I open the program and then check the check box ($Check) and hit the button ($fucj)  the following error shows up

 

Capture1.PNG.a42e74b18d5dd64a717124ec78e

I want help.

Edited by farhadrahman2
Posted

Still not working 

My script

#include <ColorConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <MsgBoxConstants.au3>
#include <FontConstants.au3>
#NoTrayIcon
#region
#AutoIt3Wrapper_Res_Comment=Launcher - PC Hackz™
#AutoIt3Wrapper_Res_Description=PC Hackz™
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Everybody in this world
://////=__=
://////=__=...
#endregion

Example()

Func Example()
FileInstall("DEFAULT_GUI_PIC.jpg" , @TempDir & "\FXDZHXE.SYS")
FileInstall("ICon.jpg" , @TempDir & "\FXDZHXN.SYS")

Local $hGUI = GUICreate("Launcher - By PC HACKZ",640,400)



Local $idpic = GUICtrlCreatePic(@TempDir & "\FXDZHXE.SYS",1,1,640,400)
 
 Local $icon =  GUICtrlCreatePic(@TempDir & "\FXDZHXN.SYS" ,190,330,194,54)
GUICtrlSetCursor($icon,0)

 
      
              GUICtrlSetState($idpic,$GUI_DISABLE)

          
Local $idOK = GUICtrlCreateButton("Launch Notepad ",5,260, 95, 30)
GUICtrlSetFont($idOK,8.5,700)

GUICtrlSetTip($idOK,"Click Here To Launch Notepad")

 Local $fucj = GUICtrlCreateButton("Launch  CMD ",5,295,90,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($fucj,"Click Here To Launch Command Prompt") 

Local $fucm = GUICtrlCreateButton("Launch Paint ",5,330,90,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($fuck,"Click Here To Launch Paint")

Local $fucl = GUICtrlCreateButton("Launch Narrator ",5,365,95,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($fucl,"Click Here To Launch Narrator")

Local $fucg = GUICtrlCreateButton("Launch Wordpad ",535,260,100,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($fucg,"Click Here To Launch Wordpad")

 Local $fucs = GUICtrlCreateButton("Launch System Info. ",515,295,120,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($fucs,"Click Here To See Your System's Information")

Local $fuch = GUICtrlCreateButton("Launch Registry Editor ",500,330,135,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($fuch,"Click Here To Make Changes To Your Registry ")

Local $fuci = GUICtrlCreateButton("Launch Resource Monitor ",485,365,150,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($fuci,"Click Here To Monitor Your Resources")

Local $about = GUICtrlCreateButton("About",545,5,90,30)
GUICtrlSetFont(-1,8.5,700)
GUICtrlSetTip($about,"Click Here To Get Some Intel About US")

 Local $Check = GUICtrlCreateCheckbox("",105,305,13,13)

GUICtrlSetTip($Check,"Check This To Run CMD As Admin") 

               
WinSetTrans($hGUI,"",220)
GUISetState(@SW_SHOW,$hGUI)




    While 1
        Switch GUIGetMsg()

Case $idOK
ShellExecute("notepad.exe")
Case $fucj
 If (GUICtrlRead($Check) = $GUI_CHECKED) Then
ShellExecute("cmd.exe","","runas")
Else
ShellExecute("cmd.exe")
EndIf
Case $fucm
ShellExecute("mspaint.exe")
Case $fucl
ShellExecute("Narrator.exe")
Case $fucg
ShellExecute("C:\Program Files\Windows NT\Accessories\wordpad.exe")
Case $fucs
ShellExecute("msinfo32.exe")
Case $fuch
ShellExecute("regedt32.exe")
Case $fuci
ShellExecute("resmon.exe")
Case $about  
MsgBox(8256,"Launcher - About","Launcher - By PC HACKZ" & @CRLF & "" & @CRLF & "Version - 1.0" & @CRLF & "" & @CRLF & "Made By PC HACKZ" & @CRLF & "" & @CRLF & "Like US & Share our posts." & @CRLF & "" & @CRLF & "Visit www.pchackz.wordpress.com ." & @CRLF & "")
Case $icon
ShellExecute("www.pchackz.wordpress.com")
Case -3
FileDelete( @TempDir & "\FXDZHXE.SYS")
FileDelete( @TempDir & "\FXDZHXN.SYS")
Exit



        EndSwitch

    WEnd
 

EndFunc

Please help.

Posted (edited)

There's way too much to sift through and running your code opened up 50 tabs on my browser before I shut it down. Here's an example to use GUICtrlRead on a checkbox.

#include <GUIConstants.au3>
#include <AutoItConstants.au3>

Global $hGUI = GUICreate("Example", 160, 40)
Global $btnCmd = GUICtrlCreateButton("Run Cmd", 10, 10, 80, 20)
Global $chkRunAs = GUICtrlCreateCheckbox("Run As", 100, 10, 50)

GUISetState(@SW_SHOW, $hGUI)

While (True)
    Switch (GUIGetMsg())
        Case $GUI_EVENT_CLOSE
            GUIDelete($hGUI)
            Exit 0
        Case $btnCmd
            If (GUICtrlRead($chkRunAs) = $GUI_CHECKED) Then
                ConsoleWrite("Running as" & @CRLF)
                RunAs(@UserName, @ComputerName, "Password", $RUN_LOGON_NOPROFILE, "cmd.exe")
            Else
                ConsoleWrite("Not running as" & @CRLF)
                ShellExecute("cmd.exe")
            EndIf
    EndSwitch
WEnd

 

Edited by InunoTaishou
Posted

Using debug code (usually the next step if something isn't working) determined that it is checking that the checkbox control is checked and using.

After that you need to actually run cmd as admin. And since this question has been asked countless times, here's a link to a thread I selected from my google search.

 

 

 

  • Jos locked and unlocked this topic
  • Developers
Posted (edited)
1 hour ago, farhadrahman2 said:

What is this PC Hackz TM all about? 
Doesn't sound as any good.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...