Jump to content

Kinshima

Members
  • Posts

    14
  • Joined

  • Last visited

About Kinshima

  • Birthday 02/05/1990

Profile Information

  • Location
    Nederland
  • Interests
    AutoIT

Recent Profile Visitors

231 profile views

Kinshima's Achievements

  1. Func _START_BACKGROUND_FUNCTION($f) Local $handle = DllCallbackRegister("_SubThread", "int", "ptr") Local $dllstr = DllStructCreate("Char[200]") DllStructSetData($dllstr, 1, $f) ;arg/parameter 1 Local $return = DllCall("kernel32.dll", "hwnd", "CreateThread", "ptr", 0, "dword", 0, "long", DllCallbackGetPtr($handle), "ptr", DllStructGetPtr($dllstr), "long", 0, "int*", 0) ;$return[0] - handle ;$return[6] - thread id EndFunc ;==>_START_BACKGROUND_FUNCTION Func _SubThread($x) Local $get = DllStructCreate("char[200]", $x) Call( DllStructGetData($get, 1)) EndFunc ;==>_SubThread Func _TEST() MsgBox(0,"","Yes but there are so many problems that it is very limited.") EndFunc Func _TEST2() MsgBox(0,":)","(: :) :(") EndFunc _START_BACKGROUND_FUNCTION("_TEST") _START_BACKGROUND_FUNCTION("_TEST2") msgbox (0,0,"Can AutoIt mutlithread"); if you close main process all subtreads are closedIt is possible but there are some limitations. This runs a function in the background. I don't know what you need it for i can show you sometime how you pass values back and forth but it is somewhat advanced. Edit: This example is already wrong, in some cases after it finishes the subtread it will continue to run the main thread, the only difference is if $return rertuns the data or not. You can use this Return or Not data to cancel out or continu after the function completes. Try the example a few times and you will see. It is not impossible to make it solid and stable but it is a lot of work.
  2. Have you read the very first section of the Forum Rules?
  3. I think decompiling software is forbidden by the European Law so what you just did is illegal. Have you read the very first section of the Forum Rules?
  4. In your first post the html had double quotes, you are trying to replace with single quotes. Can we see the html? Local $new_html = StringReplace($html,'<input type="text" name="username" class="form-control" autocorrect="off" autocapitalize="off" value="" data-fv-field="username">','<input type="text" name="username" class="form-control" autocorrect="off" autocapitalize="off" value="" data-fv-field="username" style="display: hidden;">')
  5. Hello, Does the following code work? Maybe swap around with the provider a bit, msdaora, OraOLEDB.Oracle, MSDASQL, Microsoft ODBC Driver for Oracle, don't know what you have installed. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_type=a3x #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Global $odbc_objConnection = ObjCreate("ADODB.Connection") Global $odbc_objRecordSet = ObjCreate("ADODB.Recordset") Global $odbc_conn = False Global $errADODB = ObjEvent("AutoIt.Error", "_ErrADODB") Global $conn_error = False #include <array.au3> If _ODBC_OpenConnection() Then Local $records = _ODBC_GetRecords('SELECT * FROM all_tables',500,500) _ODBC_CloseConnection() _ArrayDisplay($records) EndIf Func _ExeSQL($sql) If Not IsObj($odbc_objConnection) Then Return -1 $odbc_objConnection.Execute($sql) If $errADODB.number Then MsgBox(4 + 16 + 256, "_ExeSQL", $sql & @CRLF & @CRLF & 'Error. ' & @CRLF & 'Exiting.') Exit Else Return 1 EndIf EndFunc ;==>_ExeSQL Func _ODBC_CloseConnection() $odbc_conn = False Return $odbc_objConnection.Close EndFunc ;==>_ODBC_CloseConnection Func _ODBC_OpenConnection() If Not IsObj($odbc_objConnection) Then Return -1 $odbc_objConnection.ConnectionString = ("Provider='msdaora';Data Source='my_external_db';User Id='myuser';Password='myuserpwd';") $conn_error = False $odbc_objConnection.Open If $conn_error = True Then Return False EndIf $odbc_conn = True Return True EndFunc ;==>_ODBC_OpenConnection Func _ODBC_GetRecords($sql, $ch = 250, $limit = False) If $odbc_conn = False Then MsgBox(0, 'luukwcs', 'connectie niet open') Return EndIf If Not IsObj($odbc_objConnection) Then Return -1 If Not IsObj($odbc_objRecordSet) Then Return -2 _ODBC_OpenRecordset($sql) Dim $arrRecords[1][1] If $odbc_objRecordSet.EOF = True Then _ODBC_CloseRecordSet() Return False EndIf $odbc_objRecordSet.MoveFirst Local $x = 0 ReDim $arrRecords[1][$odbc_objRecordSet.Fields.Count] For $objField In $odbc_objRecordSet.Fields $arrRecords[0][$x] = $objField.Name $x += 1 Next Local $chn = UBound($arrRecords) + $ch ReDim $arrRecords[$chn][$odbc_objRecordSet.Fields.Count] $odbc_objRecordSet.MoveFirst Local $y = 0 Do $x = 0 $y += 1 For $objField In $odbc_objRecordSet.Fields $arrRecords[$y][$x] = $objField.Value $x += 1 Next If $y = $chn - 1 Then $chn += $ch ReDim $arrRecords[$chn][$odbc_objRecordSet.Fields.Count] EndIf $odbc_objRecordSet.MoveNext If $limit = False Then Else If $y = $limit Then ReDim $arrRecords[$y + 1][$odbc_objRecordSet.Fields.Count] Return $arrRecords EndIf EndIf Until $odbc_objRecordSet.EOF ReDim $arrRecords[$y + 1][$odbc_objRecordSet.Fields.Count] _ODBC_CloseRecordSet() Return $arrRecords EndFunc ;==>_ODBC_GetRecords Func _ODBC_OpenRecordset($sql); If Not IsObj($odbc_objConnection) Then Return -1 If Not IsObj($odbc_objRecordSet) Then Return -2 Return $odbc_objRecordSet.Open($sql, $odbc_objConnection, 0, 1) EndFunc ;==>_ODBC_OpenRecordset Func _ODBC_CloseRecordSet() Return $odbc_objRecordSet.Close EndFunc ;==>_ODBC_CloseRecordSet Func _ErrADODB() MsgBox(0, "ADODB COM Error", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $errADODB.description & @CRLF & _ "err.windescription:" & @TAB & $errADODB.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($errADODB.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $errADODB.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $errADODB.scriptline & @CRLF & _ "err.source is: " & @TAB & $errADODB.source & @CRLF & _ "err.helpfile is: " & @TAB & $errADODB.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $errADODB.helpcontext _ ) $conn_error = True EndFunc ;==>_ErrADODB I based it on '?do=embed' frameborder='0' data-embedContent>>from spudw2k. Getrecords is a mess because $odbc_objRecordSet.RecordCount does not seem to work with a orcale provider so can't predict the amount of records I am retrieving and redimming for every single record is just too slow.
  6. Local $i = 1, $character While $i <= StringLen($readedText) $character = StringMid($readedText, $i, 1) ;; code ;; code $i += 1 WEnd
  7. #include <ie.au3> Local $browser = _IECreate('') _IENavigate($browser,'http://www.autoitscript.com/forum/') _IELoadWait($browser) Local $html = _IEDocReadHTML($browser) Local $new_html = StringReplace($html,"Forums","New Text") _IEDocWriteHTML($browser,$new_html) Hope this will give you the directions you need. You can put the whole html line into the stringreplace.
  8. Have you looked into _GUICtrlTreeView_GetState ( $hWnd [, $hItem = 0] ) ? https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlTreeView_GetState.htm
  9. #include <ie.au3> Local $browser = _IECreate("http://google.com/") $handle = _IEPropertyGet($browser , "hwnd") If WinExists($handle) Then _IEQuit($browser) EndIf
  10. Hello, Maybe a WaitForResponse() below your Send helps. $oHTTP.Send($POSTData) $oHTTP.WaitForResponse() P.S. you have posted in the wrong section and have you read the >forum rules?
  11. Hello, I think deleting and recreating the GUI $AcctResults does what you want? #include <GUITab.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Array.au3> #include <GUIListView.au3> ;Begin Main Gui Global $Home = GUICreate("Welcome", 635, 477, 192, 114, $WS_MAXIMIZEBOX) ;Menus $MenuFile = GUICtrlCreateMenu("File") $Start = GUICtrlCreateMenuItem("Start", $MenuFile) GUICtrlCreateMenuItem("", $MenuFile) ; Create a separator line $ExitMenu = GUICtrlCreateMenuItem("Exit", $MenuFile) GUISetState(@SW_SHOW) WinSetState($Home, '', @SW_MAXIMIZE) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $ExitMenu Exit Case $Start Example() EndSwitch WEnd Func Example() local $idDeleteTab, $tabs, $buildtab=0 $MainForm = GUICreate("Test", 925, 327, 192, 114, -1, $WS_EX_MDICHILD, $Home) $TypeLabel = GUICtrlCreateLabel("Search Type", 8, 8, 65, 17) $SearchInput = GUICtrlCreateCombo("", 16, 26, 257, 25) GUICtrlSetData(-1, "Name|ID") $InputValLabel = GUICtrlCreateLabel("Input Value", 8, 56, 58, 17) $InputVal = GUICtrlCreateInput("", 16, 80, 257, 21) $StartSearch = GUICtrlCreateButton("Search", 8, 284, 75, 25) $aLabel = GUICtrlCreateLabel("Date", 8, 112, 84, 17) $aInput = GUICtrlCreateDate("", 19, 132, 259, 21, (0x00)) $aReportBox = GUICtrlCreateCheckbox("Generate report", 11, 168, 169, 17) GUICtrlSetState(-1, $GUI_HIDE) $MarkDead = GUICtrlCreateCheckbox("Mark Dead", 11, 192, 169, 17) GUICtrlSetState(-1, $GUI_HIDE) $UserOutput = GUICtrlCreateButton("Output", 188, 284, 75, 25) GUICtrlSetState($UserOutput, $GUI_HIDE) $bEnterDummy = GUICtrlCreateDummy() Local $bAccelKeys[1][2] = [["{ENTER}", $bEnterDummy]] GUISetAccelerators($bAccelKeys) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $ExitMenu GUIDelete($MainForm) ExitLoop Case $StartSearch, $bEnterDummy If GUICtrlRead($InputVal) = "" Then MsgBox(0, "ERROR", "You must input a parameter") Else SplashTextOn("Processing...", "Processing" & @CRLF & @CRLF & "Please wait", 200, 150, Default, Default, 1, Default, 25) $type = GUICtrlRead($SearchInput) $Parameter = GUICtrlRead($InputVal) GUICtrlSetData($InputVal, "") Local $IDs[2][2] = [["1", "A"], ["2", "B"]] SplashOff() If UBound($IDs) > 0 Then SplashTextOn("Processing...", "Processing" & @CRLF & @CRLF & "Please wait", 200, 150, Default, Default, 1, Default, 25) If $buildtab=0 then $AcctResults = GUICreate("", 620, 344, 294, 0, $WS_CHILD, -1, $MainForm) $Tabs=GUICtrlCreateTab(0, 10, 609, 300) $buildtab=1 $nTabCount=0 Else GUIDelete($AcctResults) $AcctResults = GUICreate("", 620, 344, 294, 0, $WS_CHILD, -1, $MainForm) $Tabs=GUICtrlCreateTab(0, 10, 609, 300) $buildtab=1 $nTabCount=0 ;~ $AcctResults = GUICreate("", 620, 344, 294, 0, $WS_CHILD, -1, $MainForm) ;~ $nTabCount=_GUICtrlTab_GetItemCount($Tabs) ;~ Local $aListViewAll='',$aIDs='' ;~ For $iCountLoop=0 to $nTabCount -1 ;~ $aSplit=StringSplit(_GUICtrlTab_GetItemText($Tabs,$iCountLoop)," - ",2) ;~ $aSplit=_ArrayBlankDeleter($aSplit) ;~ _ArrayTranspose($aSplit) ;~ If $aIDs='' Then ;~ $aIDs=$aSplit ;~ Else ;~ _ArrayConcatenate($aIDs,$aSplit) ;~ EndIf ;~ Next ;~ _ArrayConcatenate($IDs,$aIDs) ;~ _ArrayDisplay($IDs) ;~ _GUICtrlTab_Destroy($Tabs) ;~ $Tabs=GUICtrlCreateTab(0, 10, 609, 300) EndIf Local $ResultList[UBound($IDs)] Local $Tab[UBound($IDs)] local $NameLabel[UBound($IDs)] $idContextmenu = GUICtrlCreateContextMenu($Tabs) $idDeleteTab = GUICtrlCreateMenuItem("Delete Current Tab", $idContextmenu) ;Loop for each Result For $p = 0 To UBound($IDs) - 1 Local $Fullresult[3][7] = [[$IDs[$p][0]&'-'&$IDs[$p][1], "Tester", "123456", GUICtrlRead($aInput), '', '', ''], ["Hello", "There", "My", "Fine", "Friend", "", ""], ["GoodBye", "There", "My", "Hated", "Enemy", "", ""]] $Tab[$p] = GUICtrlCreateTabItem($Fullresult[0][0]) $ResultList[$p] = GUICtrlCreateListView("", 7, 128, 594, 174,$LVS_EDITLABELS) _GUICtrlListView_AddColumn($ResultList[$p], 'Col0') _GUICtrlListView_AddColumn($ResultList[$p], 'Col1') _GUICtrlListView_AddColumn($ResultList[$p], 'Col2') _GUICtrlListView_AddColumn($ResultList[$p], 'Col3') _GUICtrlListView_AddColumn($ResultList[$p], 'Col4') _GUICtrlListView_AddColumn($ResultList[$p], 'Col5') _GUICtrlListView_AddColumn($ResultList[$p], 'Col6') $NameLabel[$p] = GUICtrlCreateLabel($Fullresult[0][0], 8, 67, 260, 17) Local $aWriter = $Fullresult _ArrayDelete($aWriter, 0) _GUICtrlListView_AddArray($ResultList[$p], $aWriter) GUICtrlCreateTabItem("") Next Hide(1, $aLabel, $aInput, $UserOutput, $aReportBox, $MarkDead) SplashOff() GUISetState(@SW_SHOW) While 2 ExitLoop WEnd EndIf EndIf Case $idDeleteTab If $tabs Then _GUICtrlTab_DeleteItem($Tabs,GUICtrlRead($tabs)) EndIf EndSwitch WEnd EndFunc ;==>Example Func Hide($toggle, $aLabel, $aInput, $UserOutput, $aReportBox, $MarkDead) GUICtrlSetState($aLabel, $toggle = 1 ? $GUI_SHOW : $GUI_HIDE) GUICtrlSetState($aInput, $toggle = 1 ? $GUI_SHOW : $GUI_HIDE) GUICtrlSetState($UserOutput, $toggle = 1 ? $GUI_SHOW : $GUI_HIDE) GUICtrlSetState($aReportBox, $toggle = 1 ? $GUI_SHOW : $GUI_HIDE) GUICtrlSetState($MarkDead, $toggle = 1 ? $GUI_SHOW : $GUI_HIDE) EndFunc ;==>Hide Func _ArrayBlankDeleter($arr_2) For $i = UBound($arr_2) - 1 To 0 Step -1 If $arr_2[$i] = "" Then _ArrayDelete($arr_2, $i) EndIf Next Return $arr_2 EndFunc
  12. Hello, Hope this helps: #include <EXCEL.AU3> Local $oAppl = _Excel_Open(True, False, True, True, True) Local $oWorkbook = _Excel_BookNew($oAppl, 1) With $oAppl.ActiveWorkbook.Sheets(1) .Range("A1:A1").Interior.Color = 0x330099 EndWith Please note that color codes in excel are BGR and not RGB Other fun commands: .Range("A1:A1").Font.Bold = True .Range("A1:A1").Font.Color = 0xFFFFFF .Range("A1:A1").Borders.Color = 0x000000
  13. Thanks for this, this script is wonderfull. Works perfectly with access 2010. Provider "Microsoft.ACE.OLEDB.12.0" for Access 2007-2010 Provider "Microsoft.Jet.OLEDB.4.0" for Access 2003 If you change in _OpenRecordset: $strOpen &= $arrSelectFields[$x] into $strOpen &= '['&$arrSelectFields[$x]&']' Then you can use spaces in your Field Names in the tables. If you add in _GetRecords: Dim $arrRecords[1][1] If $objRecordSet.EOF = False Then ... Endif _CloseRecordSet() Then you won't get COM Errors when trying to get data from an empty table.
  14. Hey guys, im try'ing to read an page in HTML, change to another page and read the HTML again and make a var with the html that changed on these pages. #include <IE.au3> $main = _IECreate ($news) _IELoadWait($main) $body1 = _IEBodyReadHTML($main) _IENavigate ($main, $otherpageonsamewebsite) _IELoadWait($main) $body2 = _IEBodyReadHTML($main) $changedhtml = "need help, you rule" Cheers, Kinshima
×
×
  • Create New...