Kenzo2011 Posted September 20, 2011 Posted September 20, 2011 Hi all, I want to execute itunes and show a service status of this service when I choose itunes at list view and press start button. I spend more time to research but I don't know how to do it. Please instruct me to solve this code. Thanks all !Process list.au3
JohnOne Posted September 20, 2011 Posted September 20, 2011 In order to get a nudge forward, its best you define what you mean by "status". AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jvanegmond Posted September 20, 2011 Posted September 20, 2011 Check out to get status from iTunes. github.com/jvanegmond
Kenzo2011 Posted September 20, 2011 Author Posted September 20, 2011 My purpose : I want to use autoit in order to open all programs in my computer such as autoit, yahoo, itunes, word, excel, firefox, media... without shortcut on a screen.If AutoIT is executed. It will show "AutoIT.exe is running" at Status in GUICtrlCreateListView.I know ProcessExists function to check service status but I don't know how to complete mycode.Because I am a newbie so I need to learn from your experience. Please instruct me how to write code. Many thanks !
JohnOne Posted September 21, 2011 Posted September 21, 2011 What you need to do is try something. You can post here for as long as you can be bothered, and you might get someone finish your code. Or you could read the help documentation on your listview and processexists function, have a go at implementing them and post your efforts. I guarantee you will get help quicker with the latter. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ripdad Posted September 21, 2011 Posted September 21, 2011 (edited) Forum tags and html are not cooperating. Anyway .. this should help. $itunes = GUICtrlCreateListViewItem("Itunes", $ListView1) GUICtrlSetData($itunes, '|' & ProcessExists('itunes.exe')) Edited September 21, 2011 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward
Kenzo2011 Posted September 21, 2011 Author Posted September 21, 2011 It work well. Thanks for your instruction, Hobby Coder !
Kenzo2011 Posted September 22, 2011 Author Posted September 22, 2011 Hi all,I can open the program and show service status. But it can not return 'not running' status when I close notepad.exe.Can you help me how to do that ? expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <Process.au3> Opt('MustDeclareVars', 1) Dim $listview, $notepad, $start, $close, $msg Execute_process() Func Execute_process() GUICreate("Execute program",380, 400,-1,-1) $listview = GUICtrlCreateListView("Program|Status", 40, 30, 300, 300, $WS_EX_ACCEPTFILES) $notepad = GUICtrlCreateListViewItem("Notepad | Not running", $listview) GUICtrlSetColor(-1, 0x0000CC) $start = GUICtrlCreateButton("Start", 40, 350, 100, 25) $close = GUICtrlCreateButton("Close", 240, 350, 100, 25) GUISetState() checkprocess() Global $last_forcus_list_view Do $msg = GUIGetMsg() Switch $msg Case $start Switch $last_forcus_list_view Case $notepad run("notepad.exe") GUICtrlSetData($notepad,"Notepad | Running") Case Else MsgBox(0,"","Start ?") EndSwitch Case $notepad $last_forcus_list_view=$notepad EndSwitch Until $msg = $close Exit EndFunc Func checkprocess() If ProcessExists("notepad.exe") Then GUICtrlSetData($notepad,"Notepad | Running") EndFunc Thanks for your sharing !
Kenzo2011 Posted September 24, 2011 Author Posted September 24, 2011 (edited) Pls, instruct me how to do it, everybody ! Edited September 24, 2011 by Kenzo2011
ripdad Posted September 24, 2011 Posted September 24, 2011 (edited) Here's something to play with ... expandcollapse popup#include "WindowsConstants.au3" #include "GUIConstantsEx.au3" #include "ListViewConstants.au3" #include "Process.au3" Opt('MustDeclareVars', 1) Local $listview, $notepad, $start, $close, $msg Execute_process() Func Execute_process() GUICreate("Execute program", 380, 400, -1, -1) $listview = GUICtrlCreateListView("Program|Status", 40, 30, 300, 300, $WS_EX_ACCEPTFILES) GUICtrlSendMsg($listview, 0x101E, 0, 140) GUICtrlSendMsg($listview, 0x101E, 1, 140) $notepad = GUICtrlCreateListViewItem("Notepad | Not running", $listview) GUICtrlSetColor(-1, 0x0000CC) $start = GUICtrlCreateButton("Start", 40, 350, 100, 25) $close = GUICtrlCreateButton("Close", 240, 350, 100, 25) GUISetState() checkprocess() Global $last_forcus_list_view AdlibRegister('checkprocess', 2000) While 1 $msg = GUIGetMsg() Switch $msg Case -3, $close ExitLoop Case $start Switch $last_forcus_list_view Case $notepad Run("notepad.exe") Case Else MsgBox(0, "", "Start ?") EndSwitch Case $notepad $last_forcus_list_view = $notepad EndSwitch WEnd EndFunc AdlibUnRegister('checkprocess') GUIDelete() Exit Func checkprocess() If ProcessExists("notepad.exe") Then GUICtrlSetData($notepad, "Notepad | Running") Else GUICtrlSetData($notepad, "Notepad | Not Running") EndIf EndFuncStill having problems with tags.IE: #include leftarrow/rightarrow and inbetween is missing unless I replace arrows with quotes "" html tags "p" and "/p" are in the edit code - which has not been in the past. Edited September 24, 2011 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward
Kenzo2011 Posted September 25, 2011 Author Posted September 25, 2011 Got it to work now. Thanks again for your support , Hobby !
Laymanball Posted September 26, 2011 Posted September 26, 2011 (edited) Credit: AutoIt help Thanks.. idea ripdad Discription:Select to run programs in the GUIctrl edit. I write modify code from help of autoit. #include <GUIConstantsEx.au3> #include <EditConstants.au3> GUICreate("My GUI", 220, 170, -1, -1) $nEdit = GUICtrlCreateEdit ("", 10, 30, 200, 100) GUICtrlCreateLabel("Clicked Program name to Run", 10, 10, 200) GUICtrlCreateButton ("RUN", 60, 140, 100) GUISetState () Dim $array[2] $array[0] = "=====Programs name=====" $array[1] = "Notepad"&@CRLF&"Calculator" $output = "" For $i = 0 To UBound($array)-1 $output = $output&$array[$i]&@CRLF Next GUICtrlSetData ($nEdit, $output) Do $msg = GUIGetMsg() If $msg > 0 Then $i = GUICtrlSendMsg($nEdit, $EM_LINEINDEX, -1, 0) $nline = GUICtrlSendMsg($nEdit, $EM_LINEFROMCHAR, $i, 0) GUICtrlSetState ($nEdit,$GUI_FOCUS) Select Case $nLine = 1 ShellExecute("Notepad.exe") Case $nLine = 2 ShellExecute("Calc.exe") Case Else MsgBox(4096, "", "No, Program name.") EndSelect EndIf Until $msg = $GUI_EVENT_CLOSE Edited September 27, 2011 by Laymanball My Sample Script Download: VistaDesktopIconsChangerForXp.au3 (Com,Doc and Bin only) http://www.4shared.com/rar/NMHYL5Igba/VistaDesktopIconsChangerForXp_.html VistaDesktopIconsChangerForXp.exe (Resources) http://www.4shared.com/rar/nzs7Mb1gba/VistaDesktopIconsChangerForXp_.html
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