Jump to content

Shinies

Active Members
  • Posts

    95
  • Joined

  • Last visited

Everything posted by Shinies

  1. Understood, thank you for the help Dale
  2. Dale from some of my previous testing before posting, using that UDF caused the embedded window to lose visibility when another child window is placed over it. Did not find out how to get around that problem.
  3. Good thinking mate! However in that script pressing backspace would delete content from the edit control no matter where the input was focused. Ive made a slight change so that it only deletes from the control if the control is selected, otherwise it will not. There are quite possibly some other issue that will continue to arise from the embedded IE, so it may be more simple to use the native edit control rather than the UDF version. Heres the code for anyone else who might run into this problem though: EIDT: Cut off my damn includes again, lol! Whats up with that... ;========================================================================================== #include <ie.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #Include <ScrollBarConstants.au3> #include <WinAPI.au3> ;Mainwindow $WinMain = GUICreate("hello", 510, 510) $MainMsgBoardInput = _GUICtrlEdit_Create($winmain, "", 1, 439, 498, 50, BitOR($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)) $oMainIE = _IECreateEmbedded() GUICtrlCreateObj($oMainIE, 1, 1, 498, 435) $backspace = GUICtrlCreateDummy() Dim $AccelKeys[1][2] = [["{BACKSPACE}", $backspace]] GUISetAccelerators($AccelKeys,$winmain) _IENavigate($oMainIE, "about:blank") ;Perform starup operations GUISetState(@SW_SHOW) While 1 $mMsg = GUIGetMsg() Switch $mMsg Case $backspace If _WinAPI_GetFocus() = $MainMsgBoardInput Then $out = _GUICtrlEdit_GetText($MainMsgBoardInput) _GUICtrlEdit_SetText($MainMsgBoardInput,StringTrimRight($out,1)) _GUICtrlEdit_SetPos($MainMsgBoardInput, -1, -1) EndIf Case -3 Exit EndSwitch WEnd ;http://www.autoitscript.com/forum/topic/124099-howto-get-cursor-position-in-multiline-edit/ ; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlEdit_SetPos ; Description....: Sets the caret to the specified line and column. ; Syntax.........: _GUICtrlEdit_SetPos ( $hWnd, $iLine [, $iColumn] ) ; Parameters.....: $hWnd - Handle or identifier (controlID) to the control. ; $iLine - The zero-based index of the line on which must set the caret. If this parameter is (-1), ; the caret will be set on the last line. ; $iColumn - The zero-based index of the column on which must set the caret. If this parameter is (-1), ; the caret will be set at the end of the specified line. Default is 0. ; Return values..: Success - 1. ; Failure - 0 and sets the @error flag to non-zero. ; Author.........: Yashied ; Modified.......: ; Remarks........: None ; Related........: _GUICtrlEdit_Scroll(), _GUICtrlEdit_SetSel() ; Link...........: None ; Example........: Yes ; =============================================================================================================================== Func _GUICtrlEdit_SetPos($hWnd, $iLine, $iColumn = 0) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) If $hWnd = 0 Then Return SetError(1, 0, 0) EndIf EndIf Local $Lenght, $Num = 0, $Count = _GUICtrlEdit_GetLineCount($hWnd) If $iLine > $Count - 1 Then $Num = _GUICtrlEdit_GetTextLen($hWnd) Else If $iLine < 0 Then $iLine = $Count - 1 EndIf For $i = 0 To $iLine - 1 $Num += _GUICtrlEdit_LineLength($hWnd, $i) + 2 ; + @CR + @LF Next $Lenght = _GUICtrlEdit_LineLength($hWnd, $iLine) If ($iColumn < 0) Or ($iColumn > $Lenght) Then $iColumn = $Lenght EndIf $Num += $iColumn EndIf _GUICtrlEdit_SetSel($hWnd, $Num, $Num) _GUICtrlEdit_Scroll($hWnd, $SB_SCROLLCARET) Return 1 EndFunc ;==>_GUICtrlEdit_SetPos
  4. That's pretty odd. I have no clue why i lost the includes when i pasted the code in, i actually had no clue what you were talking about until i double checked. Sorry about that, and thank you for the reply.
  5. I haven't got any replies so i figured my question was either not worded well or i didn't give an example that you guys could use. So here is the example: cannot backspace in the edit after having clicked in the embedded IE control. How do i either avoid this or take measures to correct for this? ;========================================================================================== #include <ie.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> ;Mainwindow $WinMain = GUICreate("hello", 510, 510) $MainMsgBoardInput = _GUICtrlEdit_Create($WinMain, "", 1, 439, 498, 50, BitOR($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)) $oMainIE = _IECreateEmbedded() GUICtrlCreateObj($oMainIE, 1, 1, 498, 435) _IENavigate($oMainIE, "about:blank") ;Perform starup operations GUISetState(@SW_SHOW) While 1 $mMsg = GUIGetMsg() Switch $mMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
  6. Hi MrCreatoR, Cool script! This is something i certainly needed and saved me a bunch of time coding! One possible bug: 93: Global $sOAER_BugReportSent_Msg = "Please fill all requiered fields" 396: If $iError Then MsgBox(16, $sOAER_SendBugReport_Title & " - " & $sOAER_Error_Title, _ StringFormat($sOAER_UnableToSend_Msg, $oOAER_ErrorData[0], $oOAER_ErrorData[1]), 0, $hSndBugRprtGUI) Else MsgBox(64, $sOAER_SendBugReport_Title & " - " & $sOAER_Success_Title, $sOAER_BugReportSent_Msg, 0, $hSndBugRprtGUI) 401: EndIf Seems to me like even when successful sending email, it will tell the user to fill all required fields? Hope that helps and thanks again, Smerk
  7. Link does not work for me.. please advise
  8. Figured that was the case.. have been using it to debug also
  9. Turns out it was an issue with ISP blocking ports.
  10. Great work, i was looking for exactly something like this. Your comments made it a billion times easier to understand whats needs to be done in a script of this nature!
  11. You should have a look at the AutoIt help file it outlines a bunch of native AutoIt functions and also UDF functions for use in directory/file management. As JLogan said (i am only learning AutoIt still myself) i also find very few things that this language CANT do, and thats without the help of the knowledgable people on the forum. To point you in the right direction i think you're looking for something like the FindFileFirst and FindFileNext functions.
  12. Beautiful, i understand where i went wrong now i will have to read up on the use of Dummy controls they were unknown to me before. Thank you for your help Bishop
  13. That certainly sounds like what happening.. when you say the function is being called in a callback are you referring to it being called from the GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") callback to WM_NOTIFY? And if i move it outside of WM_NOTIFY it will no longer be unstable? again sorry i am still learning
  14. EDIT: Upon futher investigation it looks like the script actually runs okay when its not in the same directory as the files it is meant to parse... When it IS in the same directory it gets all the info and displays them in the inputs fine but when it gets to the while loop it becomes unresponsive... so confused... The script itself becomes unresponsive, leading to both windows freezing. When run separately they both work fine. The problem arises when the function _EditMember() is called from within the main script. I was trying to make it easier by excluding a bunch of code that is irrelevant but ill post the entire program: ;========================================================================================== ;Includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ;========================================================================================== ;========================================================================================== ;Constant variables Global $WinMainTitle = "King's Empire Alliance Manager" Global $ProgVersion = "v1.00" Global $LastUpdate = "2012/05/02" Global $IsConnect = "Searching..." Global $IsUpToDate = "Searching..." ;Directory paths Global $ResDir = @ScriptDir & "Resources" ;File names Global $SavedBoardtxt = "SavedBoard.txt" Global $MsgBoardtxt = "MsgBoard.html" Global $PrevMemDatatxt = "PrevMemData.txt" Global $MemDatatxt = "MemData.txt" Global $Indextxt = "Index.txt" Global $AllyLogojpg = "logo.jpg" ;Global varliables Global $totstr = "0" Global $totscore = "0" Global $prevtotscore = "0" Global $prevtotstr = "0" ;Initial allaince to load $f = FileOpen($ResDir & $Indextxt) Global $allypointer = FileReadLine($f, 1) FileClose($f) ;Tab globals Global $tabcur Global $tabprev = "0" ;========================================================================================== ;Declare onexit function OnAutoItExitRegister( "_OnExit") $WinMain = GUICreate($WinMainTitle, 750, 675) ;Tabs $TabMain = _GUICtrlTab_Create($WinMain, 16, 95, 721, 20) ;Status bar Local $vPartEdge[2] = [500, 600] Local $vPartText[2] = [@Tab & _NowDate(), @TAB & $IsConnect] $StatusBarMain = _GUICtrlStatusBar_Create($WinMain, $vPartEdge, $vPartText) Global $AllyPic = GUICtrlCreatePic($ResDir & "" & $allypointer & $AllyLogojpg, 16, 15, 400, 100) $LabelMainLastUpdate = GUICtrlCreateLabel("Last Updated:", 428, 25, 70, 17) $LabLastUpdate = GUICtrlCreateLabel($LastUpdate, 503, 25, 80, 17) $LabIsUpToDate = GUICtrlCreateLabel($IsUpToDate, 473, 45, 80, 17) $LabMainProgVersion = GUICtrlCreateLabel($ProgVersion, 712, 5, 31, 17) $ButtonMainConnect = GUICtrlCreateButton("Connect", 430, 85, 147, 17) $ButtonMainSync = GUICtrlCreateButton("Sync", 592, 24, 147, 17) $ButtonMainWiki = GUICtrlCreateButton("WiKi", 592, 48, 147, 17) $ButtonMainMaps = GUICtrlCreateButton("Maps", 592, 72, 147, 17) $ButtonMainChat = GUICtrlCreateButton("Chat", 592, 96, 147, 17) ;Group alliance $GroupMainAlly = GUICtrlCreateGroup("Alliance:-", 16, 120, 721, 115) $LabMainAllyStr = GUICtrlCreateLabel("Total Strength:", 120, 183, 74, 17) $LabMainAllyScore = GUICtrlCreateLabel("Total Score:", 120, 208, 62, 17) $AllyStr = GUICtrlCreateLabel("-", 200, 183, 75, 17) $AllyScore = GUICtrlCreateLabel("-", 200, 208, 75, 17) $ProgressMainAllyStr = GUICtrlCreateProgress(120, 150, 475, 25) GUICtrlSetData(-1, 73) $LabMainStrAllyGainD = GUICtrlCreateLabel("/day", 315, 183, 75, 17) $LabMainStrAllyGainW = GUICtrlCreateLabel("/week", 415, 183, 75, 17) $LabMainStrAllyGainM = GUICtrlCreateLabel("/month", 520, 183, 90, 17) $LabMainScoreAllyGainD = GUICtrlCreateLabel("/day", 315, 208, 75, 17) $LabMainScoreAllyGainW = GUICtrlCreateLabel("/week", 415, 208, 75, 17) $LabMainScoreAllyGainM = GUICtrlCreateLabel("/month", 520, 208, 90, 17) $LabMainAllyHealth = GUICtrlCreateLabel("Health:", 330, 132, 40, 17) ;Group members $GroupMainMembers = GUICtrlCreateGroup("Members:-", 16, 240, 721, 241) $ListViewMainMembers = _GUICtrlListView_Create($WinMain, "", 32, 264, 690, 200, BitOR($LVS_SINGLESEL, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($ListViewMainMembers, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_TWOCLICKACTIVATE, $LVS_EX_DOUBLEBUFFER)) _GUICtrlListView_AddColumn($ListViewMainMembers, "Member", 100) _GUICtrlListView_AddColumn($ListViewMainMembers, "Troops", 145) _GUICtrlListView_AddColumn($ListViewMainMembers, "Score", 145) _GUICtrlListView_AddColumn($ListViewMainMembers, "Co-ordinates", 300) Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($ListViewMainMembers)] ;Group message board $GroupMainMsgBoard = GUICtrlCreateGroup("Message Board:-", 16, 488, 721, 153) $oMainIE = _IECreateEmbedded() $MainIEControl = GUICtrlCreateObj($oMainIE, 27, 505, 700, 125) GUISetState(@SW_SHOW, $WinMain) ;Register interactions with the tab GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _StartUpOperations() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _StartUpOperations() _ReadMemData() _CalcAllyTotals() _CalcAllyRates() _StartMessageBoard() _StartTabs() EndFunc Func _OnExit() ;Destroy controls to free memory _GUICtrlListView_Destroy($ListViewMainMembers) _GUICtrlStatusBar_Destroy($StatusBarMain) _GUICtrlTab_Destroy($TabMain) EndFunc Func _ReadMemData() ;============================================ ; Update members list ;============================================ Local $f, $lc, $line, $i, $memdat ;Delete any previous items _GUICtrlListView_DeleteAllItems($ListViewMainMembers) $f = FileOpen($ResDir & "" & $allypointer & $MemDatatxt) $lc = _FileCountLines($ResDir & "" & $allypointer & $MemDatatxt) ;Loop through and parse data from file For $i = 1 To $lc $line = FileReadLine($f, $i) If $line = "~" Then ExitLoop EndIf $memdat = StringSplit($line, "|") ;Add data to listview _GUICtrlListView_AddItem($ListViewMainMembers, $memdat[1]) _GUICtrlListView_AddSubItem($ListViewMainMembers, ($i - 1), $memdat[2], 1) _GUICtrlListView_AddSubItem($ListViewMainMembers, ($i - 1), $memdat[3], 2) _GUICtrlListView_AddSubItem($ListViewMainMembers, ($i - 1), $memdat[4], 3) Next FileClose($f) EndFunc ;==>_ReadMemData Func _CalcAllyTotals() ;============================================ ; Calculate alliance totals ;============================================ Local $ic, $i, $tcval ;Delete any previous totals $totstr = "0" $totscore = "0" $ic = _GUICtrlListView_GetItemCount($ListViewMainMembers) ;Loop through and gather data from listview For $i = 1 To $ic $tcval = _GUICtrlListView_GetItemText($ListViewMainMembers, ($i - 1), 1) $tcval = StringReplace($tcval, ",", "") $sval = _GUICtrlListView_GetItemText($ListViewMainMembers, ($i - 1), 2) $sval = StringReplace($sval, ",", "") $totstr = $totstr + $tcval $totscore = $totscore + $sval Next ;Display data GUICtrlSetData($AllyStr, $totstr) GUICtrlSetData($AllyScore, Int(($totscore/1000))) EndFunc ;==>_CalcAllyTotals Func _CalcAllyRates() ;============================================ ; Calculate gains per day/week/month ;============================================ Local $f, $lc, $line, $memdat, $tcval, $sval, $scorepd, $strpd ;Delete any previous totals $prevtotstr = "0" $prevtotscore = "0" $f = FileOpen($ResDir & "" & $allypointer & $PrevMemDatatxt) $lc = _FileCountLines($ResDir & "" & $allypointer & $PrevMemDatatxt) ;Loop through and parse data from file For $i = 1 To $lc $line = FileReadLine($f, $i) If $line = "~" Then ExitLoop EndIf $memdat = StringSplit($line, "|") $tcval = $memdat[2] $tcval = StringReplace($tcval, ",", "") $sval = $memdat[3] $sval = StringReplace($sval, ",", "") $prevtotstr = $prevtotstr + $tcval $prevtotscore = $prevtotscore + $sval Next ;Convert data $scorepd = (($totscore - $prevtotscore) / _DateDiff("D", $LastUpdate, _NowCalcDate())) $strpd = (($totstr - $prevtotstr) / _DateDiff("D", $LastUpdate, _NowCalcDate())) ;Display data GUICtrlSetData($LabMainScoreAllyGainD, Int($scorepd/1000) & "/Day") GUICtrlSetData($LabMainScoreAllyGainW, (Int($scorepd*7/1000)) & "/Week") GUICtrlSetData($LabMainScoreAllyGainM, (Int($scorepd*30/1000)) & "/Month") GUICtrlSetData($LabMainStrAllyGainD, Int($strpd) & "/Day") GUICtrlSetData($LabMainStrAllyGainW, (Int($strpd*7)) & "/Week") GUICtrlSetData($LabMainStrAllyGainM, (Int($strpd*30)) & "/Month") FileClose($f) EndFunc ;==>_CalcAllyRates Func _StartMessageBoard() Local $body, $f, $lc, $line, $i, $crisscross ;Navigate to messageboard page _IENavigate($oMainIE, $ResDir & $MsgBoardtxt) $body = _IETagNameGetCollection($oMainIE, "body", 0) ;Loop through saved boards.txt and collect entries $f = FileOpen($ResDir & $SavedBoardtxt) $lc = _FileCountLines($ResDir & $SavedBoardtxt) For $i = 1 to $lc ;Check if even or odd number for table color If Mod($i, 2) = 0 Then $crisscross = "b0b0b0" Else $crisscross = "d0d0d0" EndIf $line = FileReadLine($f, $i) $line = StringSplit($line, "|") ;Display entries _IEDocInsertHTML($body, ' [i]' & $line[1] & "[/i] [b]" & $line[2] & ":[/b] " & $line[3] & ' ', "afterbegin") Next FileClose($f) EndFunc Func _StartTabs() Local $f, $lc, $line, $i ;Open file and count how many alliances $f = FileOpen($ResDir & $Indextxt) $lc = _FileCountLines($ResDir & $Indextxt) ;For every allaince loop through and create a tab For $i = 1 to $lc $line = FileReadLine($f, $i) _GUICtrlTab_InsertItem($TabMain, ($i-1) , $line) Next FileClose($f) EndFunc ;===================================================================== ; Need to tidy this code in here! ;===================================================================== #region Native function from UDF Tabs Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTab, $hWndListView, $tInfo ;Declare which UDF controls to monitor $hWndTab = $TabMain If Not IsHWnd($TabMain) Then $hWndTab = GUICtrlGetHandle($TabMain) $hWndListView = $ListViewMainMembers If Not IsHWnd($ListViewMainMembers) Then $hWndTab = GUICtrlGetHandle($ListViewMainMembers) ;Native DLL stuff $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") ;Begin events check Switch $hWndFrom ;Events for tabmain Case $hWndTab Switch $iCode Case $NM_CLICK ;User clicks on tab control ;Check if a new tab has been selected $tabcur = _GUICtrlTab_GetCurSel($TabMain) If $tabcur <> $tabprev Then ;Tab has changed so load new tab data _TabChange() ;Set the previous tab to current tab $tabprev = $tabcur EndIf EndSwitch ;Events for listviewmain Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ;A column is clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) ;Sort items _GUICtrlListView_SimpleSort($ListViewMainMembers, $B_DESCENDING, DllStructGetData($tInfo, "SubItem")) Case $LVN_ITEMACTIVATE ;An item is double clicked ;Get member name and pass to editmember func $itemcur = _GUICtrlListView_GetSelectedIndices($ListViewMainMembers) $itemcur = _GUICtrlListView_GetItem($ListViewMainMembers, $itemcur) _EditMember($itemcur[3]) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc #endregion Func _TabChange() Local $f $f = FileOpen($ResDir & $Indextxt) ;Get alliance tab change points to $allypointer = FileReadLine($f, ($tabcur+1)) ;Update controls with new allaince data _ReadMemData() _CalcAllyTotals() _CalcAllyRates() ;Update allaince logo GUICtrlDelete($AllyPic) $AllyPic = GUICtrlCreatePic($ResDir & "" & $allypointer & $AllyLogojpg, 16, 15, 400, 100) FileClose($f) EndFunc Func _EditMember($mem) Local $f, $lc, $i, $line ;Create Edit Member Window $WinEditMem = GUICreate($mem, 595, 227, 384, 145, 0, 0, $WinMain) $LabEditMemName = GUICtrlCreateLabel($mem, 112, 32, 32, 17) $LabEditMemScore = GUICtrlCreateLabel("Score:", 16, 80, 35, 17) $LabEditMemTc = GUICtrlCreateLabel("Troop Count:", 16, 112, 66, 17) $LabEditMemCoord = GUICtrlCreateLabel("Coords", 16, 144, 37, 17) $InputEditMemScore = GUICtrlCreateInput("-", 88, 80, 201, 21) $InputEditMemTc = GUICtrlCreateInput("-", 88, 112, 201, 21) $InputEditMemCoord = GUICtrlCreateInput("-", 88, 144, 201, 21) $EditEditMemNote = GUICtrlCreateEdit("Notes...", 296, 8, 289, 161) $ButtonEditMemSave = GUICtrlCreateButton("Save", 200, 184, 83, 25) $ButtonEditMemCancel = GUICtrlCreateButton("Cancel", 296, 184, 83, 25) GUISetState(@SW_SHOW, $WinEditMem) ;Get member data and display $f = FileOpen($ResDir & "" & $allypointer & $MemDatatxt) $lc = _FileCountLines($ResDir & "" & $allypointer & $MemDatatxt) ;Cycle through memdat.txt For $i = 1 to $lc $line = FileReadLine($f, $i) $line = StringSplit($line, "|") If $line[1] = $mem Then ;If the name of the member = name passed to function ;Update controls with member data GUICtrlSetData($InputEditMemTc, $line[2]) GUICtrlSetData($InputEditMemScore, $line[3]) GUICtrlSetData($InputEditMemCoord, $line[4]) ;GUICtrlSetData($InputEditMemCoord, NOTES placeholder) ExitLoop EndIf Next MsgBox(0, "", "1") ;Window events While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox(0, "", "3") ExitLoop Case $ButtonEditMemCancel MsgBox(0, "", "4") ExitLoop EndSwitch WEnd ;Delete window on way out of function MsgBox(0, "", "7") FileClose($f) GUIDelete($WinEditMem) EndFunc
  15. Hey, I have recently returned to AutoIt after a few years, and am re-learning a lot of things. I have run into a problem that has me stumped. The main window in my program works great. What im trying to do is open up a child window that takes focus from the main window where the user can view/edit some info gathered from a UDF listview control. The user will then be able to either save or cancel once done editing the values in the controls. Gathering the data from the listview and displaying it in the child window works fine, however once the new GUI gets to the loop stage checking GUIGetMsg() it seems to be becoming unresponsive (need to force close the window). I have a few msgbox's in my script just for pinpointing where the script is hanging, so dont worry about those, and its pretty commented so shouldnt be too hard to follow. Ill include the function which contains child GUI window as well as the full script minus functions. Function calling creation of new GUI: Func _EditMember($mem) Local $f, $lc, $i, $line ;Create Edit Member Window $WinEditMem = GUICreate($mem, 595, 227, 384, 145, Default, Default, $WinMain) $LabEditMemName = GUICtrlCreateLabel($mem, 112, 32, 32, 17) $LabEditMemScore = GUICtrlCreateLabel("Score:", 16, 80, 35, 17) $LabEditMemTc = GUICtrlCreateLabel("Troop Count:", 16, 112, 66, 17) $LabEditMemCoord = GUICtrlCreateLabel("Coords", 16, 144, 37, 17) $InputEditMemScore = GUICtrlCreateInput("-", 88, 80, 201, 21) $InputEditMemTc = GUICtrlCreateInput("-", 88, 112, 201, 21) $InputEditMemCoord = GUICtrlCreateInput("-", 88, 144, 201, 21) $EditEditMemNote = GUICtrlCreateEdit("Notes...", 296, 8, 289, 161) $ButtonEditMemSave = GUICtrlCreateButton("Save", 200, 184, 83, 25) $ButtonEditMemCancel = GUICtrlCreateButton("Cancel", 296, 184, 83, 25) GUISetState(@SW_SHOW, $WinEditMem) ;Get member data and display $f = FileOpen($ResDir & "\" & $allypointer & $MemDatatxt) $lc = _FileCountLines($ResDir & "\" & $allypointer & $MemDatatxt) ;Cycle through memdat.txt For $i = 1 to $lc $line = FileReadLine($f, $i) $line = StringSplit($line, "|") If $line[1] = $mem Then ;If the name of the member = name passed to function ;Update controls with member data GUICtrlSetData($InputEditMemTc, $line[2]) GUICtrlSetData($InputEditMemScore, $line[3]) GUICtrlSetData($InputEditMemCoord, $line[4]) ;GUICtrlSetData($InputEditMemCoord, NOTES placeholder) ExitLoop EndIf Next MsgBox(0, "", "1") ;Window events While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox(0, "", "3") ExitLoop Case $ButtonEditMemCancel MsgBox(0, "", "4") ExitLoop EndSwitch WEnd ;Delete window on way out of function MsgBox(0, "", "7") FileClose($f) GUIDelete($WinEditMem) EndFunc Main program: ;========================================================================================== ;Includes #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <File.au3> #include <Array.au3> #include <String.au3> #include <Date.au3> #include <IE.au3> #include <GuiStatusBar.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GuiTab.au3> ;========================================================================================== ;========================================================================================== ;Constant variables Global $WinMainTitle = "King's Empire Alliance Manager" Global $ProgVersion = "v1.00" Global $LastUpdate = "2012/05/02" Global $IsConnect = "Searching..." Global $IsUpToDate = "Searching..." ;Directory paths Global $ResDir = @ScriptDir & "\Resources" ;File names Global $SavedBoardtxt = "\SavedBoard.txt" Global $MsgBoardtxt = "\MsgBoard.html" Global $PrevMemDatatxt = "\PrevMemData.txt" Global $MemDatatxt = "\MemData.txt" Global $Indextxt = "\Index.txt" Global $AllyLogojpg = "\logo.jpg" ;Global varliables Global $totstr = "0" Global $totscore = "0" Global $prevtotscore = "0" Global $prevtotstr = "0" ;Initial allaince to load $f = FileOpen($ResDir & $Indextxt) Global $allypointer = FileReadLine($f, 1) FileClose($f) ;Tab globals Global $tabcur Global $tabprev = "0" ;========================================================================================== ;Declare onexit function OnAutoItExitRegister( "_OnExit") $WinMain = GUICreate($WinMainTitle, 750, 675) ;Tabs $TabMain = _GUICtrlTab_Create($WinMain, 16, 95, 721, 20) ;Status bar Local $vPartEdge[2] = [500, 600] Local $vPartText[2] = [@Tab & _NowDate(), @TAB & $IsConnect] $StatusBarMain = _GUICtrlStatusBar_Create($WinMain, $vPartEdge, $vPartText) Global $AllyPic = GUICtrlCreatePic($ResDir & "\" & $allypointer & $AllyLogojpg, 16, 15, 400, 100) $LabelMainLastUpdate = GUICtrlCreateLabel("Last Updated:", 428, 25, 70, 17) $LabLastUpdate = GUICtrlCreateLabel($LastUpdate, 503, 25, 80, 17) $LabIsUpToDate = GUICtrlCreateLabel($IsUpToDate, 473, 45, 80, 17) $LabMainProgVersion = GUICtrlCreateLabel($ProgVersion, 712, 5, 31, 17) $ButtonMainConnect = GUICtrlCreateButton("Connect", 430, 85, 147, 17) $ButtonMainSync = GUICtrlCreateButton("Sync", 592, 24, 147, 17) $ButtonMainWiki = GUICtrlCreateButton("WiKi", 592, 48, 147, 17) $ButtonMainMaps = GUICtrlCreateButton("Maps", 592, 72, 147, 17) $ButtonMainChat = GUICtrlCreateButton("Chat", 592, 96, 147, 17) ;Group alliance $GroupMainAlly = GUICtrlCreateGroup("Alliance:-", 16, 120, 721, 115) $LabMainAllyStr = GUICtrlCreateLabel("Total Strength:", 120, 183, 74, 17) $LabMainAllyScore = GUICtrlCreateLabel("Total Score:", 120, 208, 62, 17) $AllyStr = GUICtrlCreateLabel("-", 200, 183, 75, 17) $AllyScore = GUICtrlCreateLabel("-", 200, 208, 75, 17) $ProgressMainAllyStr = GUICtrlCreateProgress(120, 150, 475, 25) GUICtrlSetData(-1, 73) $LabMainStrAllyGainD = GUICtrlCreateLabel("/day", 315, 183, 75, 17) $LabMainStrAllyGainW = GUICtrlCreateLabel("/week", 415, 183, 75, 17) $LabMainStrAllyGainM = GUICtrlCreateLabel("/month", 520, 183, 90, 17) $LabMainScoreAllyGainD = GUICtrlCreateLabel("/day", 315, 208, 75, 17) $LabMainScoreAllyGainW = GUICtrlCreateLabel("/week", 415, 208, 75, 17) $LabMainScoreAllyGainM = GUICtrlCreateLabel("/month", 520, 208, 90, 17) $LabMainAllyHealth = GUICtrlCreateLabel("Health:", 330, 132, 40, 17) ;Group members $GroupMainMembers = GUICtrlCreateGroup("Members:-", 16, 240, 721, 241) $ListViewMainMembers = _GUICtrlListView_Create($WinMain, "", 32, 264, 690, 200, BitOR($LVS_SINGLESEL, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($ListViewMainMembers, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_TWOCLICKACTIVATE, $LVS_EX_DOUBLEBUFFER)) _GUICtrlListView_AddColumn($ListViewMainMembers, "Member", 100) _GUICtrlListView_AddColumn($ListViewMainMembers, "Troops", 145) _GUICtrlListView_AddColumn($ListViewMainMembers, "Score", 145) _GUICtrlListView_AddColumn($ListViewMainMembers, "Co-ordinates", 300) Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($ListViewMainMembers)] ;Group message board $GroupMainMsgBoard = GUICtrlCreateGroup("Message Board:-", 16, 488, 721, 153) $oMainIE = _IECreateEmbedded() $MainIEControl = GUICtrlCreateObj($oMainIE, 27, 505, 700, 125) GUISetState(@SW_SHOW, $WinMain) ;Register interactions with the tab GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _StartUpOperations() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Let me know if you guys need any more of the script or any other info! Hope this is all clear... Thanks for any help Smerk
  16. #include <Process.au3> $rc = _RunDos("start Http://www.autoitscript.com")
  17. Hey, in my program i would like the user to be able to edit the text in a list view item, by right clicking and pressing edit. I made a context menu for the list view so when i right click it, the edit option comes up, but i just need to figure out how to be able to change something inside like i would a excel cell. Incase im not clear ill take a screenshot of what i want my program to be able to do:
  18. Nice, has a bug on my script tho, i have a GuiCtrlSetPos in a while loop and it makes my entire window flicker every time it moves. Very nice until that part comes up tho!
  19. Perfect, i was thinking that but i thought running explorer.exe wouldnt work.. Thanks Smoke
  20. Ok sorry.. lets say i want to open a folder on my desktop called "ABC".. how would i go about opening it like you just double clicked it?
  21. Hey, im not a noob with autoit but i cant figure out how to do this haha.. Anyone wanna help?
  22. Hey, so your saying that it works for LV too? Can u pls show us the code you used?
  23. Yeah it can be done really quite easily i made one when i was learning AutoIt but i never used it. If u really want to make it u will succeed with or without our help as i did.. Just read the help file and browse the forums a bit.
  24. Perfect! exactly what i needed for my script, very well done mate!
  25. only works if the person has "Only people on my allow list can see my status and send me messages" (In the privacy tab in options) NOT checked.. its checked by defualt and just abuot no one has it un checked.. so its a nice tool (very slow tho) but it wont work for the majority of ppl.. well done though
×
×
  • Create New...