
madasraka
Active Members-
Posts
147 -
Joined
-
Last visited
About madasraka
- Birthday May 9
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
madasraka's Achievements

Adventurer (3/7)
0
Reputation
-
How to stop ENTER key from pressing button ?
madasraka replied to madasraka's topic in AutoIt General Help and Support
Ah, got it. My bad. $CommentPrompt = GUICtrlCreateEdit ("",0,200, 200, 110,$ES_AUTOHSCROLL+$ES_MULTILINE+$ES_WANTRETURN) -
How to stop ENTER key from pressing button ?
madasraka replied to madasraka's topic in AutoIt General Help and Support
OK but that still does not allow me to create new line into comment section by pressing ENTER. $CommentPrompt = GUICtrlCreateEdit ("",0,200, 200, 110,$ES_AUTOHSCROLL,$ES_MULTILINE) How to fix that ? -
I have a simple GUI asking for name, login, password and comment. Problem is, i cant press ENTER when typing in the comment control because when i do, CREATE button is pressed. In fact, no matter what field is active, pressing ENTER will always activate the button. This prevents me from typing multiple likes in the Edit control. How to solve this ?
-
madasraka reacted to a post in a topic: Shorten this code and remove the junk...
-
_Service_UDF v4 : Build your own service with autoit code
madasraka replied to arcker's topic in AutoIt Example Scripts
I use 3.3.14.5 Not XP either. Isn't 3.3.14.5 the latest for years now ? -
_Service_UDF v4 : Build your own service with autoit code
madasraka replied to arcker's topic in AutoIt Example Scripts
I get ton of errors when i try to create service with this: #include "Services.au3" $sServiceName = StringTrimRight (@ScriptName,4) ;returns filename only no extension $sDisplayName= StringTrimRight (@ScriptName,4) ;returns filename only no extension $iServiceType = $SERVICE_WIN32_OWN_PROCESS $iStartType = $SERVICE_AUTO_START $iErrorControl = $SERVICE_ERROR_IGNORE $sBinaryPath = @ScriptFullPath $sLoadOrderGroup = Default $fTagId = Default $vDependencies = Default $sServiceUser = Default $sPassword = Default $sComputerName = "" _Service_Create($sServiceName, $sDisplayName, $iServiceType, $iStartType, $iErrorControl, $sBinaryPath, $sLoadOrderGroup = Default, $fTagId = Default, $vDependencies = Default, $sServiceUser = Default, $sPassword = Default, $sComputerName = "") error: logprint(): undefined function. error: _Main(): undefined function. $pArgs: possibly used before declaration. And many man more. What am i missing ? -
bump How do i read those filenames off that editbox in loop function and move those files (rename in this case)? I could do the search and move again using your examples, but then it wont be "Move listed" since user might remove some files from the list. If possible then maybe create a new variable for every single found file, so then i can use those variables, but then i dont know how to get this done.
-
Ok this is interesting:: My script 1st searches and outputs found files into editbox (not into array) Then with a press of another button i want to move found files. Problem is that i cant move those files without stringing whole editbox (somehow) to read individual filenames to move one at the time. So i thought if once files found and displayed, each found file would also have its own $n bumber to which i can refference in filemove command. for example: Picture shows that there are multiple file names reflected in editbox How do i read those filenames off that editbox in loop function and move those files (rename in this case)? I could do the search and move again using your examples, but then it wont be "Move listed" since user might remove some files from the list.
-
LOL ofcourse i need help One thing i see here is _ArrayDisplay I dont need it to be displayed as poped out of nowhere. It must be shown as part of GUI instead of editbox. But thanks i will look into this harder this time.
-
Im doing basic filesearch, but with the returned result in the loop instead of showind it up in guyctrlcreateedit i want it to create new variable for each found file. There can be 100's of files found and displaying them in the edit box is good idea to see them, but to read individual file name from editbox is complicated. IS there a way to make my script to "once found file matchinc the pattern" create new variable and assign filename to that variable ? This way i dont have to create 1000000 variables in my script in case if there are 1000000 files found $SearchHandle = FileFindFirstFile ($Address & "\" & $Pattern) ;pattern *.* While 1 $Search = FileFindNextFile ($SearchHandle) If $Search > "" Then Assign ("created variable ?",$Search,2) ;2 to create global ? GUICtrlSetData ($List,$Search & @CRLF,"Edit") ; put found name into editbox Else ExitLoop EndIf WEnd At the "Assign ("created variable ?",$Search,2)" its not creating anything as i would expect it too. Is there something wrong or i dont understand how this works ? Please help, this bugges me for a very long time and puts my work to limits allot.
-
Turns out guictrlread returns not only the correct window name, but 1 space after it so its "WINDOWNAME " instead of "WINDOWNAME" THats why winexist could not find it no matter what option i chose. I ended up trimming the result with Case $SelectWindow $ReadSelectedWindow = GUICtrlRead ($WinList,"ListView") $FixedName = StringTrimRight(GUICtrlRead ($ReadSelectedWindow),2) GUICtrlSetData ($WindowName,$FixedName)
-
whole title is defined. Window list lists all windows (visible) and SELECT will assign window name to guictrlcreateedit Then its read by guictrlread MSGBOX says windows name is exactly as its displayed, yet WinExist (guictrlread ($windowname)) = 0 somehow. Can you try this code and see for your self ? Maybe i have a virus ? But even if i do, i know its not in the system but stored else where (and its only reported as a virus but what is a "virus" really ? ""illegal functions application"" or those normal users should not have access to but lets not talk about that please.)
-
i still have no clue for why its not finding the window when name is a variable. Only when i use Static name instead of it being a $windowname = guictrlread ($var) Can anyone look at my code and see what might be the problem ? Because i dont see anything wrong with it (in that case)
-
no luck
-
using this code. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=shutdown.ico #AutoIt3Wrapper_outfile=..\ShutDowner.exe #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Date.au3> #Include <ScreenCapture.au3> #include <ListviewConstants.au3> #Include <Array.au3> #include <Process.au3> Opt ("Wintitlematchmode",2) Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1+2) TraySetToolTip ("ShutDowner") Global $option $ReadLastDay = IniRead("ShutDowner.ini", "Time", "LastDays", "") $ReadLastHour = IniRead("ShutDowner.ini", "Time", "LastHours", "") $ReadLastMinute = IniRead("ShutDowner.ini", "Time", "LastMinute", "") TrayCreateItem("Terminate and EXIT") TrayItemSetOnEvent(-1,"ExitFunction") ;function name $Form1 = GUICreate("ShutDowner", 460, 400) GUICtrlCreateGroup("How long to wait ?", 5, 3, 150, 180) GUICtrlCreateLabel("Day's", 30, 23) $Days = GUICtrlCreateInput($ReadLastDay, 10, 20, 20, 20) If GUICtrlRead ($Days) = "" Then GUICtrlSetData ($Days ,"0") GUICtrlCreateLabel("Hr's", 80, 23) $Hours = GUICtrlCreateInput($ReadLastHour, 60, 20, 20, 20) If GUICtrlRead ($Hours) = "" Then GUICtrlSetData ($Hours ,"0") GUICtrlSetLimit($Hours, 2) GUICtrlCreateLabel("Min's", 125, 23, 25) $Minutes = GUICtrlCreateInput($ReadLastMinute, 105, 20, 20, 20) If GUICtrlRead ($Minutes) = "" Then GUICtrlSetData ($Minutes ,"10") GUICtrlSetLimit($Minutes, 2) $optionInput = GUICtrlCreateInput("Please select desired action", 10, 40, 140) GUICtrlSetState (-1,$GUI_DISABLE) $reasonInput = GUICtrlCreateEdit("No reason specified", 10, 60, 140, 115) GUICtrlCreateGroup("Action's:", 160, 3, 90, 120) $optionLogoff = GUICtrlCreateRadio("LogOff", 170, 20) $optionShutDown = GUICtrlCreateRadio("ShutDown", 170, 40) $optionReboot = GUICtrlCreateRadio("Reboot", 170, 60) $optionStandby = GUICtrlCreateRadio("Standby", 170, 80) $optionHibernate = GUICtrlCreateRadio("Hibernate", 170, 100) GUICtrlCreateGroup("Optional:", 160, 123, 90, 60) $optionForceCloseApps = GUICtrlCreateCheckbox("Force", 165, 140) GUICtrlSetState (-1,$GUI_CHECKED) $optionForceAll = GUICtrlCreateCheckbox("Force if hung", 165, 160) GUICtrlSetState (-1,$GUI_CHECKED) $screenshot = GUICtrlCreateCheckbox ("Take Screenshot's before selected action.",10,190,220,15) GUICtrlSetTip (-1,"This option will save screenshots to:" & @CRLF & @DesktopDir & "\ShutDowner Date and Time.jpg") GUICtrlSetState (-1,$GUI_CHECKED) GUICtrlCreateGroup ("Process",5,210,245,40) $ProcessToClose = GUICtrlCreateInput ("",10,225,100,20) GUICtrlSetTip (-1,"Process name") $CloseProcess = GUICtrlCreateRadio ("Close",115,225) $WaitProcess = GUICtrlCreateRadio ("Wait till closed",160,225) $RefreshProcess = GUICtrlCreateButton ("Refresh list",255,335,100,15) $SelectProcess = GUICtrlCreateButton ("Select",255,350,100,15) $ListView = GUICtrlCreateListView ("Process ",255,10,100,320,$LVS_SORTASCENDING) $list1st = ProcessList() for $i = 1 to $list1st[0][0] If ($list1st[$i][1]) = "" Then ;empty Else GUICtrlCreateListViewItem($list1st[$i][0],$ListView) EndIf next GUICtrlCreateGroup ("Windows",5,250,245,40) Global $WindowName = GUICtrlCreateInput ("",10,265,100,20) GUICtrlSetTip (-1,"Window name") $CloseWindow = GUICtrlCreateRadio ("Close",115,265) $WaitWindow = GUICtrlCreateRadio ("Wait till closed",160,265) $WinList = GUICtrlCreateListView ("Window ",355,10,100,320,$LVS_SORTASCENDING) $Win1st = WinList() For $W1st = 1 to $Win1st[0][0] If $Win1st[$W1st][0] <> "" AND IsVisible($Win1st[$W1st][1]) Then GUICtrlCreateListViewItem ($Win1st[$W1st][0] & @LF,$WinList) EndIf Next $RefreshWindows = GUICtrlCreateButton ("Refresh Windows",355,335,100,15) $SelectWindow = GUICtrlCreateButton ("Select",355,350,100,15) GUICtrlCreateGroup ("Commands",5,290,245,105) $CommandLine1 = GUICtrlCreateEdit ("",10,305,190,80) GUICtrlSetTip (-1,"This can be one line command or a whole script." & @CRLF & "Generated Command.bat will be executed" & @CRLF & "Dont forget to add EXIT at the end of your script") $CommandTest = GUICtrlCreateButton ("Test it" ,205,305,40,80) GUICtrlSetTip (-1,"Test this command to see if it will work.") $button = GUICtrlCreateButton("Start Count Down", 255, 365, 200, 30) GUISetState(@SW_SHOW) GuiFunc() Func GuiFunc() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button If GUICtrlRead ($optionInput) = "Please select desired action" Then MsgBox(64,"Information","Please select desired action frst.") Else GUISetState(@SW_HIDE) _StartCountDown() EndIf Case $optionLogoff GUICtrlSetData($optionInput, "Logoff") $option = 0 Case $optionShutDown GUICtrlSetData($optionInput, "ShutDown") $option = 1 Case $optionReboot GUICtrlSetData($optionInput, "Reboot") $option = 2 Case $optionStandby GUICtrlSetData($optionInput, "Standby") $option = 32 Case $optionHibernate GUICtrlSetData($optionInput, "Hibernate") $option = 64 Case $optionForceCloseApps If GUICtrlRead($optionForceCloseApps) = $GUI_CHECKED Then ElseIf GUICtrlRead($optionForceCloseApps) = $GUI_UNCHECKED Then EndIf Case $optionForceAll If GUICtrlRead($optionForceAll) = $GUI_CHECKED Then ElseIf GUICtrlRead($optionForceAll) = $GUI_UNCHECKED Then EndIf Case $RefreshProcess GUICtrlDelete ($ListView) $ListView = GUICtrlCreateListView ("Process ",255,10,100,320,$LVS_SORTASCENDING) $list = ProcessList() for $i = 1 to $list[0][0] If ($list[$i][1]) = "" Then ;empty Else GUICtrlCreateListViewItem($list[$i][0],$ListView) EndIf next Case $SelectProcess $ReadSelected = GUICtrlRead ($ListView,"ListView") $FixedName = StringTrimRight(GUICtrlRead ($ReadSelected),1) GUICtrlSetData ($ProcessToClose,$FixedName) Case $RefreshWindows GUICtrlDelete ($WinList) $WinList = GUICtrlCreateListView ("Window ",355,10,100,320,$LVS_SORTASCENDING) $Win = WinList() For $W = 1 to $Win[0][0] ; Only display visble windows that have a title If $Win[$W][0] <> "" AND IsVisible($Win[$W][1]) Then GUICtrlCreateListViewItem ($Win[$W][0] & @LF,$WinList) EndIf Next Case $SelectWindow $ReadSelectedWindow = GUICtrlRead ($WinList,"ListView") $FixedName = StringTrimRight(GUICtrlRead ($ReadSelectedWindow),1) GUICtrlSetData ($WindowName,$FixedName) Case $CommandTest $ReadCommand = GUICtrlRead ($CommandLine1) FileDelete (@ScriptDir & "\Command.bat") FileWrite (@ScriptDir & "\Command.bat",$ReadCommand) RunWait (@ScriptDir & "\Command.bat",@ScriptDir) FileDelete (@ScriptDir & "\Command.bat") EndSwitch WEnd EndFunc ;==>GuiFunc Func _StartCountDown() Local $ActionRead = GUICtrlRead($optionInput) Local $ReadDays = GUICtrlRead($Days) Local $ReadHours = GUICtrlRead($Hours) Local $ReadMinutes = GUICtrlRead($Minutes) Local $ForceCloseRead = GUICtrlRead($optionForceCloseApps) Local $ForceFrozeRead = GUICtrlRead($optionForceAll) Local $reason = GUICtrlRead($reasonInput) If $ReadDays >= 365 Then MsgBox(64, "Days Error", "Please set from 0-364 days only") GUISetState(@SW_SHOW) Return EndIf If $ReadHours >= 24 Then MsgBox(64, "Hours Error", "Please set from 0-23 hours only") GUISetState(@SW_SHOW) Return EndIf If $ReadMinutes >= 60 Then MsgBox(64, "Minutes Error", "Please set from 0-59 minutes only") GUISetState(@SW_SHOW) Return EndIf If $ActionRead = "What to do" Then MsgBox(16, 'Error', 'Please select action first') GUISetState(@SW_SHOW) Return EndIf IniWrite("ShutDowner.ini", "Time", "LastDays", $ReadDays) IniWrite("ShutDowner.ini", "Time", "LastHours", $ReadHours) IniWrite("ShutDowner.ini", "Time", "LastMinute", $ReadMinutes) If $ForceCloseRead = 1 Then $option += 4 If $ForceFrozeRead = 1 Then $option += 16 $timer = TimerInit() $ShutDowntime = (((($ReadDays*24)+$ReadHours)*60)+$ReadMinutes)*60*1000 While 1 Local $ms = $ShutDowntime - TimerDiff($timer) If $ms < 0 Then If GUICtrlRead ($screenshot) = $GUI_CHECKED Then _ScreenCapture_Capture (@DesktopDir & "\ShutDowner D" & @MDAY & "M" & @MON & "Y"& @YEAR & " " & @HOUR & @MIN & @SEC & ".jpg" ) If ProcessExists (GUICtrlRead ($ProcessToClose)) = 1 Then If GUICtrlRead ($CloseProcess) = $GUI_CHECKED Then ProcessClose (GUICtrlRead ($ProcessToClose)) If GUICtrlRead ($WaitProcess) = $GUI_CHECKED Then ProcessWaitClose (GUICtrlRead ($ProcessToClose)) If GUICtrlRead ($screenshot) = $GUI_CHECKED Then _ScreenCapture_Capture (@DesktopDir & "\ShutDowner D" & @MDAY & "M" & @MON & "Y"& @YEAR & " " & @HOUR & @MIN & @SEC & ".jpg" ) EndIf If WinExists (GUICtrlRead ($WindowName))= 1 Then MsgBox(0,'',GUICtrlRead ($WindowName)) If GUICtrlRead ($CloseWindow) = $GUI_CHECKED Then WinClose (GUICtrlRead ($WindowName)) If GUICtrlRead ($WaitWindow) = $GUI_CHECKED Then WinWaitClose (GUICtrlRead ($WindowName)) If GUICtrlRead ($screenshot) = $GUI_CHECKED Then _ScreenCapture_Capture (@DesktopDir & "\ShutDowner D" & @MDAY & "M" & @MON & "Y"& @YEAR & " " & @HOUR & @MIN & @SEC & ".jpg" ) EndIf If GUICtrlRead ($screenshot) = $GUI_CHECKED Then _ScreenCapture_Capture (@DesktopDir & "\ShutDowner D" & @MDAY & "M" & @MON & "Y"& @YEAR & " " & @HOUR & @MIN & @SEC & ".jpg" ) $ReadCommandWait = GUICtrlRead ($CommandLine1) ;read whole command script FileDelete (@ScriptDir & "\Command.bat") ;delete command file FileWrite (@ScriptDir & "\Command.bat",$ReadCommandWait) ;write read command to file RunWait (@ScriptDir & "\Command.bat",@ScriptDir) ;execute command file FileDelete (@ScriptDir & "\Command.bat") ;delete command file If GUICtrlRead ($screenshot) = $GUI_CHECKED Then _ScreenCapture_Capture (@DesktopDir & "\ShutDowner D" & @MDAY & "M" & @MON & "Y"& @YEAR & " " & @HOUR & @MIN & @SEC & ".jpg" ) ;Shutdown($option,$reason) Sleep (1000) Exit Else ToolTip(GUICtrlRead ($optionInput) & " in " & StringFormat("%d days and \n%02d:%02d:%02d", Int($ms / 86400000), Mod(Int($ms / 3600000),24), Mod(Int($ms / 60000),60), Mod(Int($ms / 1000),60)),@DesktopWidth/2-70,@DesktopHeight/2-60,"ShutDowner CountDown") EndIf Sleep(100) WEnd EndFunc Func ExitFunction() Exit EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc I would select any visible window from the list, click Select button to assign window name to windows name edit control. Then i would ask If WinExists (GUICtrlRead ($WindowName))= 1 Then MsgBox(0,'',GUICtrlRead ($WindowName)) If GUICtrlRead ($CloseWindow) = $GUI_CHECKED Then WinClose (GUICtrlRead ($WindowName)) If GUICtrlRead ($WaitWindow) = $GUI_CHECKED Then WinWaitClose (GUICtrlRead ($WindowName)) If GUICtrlRead ($screenshot) = $GUI_CHECKED Then _ScreenCapture_Capture (@DesktopDir & "\ShutDowner D" & @MDAY & "M" & @MON & "Y"& @YEAR & " " & @HOUR & @MIN & @SEC & ".jpg" ) EndIf but its not finding any window unless i say If WinExists ("Start")= 1 Then where Start is the name of the windows from the list. Yet the MsgBox(0,'',GUICtrlRead ($WindowName)) returns the name correct. Any ideas why its not working ? It seems like its not reading the window name correctly. Please help. i am lost
-
How to pase to CMD with autoit
madasraka replied to madasraka's topic in AutoIt General Help and Support
Well i cant do JoHanatCent's example because this CMD script is something user has to type in instead of me having static function created. I ended up creating commnad.bat and run it. Question now is, does autoit passes users permissions to executed .bat file ? or how does it work ? Also do i need to worry about working directory when executing my .bat file ? caz if i dont, results are strange sometimes. For example folders would be created in system32 folder instead of where .bat was generated (@scriptdir)