Aces Posted June 13, 2007 Author Share Posted June 13, 2007 Just becuase this script isn't usefull to you doesn't mean it isn't usefull to him. Don't forget that everyone starts somewhere ... you can't tell me you made really usefull apps right when you first started. Instead of knocking his script, praise what he has and help him to improve Telling him to make something more usefull but not giving any help on how to accomplish that doesn't do much good.Hallmanthank you Hallman, and I will use the source code you created for me to learn more ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Aces Posted June 13, 2007 Author Share Posted June 13, 2007 Well a good habbit to get into is your formatting. The below code does exactly the same thing, but is easier to read. Make sure you use SciTE as your script editor ... it makes life MUCH easier The addon for SciTE called tidy can make your script look like the one below. I modified your GUI loop a bit to the more standard way autoit scripters typically do it ... with a select statement expandcollapse popup#include <GUIConstants.au3> GUICreate("CPU-Mach V0.2 - Made by Aces", 300, 400) $pic = GUICtrlCreatePic(@ScriptDir & "\space.jpg", 150, 10, 130, 300) $runmenu = GUICtrlCreateMenu("&Run") $runitem = GUICtrlCreateMenuItem("Run...", $runmenu) $shutdown = GUICtrlCreateButton("Power Off", 10, 10, 130, 50) $reboot = GUICtrlCreateButton("Reboot", 10, 70, 130, 50) $logoff = GUICtrlCreateButton("Log Off", 10, 130, 130, 50) $notepad = GUICtrlCreateButton("Notepad", 10, 190, 130, 50) $cmd = GUICtrlCreateButton("CMD Prompt", 10, 250, 130, 50) $ad1 = GUICtrlCreateLabel("CPU-Mach V0.2 - " & "Created by: Kevin Aces Morris @ kmorris91@gmail.com", 5, 350, 300, 50) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $shutdown poweroff() Case $msg = $reboot reboot() Case $msg = $logoff logoff() Case $msg = $notepad notepad() Case $msg = $cmd cmd() Case $msg = $runitem runmenu() EndSelect WEnd Func runmenu() $input = InputBox("Run...", "Please type the path you would like to run.") If $input <> "" Then Run($input) EndFunc ;==>runmenu Func cmd() MsgBox(0, "CMD Prompt", "Your CPU will open CMD Prompt when you press OK.") Run("cmd") EndFunc ;==>cmd Func notepad() MsgBox(0, "Notepad", "Your CPU will open notepad when you press OK.") Run("notepad") EndFunc ;==>notepad Func poweroff() MsgBox(0, "Shutdown", "Your CPU will power off when you press OK.") Shutdown(9) EndFunc ;==>poweroff Func reboot() MsgBox(0, "Reboot", "Your CPU will reboot when you press OK.") Shutdown(3) EndFunc ;==>reboot Func logoff() MsgBox(0, "Log Off", "Your CPU will log off when you press OK.") Shutdown(0) EndFunc ;==>logoffoÝ÷ Øìµæ¡øZ¾)àjg¬±¨ng¢ØÊØ^ºÇ«¶Ýý² "Ú!j^r`÷ér§qëhq©ÜzXî²Ø§q«¶²+mì+¢xºÛh·²Æ²ÊÛaÇè®Ø^®éç¢×©i×îËb¢r-Â¥vZ(X¤zØb±«¢+Ø)%5Í ½à Ä°ÅÕ½Ðí9½ÑÁÅÕ½Ðì°ÅÕ½Ðíe½ÕÈ ATÝ¥±°½Á¸¹½ÑÁÝ¡¸å½ÔÁÉÍÌ=,¸ÅÕ½Ðì¤ôÄQ¡¸IÕ¸ ÅÕ½Ðí¹½ÑÁÅÕ½Ðì¤( Now if the user clicks cancel, well, it cancels running notpad. You could do the same with the other ones two. Just remember to put a 1 for the first parameter of the MsgBox() function. It looks like your getting the hang of things just fine. Good luck scripting! Hallman Theres one problem I would like to fix with my GUI, when you input a program like 'services.msc' in the Run... function, it has an error message and closes. how do i make it not close? ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Aces Posted June 13, 2007 Author Share Posted June 13, 2007 Func reboot() If MsgBox(1, "Reboot", "Your CPU will reboot when you press OK.") = 1 Then Shutdown(3) EndFunc ;==>reboot End of statement is false [shutdown(3)] and when you cancel the CMD prompt it still loads it. by the way thanks if i didn't mention before. <3 ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Aces Posted June 13, 2007 Author Share Posted June 13, 2007 i tried this not knowing if it would do the same thing or help or not Func poweroff() If MsgBox(1, "Shutdown", "Your CPU will power off when you press OK.") = 1 Then shut1() If MsgBox() = 0 Then MsgBox(0, "Shutdown", "You have chosen to ignore the power off.") EndFunc ;==>poweroff but it still didnt work ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
CoderDunn Posted June 13, 2007 Share Posted June 13, 2007 (edited) lol, agreed, finally, a logical thinkersometimes Theres one problem I would like to fix with my GUI, when you input a program like 'services.msc' in the Run... function, it has an error message and closes. how do i make it not close? Most likely you can't "run" services.msc. Just like you cant run a bitmap. You must run Paint with command line parameters to the bitmap. Try "MMC.exe" End of statement is false [shutdown(3)] and when you cancel the CMD prompt it still loads it. hmm it works fine for me. And about the cmd prompt ... you must not have wrote the expression correctly. Here is a re-write of your functions. Func cmd() If MsgBox(1, "CMD Prompt", "Your CPU will open CMD Prompt when you press OK.") = 1 Then Run("cmd") EndFunc ;==>cmd Func notepad() If MsgBox(1, "Notepad", "Your CPU will open notepad when you press OK.") = 1 Then Run("notepad") EndFunc ;==>notepad Func poweroff() If MsgBox(1, "Shutdown", "Your CPU will power off when you press OK.") = 1 Then Shutdown(9) EndFunc ;==>poweroff Func reboot() If MsgBox(1, "Reboot", "Your CPU will reboot when you press OK.") = 1 Then Shutdown(3) EndFunc ;==>reboot Func logoff() If MsgBox(1, "Log Off", "Your CPU will log off when you press OK.") = 1 Then Shutdown(0) EndFunc ;==>logoff by the way thanks if i didn't mention before. <3 Happy to help Hallman Note: Instead of posting 4 times in a row ... just edit your post Edited June 13, 2007 by Hallman Link to comment Share on other sites More sharing options...
Aces Posted June 13, 2007 Author Share Posted June 13, 2007 Hallman, you're awesome. thanks for all your help, you've really helped me learn some new functions in au3 that will be useful in my future creations.I wanted to ask if you could take me under your wing, give me little tasks to do and what not.(SIDE NOTE: if you turn me down i will not take one bit of offense) ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
lokster Posted June 13, 2007 Share Posted June 13, 2007 Just becuase this script isn't usefull to you doesn't mean it isn't usefull to him. Don't forget that everyone starts somewhere ... you can't tell me you made really usefull apps right when you first started. Instead of knocking his script, praise what he has and help him to improve Telling him to make something more usefull but not giving any help on how to accomplish that doesn't do much good.HallmanYeah... you are right... I apologize In the matter of fact, my first "program" was made on an old 8-bit PC with built-in MSBASIC and was 5 lines long :D I was in the 6th grade then... This was my very first program. Memories, memories... Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 13, 2007 Share Posted June 13, 2007 The CPU moniker does need to be changed. The processor does not run programs. It doesn't do anything except perform mathematical operations. It doesn't actually shut down, the operating system shuts down. Other than that, it's a good beginner script, but if you want to run files that do not execute on their own, use ShellExecute. It will search the operating systems registry for the correct application to run it with. Link to comment Share on other sites More sharing options...
Aces Posted July 9, 2007 Author Share Posted July 9, 2007 (edited) Updated to v2.0 guys, check it out much smoother EDIT: gotten better at coding au3 so its a bit more touched up and working a little better Edited July 9, 2007 by Aces ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Aces Posted July 9, 2007 Author Share Posted July 9, 2007 bumpity ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
idusy Posted July 9, 2007 Share Posted July 9, 2007 first of all cpu is the core of the computer, if you shut down the CPU you are shutting down the computer.second of all, my shut down methods are fine.. they work perfectly okay - no need to bad name my program...He didn't bad name your script at all - He only gave a suggestion, as you asked of him. Link to comment Share on other sites More sharing options...
Generator Posted July 10, 2007 Share Posted July 10, 2007 Added screensaver for a bit touch expandcollapse popup#include <GUIConstants.au3> opt("RunErrorsFatal", 0) $GUItitle = "CPU-Mach v2.0" $Form1 = GUICreate($GUItitle, 301, 401, 212, 152) $Button1 = GUICtrlCreateButton("[ Power Off ]", 24, 32, 121, 57, 0) $Button2 = GUICtrlCreateButton("[ Reboot ]", 24, 96, 121, 57, 0) $Button3 = GUICtrlCreateButton("[ Log Off ]", 24, 160, 121, 57, 0) $Button4 = GUICtrlCreateButton("[ Stand-By ]", 24, 224, 121, 57, 0) $Label1 = GUICtrlCreateLabel("Created By: Aces-X @ AcesX91@acecoding.net", 24, 320, 252, 41) $Pic1 = GUICtrlCreatePic("space.jpg", 152, 8, 145, 297, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem3 = GUICtrlCreateMenuItem("Run", $MenuItem1) $MenuItem4 = GUICtrlCreateMenuItem("Quit", $MenuItem1) $MenuItem5 = GUICtrlCreateMenu("Extras") $MenuItem7 = GUICtrlCreateMenuItem("Run Screensaver",$MenuItem5) $MenuItem2 = GUICtrlCreateMenu("About") $MenuItem6 = GUICtrlCreateMenuItem("About Us", $MenuItem2) GUICtrlSetBkColor($Button1, 0x000000) GUICtrlSetBkColor($Button2, 0x000000) GUICtrlSetBkColor($Button3, 0x000000) GUICtrlSetBkColor($Button4, 0x000000) GUICtrlSetColor($Button1, 0xFF0000) GUICtrlSetColor($Button2, 0x33FF00) GUICtrlSetColor($Button3, 0xCCFF00) GUICtrlSetColor($Button4, 0xCCFFFF) GUICtrlSetFont($Button1, 9, 1000) GUICtrlSetFont($Button2, 9, 1000) GUICtrlSetFont($Button3, 9, 1000) GUICtrlSetFont($Button4, 9, 1000) GUICtrlSetFont($Label1, 8, 1000) GUISetState(@SW_SHOW) ;;Start Main Script While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $QuitBox = MsgBox(4, $GUItitle, "Are you sure you want to quit " & $GUItitle & "?") If $QuitBox = 6 Then Exit ElseIf $QuitBox = 7 Then MsgBox(0, $GUItitle, "Returning to " & $GUItitle & "...", 1) EndIf Case $Button1 Poweroff() Case $Button2 Reboot() Case $Button3 Logoff() Case $Button4 Standby() Case $MenuItem3 RunMenu() Case $MenuItem4 Quit() Case $MenuItem6 AboutUs() Case $MenuItem7 _Screensaver() EndSwitch WEnd ;;Functions Func RunMenu() $input = InputBox("Run...", "Please type the path/file you would like to run.") $Run = Run($input) If $Run = @error Then MsgBox(0, $GUItitle, "Could not run " & $input & " at this time.") EndIf EndFunc Func Standby() If MsgBox(1, "Standby", "Your CPU will stand by when you press OK.") = 1 Then Shutdown(32) EndIf EndFunc Func Poweroff() If MsgBox(1, "Shutdown", "Your CPU will power off when you press OK.") = 1 Then Shutdown(9) EndIf EndFunc Func Reboot() If MsgBox(1, "Reboot", "Your CPU will reboot when you press OK.") = 1 Then Shutdown(3) EndIf EndFunc Func Logoff() If MsgBox(1, "Log Off", "Your CPU will log off when you press OK.") = 1 Then Shutdown(0) EndIf EndFunc Func Quit() $QuitBox = MsgBox(4, $GUItitle, "Are you sure you want to quit " & $GUItitle & "?") If $QuitBox = 6 Then Exit ElseIf $QuitBox = 7 Then MsgBox(0, $GUItitle, "Returning to " & $GUItitle & "...", 1) EndIf EndFunc Func AboutUs() MsgBox(0, $GUItitle & " - About Us", "Ace Coding Development was created June 28th, 2007. Coder Aces-X had a gut feeling, this was the time he had to persue his coding dreams and create software in the deed that he would be helping people that needed it. Ace Coding Development has great pride in its software and will always try and do what it can do to make other people better coders. www.AceCoding.net support us please, sign up for the forums today! Thank you.") Return 1 EndFunc Func _Screensaver() Local $RegRead = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "SCRNSAVE.EXE") ShellExecute($RegRead) ;Give credit to AutoIt EndFunc Link to comment Share on other sites More sharing options...
Aces Posted July 10, 2007 Author Share Posted July 10, 2007 i appreciate your effort Generator but im kind of looking for suggestions instead of revisions, thanks ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Aces Posted July 10, 2007 Author Share Posted July 10, 2007 He didn't bad name your script at all - He only gave a suggestion, as you asked of him.Yeah sorry whoever I was rude too I was like triple tasking a lot at the beginning of this thread. ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Aces Posted July 11, 2007 Author Share Posted July 11, 2007 still accepting suggestions for future revisions (things to add, things to change, etc) but please don't post with "heres one, you suck" ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public 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