Leaderboard
Popular Content
Showing content with the highest reputation on 05/30/2018 in all areas
-
I've made a library, based on AutoItObject UDF with the goal of implementing getter and setter functionality and make it possible to define new object properties in as few steps as possible. Thank you to @trancexx for getting me on the right track, and all users in Hooking into the IDispatch interface for the code to get me going. If I've forgotten to add credit, please let me know Example: #include "AutoItObject_Internal.au3" $myCar = IDispatch() $myCar.make = 'Ford' $myCar.model = 'Mustang' $myCar.year = 1969 $myCar.__defineGetter('DisplayCar', DisplayCar) Func DisplayCar($oThis) Return 'A Beautiful ' & $oThis.parent.year & ' ' & $oThis.parent.make & ' ' & $oThis.parent.model EndFunc MsgBox(0, "", $myCar.DisplayCar) More examples: https://github.com/genius257/AutoItObject-Internal/tree/master/Examples Version: 4.0.1 AutoItObject_Internal.au3 Documentation Edit2 (19th March 2017): First of all, sorry about the lack of updates on this project. I always start too many projects and end up ignoring old projects, if I run into problems ^^'. So I've started moving my AutoIt scripts to GitHub. I will still post the most recent script version here.1 point
-
TV-Show-Manager is a small, easy to use application that manages all your favorite tv shows. It is a perfect program for you, if you like watching many tv-shows and need help with keeping track of the airdates and times. Features Manage all your favorite TV-Shows with a single program See all airing times of your shows and how many days/hours/minutes you have to wait for the next episode Don't get confused with all the time zones, TV-Show-Manager converts the airing times to your timezone TV-Schedule - See what shows will be airing in the next 48 hours in US an UK Windows 10 inspired user interface - Customize the user interface with different themes See if your favorit tv shows are canceled or renewed with colored status in your list. Download episodes with one click! (Warning: See notes in full description) Supports link collection for one-click hosters and torrents. (Warning: See notes in full description) Stream episodes with one click (Warning: See notes in full description) I have completely rewritten the program over the past months. It uses the latest version of my MetroGUI UDF and demonstrates what you can do with Autoit if you put in enough time You can download the script and the main program from sourceforge. I have removed all download link collection and other anti-bot-protection bypass features from the script that might be used to damage the site owners. So please don't ask for any of these functions on this forum. Images: Download Script and Main program: https://sourceforge.net/projects/tvshowcountdown/files/1 point
-
Thanks a ton dude... I added the sleeps in there because the program kept 'missing'.. and I thought that maybe the program was missing because the server was lagging or something. Sooo.. turns out my mistake was really simple and stupid. I was calling the wrong file, I realized it after I tried what you posted and noticed that it was still broken and wasn't working. So I tried to move the file to the script directory thinking that it was a file access issue... turns out, I was looking for IC3A.txt, and not ic3.txt.... It was trying to process an empty file the whole time, and working correctly. Also thanks for those error message notes, I've updated all that. Anyways, thanks for all your help, you rock1 point
-
@BatMan22 Also, if/when you encounter errors, you usually want to exit or stop processing that piece of code. Your code continues regardless of errors.1 point
-
Although it is a bit of a mess, here is your code that works for me. I commented out unnecessary lines and lines that would not compile because the references do not exist. #include <Array.au3> #include <File.au3> ProcessAndCleanFiles("ic3.txt") Func ProcessAndCleanFiles($filetocleanup) ; Basically deletes the /'s at the end of a sample analytes ;~ $filetocleanup = "X:\MacroShare\IC3A.txt" ;~ If _PathIsWritable(@SystemDir) = False Then MsgBox(0, 0, "You're not running as an admin.") ;~ If _PathIsWritable($filetocleanup) = False Then MsgBox(0, 0, "You don't have access to IC3 files!") ;~ MsgBox(0, '', _PathIsWritable("X:\MacroShare\IC3A.txt")) ;~ MsgBox(0, 0, "This file's existence is: " & FileExists("X:\MacroShare\IC3A.txt")) Local $sS = FileOpen($filetocleanup) If $sS = -1 Then ;~ Sleep(500) ;~ Local $sS = FileOpen($filetocleanup) MsgBox("ERROR", "ERROR @ LINE # " & @ScriptLineNumber, 10) ConsoleWrite("Error @ " & @ScriptLineNumber & @CRLF) Exit EndIf ;~ Sleep(100) $Whattowrite = FileRead($sS) If @error Then MsgBox(0, "Error", "Fileclose error @ Line: " & @ScriptLineNumber & " @error: " & @error) ;~ _ArrayDisplay($Whattowrite) Exit EndIf MsgBox(0, "", $Whattowrite) ;~ Sleep(100) $Whattowrite = StringRegExpReplace($Whattowrite, "(?m)(.*)/(\s.*$)", "$1$2") ; RegExp If @error Then ;~ Sleep(500) MsgBox(0, 0, "ERROR FIRST", "ERROR @ LINE # FIRST" & @ScriptLineNumber) ;~ Sleep(1000) $Whattowrite = StringRegExpReplace(FileRead($filetocleanup), "(?m)(.*)/(\s.*$)", "$1$2") ; RegExp MsgBox(0, 0, "ERROR FIRST", "ERROR @ LINE # FIRST" & @ScriptLineNumber) ConsoleWrite("Error @ " & @ScriptLineNumber & @CRLF) EndIf ;~ Sleep(200) ; ERROR PRONE! FileClose($sS) Local $hFileOpen = FileOpen($filetocleanup, 2) If @error Then ;~ Sleep(500) ;~ Local $hFileOpen = FileOpen($filetocleanup, 2) MsgBox(0, 0, "ERROR FIRST", "ERROR @ LINE # FIRST" & @ScriptLineNumber) ConsoleWrite("Error @ " & @ScriptLineNumber & @CRLF) EndIf ;~ Sleep(100) If $hFileOpen = -1 Then MsgBox(0, "", "An error occurred when reading the file.") Return False EndIf ;~ Sleep(100) FileWrite($filetocleanup, $Whattowrite) ;~ Sleep(100) Local $aFile, $aArray _FileReadToArray($filetocleanup, $aFile, $FRTA_NOCOUNT) $aArray = _ArrayUnique($aFile) _ArrayDelete($aArray, 0) _FileWriteFromArray($filetocleanup, $aArray) ;~ FileClose($sS) ;~ If @error Then MsgBox(0, "Error", "Fileclose error @ Line: " & @ScriptLineNumber) FileClose($hFileOpen) If @error Then MsgBox(0, "Error", "Fileclose error @ Line: " & @ScriptLineNumber) ;~ MsgBox(0, 0, "running1") EndFunc ;==>ProcessAndCleanFiles1 point
-
@Densie You are welcome but please let me know why its so hard to find all the wonderfull introduction pages or help of AutoIt https://www.autoitscript.com/wiki/Main_Page1 point
-
days of week for a date
Earthshine reacted to jchd for a topic
Both functions work but since the OP seemed to want the day longname as well in his code, it's preferable to use _DateToDayOfWeek as it's Sunday-based just like _DateDayOfWeek. Of course if the goal is to decide if workday or not, then test for 6 or 7 is good enough.1 point -
days of week for a date
Earthshine reacted to jchd for a topic
You're misusing the _DateDayOfWeek function: it doesn't do what you believe it does. Local $sDate ="2018/05/30" Local $sNewDate, $aYMD, $iDoW, $sLongDayName For $x = 0 To 3 $sNewDate = _DateAdd('D', $x, $sDate) $aYMD = StringSplit($sNewDate, "/", 2) $iDoW = _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]) $sLongDayName = _DateDayOfWeek($iDoW, 2) MsgBox($MB_SYSTEMMODAL, "", "The date is : " & $sNewDate & " " & $sLongDayName) Next1 point -
The zip file below contains small scripts that develops the code in five steps. The final GUI looks like this: When you move the mouse in a circle, the red circle rolls around the periphery of the blue circle. From the center of the red circle, a line is drawn through the center of the blue circle until it hits one of the edges of the square. Here the line is reflected until it hits a new edge and is reflected again. Note check for invalid angles this way: If $fAngle == "-1.#IND" Then You should try it. It looks pretty amazing. Alex1986, Interesting topic. Reflection.7z1 point
-
OnKeyPress-Event for Input boxes
behdadsoft reacted to Melba23 for a topic
Sn0opy, I wrote this some time ago - it uses a List rather than a ListView, but the principles would be the same: #include <GUIConstantsEx.au3> #include <Array.au3> #Include <GuiListBox.au3> Global $hGUI, $hInput, $hList, $sPartialData, $asKeyWords[100] ; Create list full of random 12 character "words" Keywords() $hGUI = GUICreate("Example", 200, 400) $hInput = GUICtrlCreateInput("", 5, 5, 190, 20) $hList = GUICtrlCreateList("", 5, 30, 190, 325, BitOR(0x00100000, 0x00200000)) $hButton = GUICtrlCreateButton("Read", 60, 360, 80, 30) $hUP = GUICtrlCreateDummy() $hDOWN = GUICtrlCreateDummy() $hENTER = GUICtrlCreateDummy() GUISetState(@SW_SHOW, $hGUI) ; Set accelerators for Cursor up/down and Enter Dim $AccelKeys[3][2]=[["{UP}", $hUP], ["{DOWN}", $hDOWN], ["{ENTER}", $hENTER]] GUISetAccelerators($AccelKeys) $sCurr_Input = "" $iCurrIndex = -1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hList $sChosen = GUICtrlRead($hList) If $sChosen <> "" Then GUICtrlSetData($hInput, $sChosen) Case $hButton If $sPartialData <> "" Then $sFinal = GUICtrlRead($hInput) If _ArraySearch($asKeyWords, $sFinal) > 0 Then MsgBox(0, "Chosen", $sFinal) EndIf EndIf Case $hUP If $sPartialData <> "" Then $iCurrIndex -= 1 If $iCurrIndex < 0 Then $iCurrIndex = 0 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hDOWN If $sPartialData <> "" Then $iTotal = _GUICtrlListBox_GetCount($hList) $iCurrIndex += 1 If $iCurrIndex > $iTotal - 1 Then $iCurrIndex = $iTotal - 1 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hENTER If $iCurrIndex <> -1 Then $sText = _GUICtrlListBox_GetText($hList, $iCurrIndex) GUICtrlSetData($hInput, $sText) $iCurrIndex = -1 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf EndSwitch ; If input has changed, refill list with matching items If GUICtrlRead($hInput) <> $sCurr_Input Then CheckInputText() $sCurr_Input = GUICtrlRead($hInput) EndIf WEnd Func CheckInputText() $sPartialData = "|" ; Start with delimiter so new data always replaces old Local $sInput = GUICtrlRead($hInput) If $sInput <> "" Then For $i = 0 To 99 If StringInStr($asKeyWords[$i], $sInput) <> 0 Then $sPartialData &= $asKeyWords[$i] & "|" Next GUICtrlSetData($hList, $sPartialData) EndIf EndFunc ;==>CheckInputText Func Keywords() Local $sData For $i = 0 To 99 For $j = 1 To 12 $asKeyWords[$i] &= Chr(Random(65, 90, 1)) Next $sData &= $asKeyWords[$i] & "|" Next GUICtrlSetData($hList, $sData) $iCurrIndex = -1 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndFunc ;==>KeywordsThe list is filled with random 12-letter "words" - just start typing random letters in the input and only items in the list containing the string in the input will appear. I hope it helps - if not let me know and we can work on tailoring it to your precise needs. M231 point -
Label with border display no text
behdadsoft reacted to SmOke_N for a topic
Same concept:#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> LabelEx() Func LabelEx() GUICreate("My GUI state"); will create a dialog box that when displayed is centered _GUICtrlCreateLabel_ColorBorder(0xFF0000, "aaaa", 125, 100, 186, 95) GUISetState() ; Run the GUI until the dialog is closed While GUIGetMsg() <> -3 WEnd EndFunc Func _GUICtrlCreateLabel_ColorBorder($i_color, $s_text, $i_left, $i_top, $i_width = -1, $i_height = -1, $i_style = -1, $i_exstyle = -1) GUICtrlCreateLabel("", $i_left - 1, $i_top - 1, $i_width + 2, $i_height + 2) GUICtrlSetBkColor(-1, 0xFF0000) Return GUICtrlCreateLabel($s_text, $i_left, $i_top, $i_width, $i_height, $i_style, $i_exstyle) EndFunc1 point