Jump to content

FMS

Active Members
  • Posts

    310
  • Joined

  • Last visited

Everything posted by FMS

  1. @seadoggie01 & @LarsJ, althoug the problem is solved and I think this is a beatifull solution, I've a question related to the code. Is it true that You could also make input fields this way inside a listview? (by changing $LVS_EX_checkboxes) _GUICtrlListView_SetExtendedListViewStyle( $idListView2, $LVS_EX_CHECKBOXES ) Not that I need it but the answer expands mine knowledge on the matter Also tried a couple of things to have a inputfield at the end of the row but couldn't make a input field inside. in the helpfiles din't find any related $iExStyle or did i din't understand the code provided ?
  2. @water I use the ADO.UDF Do you mean that there is a better solution than the simplefied code above?
  3. Thanks @TheXman, found it and checked. I'm rather new to object handling. For futher reference (or maybe I've implemented it wrong) here is a simplefied piece of code I'll use Global $err_handler = 0 Func Err_UnRegister() $err_handler = 0 EndFunc Func Err_Register() $err_handler = ObjEvent("AutoIt.Error", "err_func") EndFunc Func err_func() ConsoleWrite("ObjOpen Failed."& @CRLF ) EndFunc Func set() $conn = ObjCreate( "ADODB.Connection" ) $DSN = "xxx" Err_Register() $conn.Open($DSN) If @error Then MsgBox(4096, "COM Error Detected", @error) Err_UnRegister() EndFunc set()
  4. Hello, I'm not sure where to ask this but : I'm busy whit an project that needs a SQL connection whit a database. The problem I have is in the code below: (It works when i fill in the correct info or there is a connection) $conn = ObjCreate( "ADODB.Connection" ) $DSN = "DRIVER={SQL Server};SERVER=someservername;DATABASE=dbname;UID=user;PWD=pass;" $conn.Open($DSN) If @error Then ConsoleWrite("ObjOpen Failed.") Else ConsoleWrite("ObjOpen Success.") EndIf Is the code faulty or the @error isn't set this way iff there is no connection? When i search on this forum 9/10 likewise problems are refered to catsh the @error this way but I get the error below *location*==> The requested action with this object has failed.: $conn.Open($DSN) $conn^ ERROR
  5. many thanks to all for the good examples and axplanations , this is totaly solved .
  6. very very nice @LarsJ, totaly what i was looking for. 1 question about this i hope u could help me whit. I added a button whish should read the "settings" or loop acros the checkboxes to check if one is checked or not. What i want to do -> if first checkbox of row is checked check the other checkboxes in that row. Is there anyway you or anyone else could help me in reading the checkboxes? I tried to put them into an array but don't get the expected result or did i missed something in the code? Thanks in advanced. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 Opt( "MustDeclareVars", 1 ) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $idListView, $hListView Example() Func Example() ; Create GUI GUICreate( "Listview with subitem checkboxes", 800, 598+20+50 ) ;GUICreate ( "title" [, width [, height [, left = -1 [, top = -1 [, style = -1 [, exStyle = -1 [, parent = 0]]]]]]] ) Global $GS1_btn1 = GUICtrlCreateButton("Button1", 620, 620, 75, 25) Global $GS1_btn2 = GUICtrlCreateButton("Button2", 720, 620, 75, 25) ;GUICtrlCreateButton ( "text", left, top [, width [, height [, style = -1 [, exStyle = -1]]]] ) ; Create ListView $idListView = GUICtrlCreateListView( "", 10, 10, 800-20, 598, $GUI_SS_DEFAULT_LISTVIEW, $WS_EX_CLIENTEDGE ) _GUICtrlListView_SetExtendedListViewStyle( $idListView, $LVS_EX_DOUBLEBUFFER+$LVS_EX_SUBITEMIMAGES ) ; Subitem images $hListView = GUICtrlGetHandle( $idListView ) ; ImageList Local $idListView2 = GUICtrlCreateListView( "", 0, 0, 1, 1 ) ; 1x1 pixel listview to create state image list with checkbox icons _GUICtrlListView_SetExtendedListViewStyle( $idListView2, $LVS_EX_CHECKBOXES ) ; The $LVS_EX_CHECKBOXES style forces the state image list to be created Local $hImageList = _GUICtrlListView_GetImageList( $idListView2, 2 ) ; Get the state image list with unchecked and checked checkbox icons _GUICtrlListView_SetImageList( $idListView, $hImageList, 1 ) ; Set the state image list as a normal small icon image list in $idListView ; Now the checkboxes can be handled like normal subitem icons ; Add 10 columns Local $text = "" For $i = 0 To 7 if $i = 0 Then $text = "Users" if $i = 1 Then $text = "Monday" if $i = 2 Then $text = "Tuesday" if $i = 3 Then $text = "Wednesday" if $i = 4 Then $text = "Thursday" if $i = 5 Then $text = "Friday" if $i = 6 Then $text = "Saturday" if $i = 7 Then $text = "Sunday" _GUICtrlListView_AddColumn( $idListView, $text, 75 ) Next ; Add 100 rows Local $checkboxes[101][8] For $i = 0 To 100 - 1 $checkboxes[$i][0] = _GUICtrlListView_AddItem( $idListView, "User "& $i, 0 ) ; Image index 0 = unchecked checkbox For $j = 1 To 7 ConsoleWrite("i = " & $i & " j =" & $j & @LF) $checkboxes[$i][$j] = _GUICtrlListView_AddSubItem( $idListView, $i, $i & " / " & $j, $j, 0 ) ; Image index 0 = unchecked checkbox Next Next ; WM_NOTIFY message handler to toggle checkboxes GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" ) ; Show GUI GUISetState( @SW_SHOW ) ; Message loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop case $GS1_btn1 _ArrayDisplay($checkboxes) case $GS1_btn2 MsgBox($MB_SYSTEMMODAL, "Title", "button 2 is pressed.", 10) EndSwitch WEnd ; Cleanup GUIDelete() EndFunc ; Message handler to toggle checkboxes Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam ) Local $tNMHDR = DllStructCreate( $tagNMHDR, $lParam ) Switch HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) ) Case $hListView Switch DllStructGetData( $tNMHDR, "Code" ) Case $NM_CLICK Local $aHit = _GUICtrlListView_SubItemHitTest( $hListView ) If $aHit[0] >= 0 And $aHit[1] >= 0 Then ; Item and subitem Local $iIcon = _GUICtrlListView_GetItemImage( $idListView, $aHit[0], $aHit[1] ) ; Get checkbox icon _GUICtrlListView_SetItemImage( $idListView, $aHit[0], $iIcon = 0 ? 1 : 0, $aHit[1] ) ; Toggle checkbox icon _GUICtrlListView_RedrawItems( $idListView, $aHit[0], $aHit[0] ) ; Redraw listview item EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG #forceref $hWnd, $iMsg, $wParam EndFunc
  7. whoo thanks @seadoggie01 for this nice example, also whit good comment's in it. I'll fiddle around whit it in the next couple of hours to try (because there a lot of row's being inserted) adding a scroll bar (the reason I was using listview in the beginnin )
  8. thanks @BrewManNH @seadoggie01 & @dmob, I'm fiddeling around whit your tips but couldn't got it to work. At this point I got this (and i know I need to put the checkboxes in the right row but first I want it to work properly :)) The example that @dmob sugested was a little too big for me to understand but seems legit Is there somebody who can help me whit this buggy script because I realy don't know how Func GUI_userselection() $GUI_userselection = GUICreate("Form1", 523, 265, -3084, -341) $GUI_userselection_list = GUICtrlCreateList("Users|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday", 10, 10, 504, 215) For $i = 1 To UBound($MT_users,1) - 1 Global $LC_tmp_chkbx[1][8] $LC_tmp_chkbx[0][0] = $MT_users[$i][0] $LC_tmp_chkbx[0][1] = GUICtrlCreateCheckBox("Monday",10,10,520,220) $LC_tmp_chkbx[0][2] = GUICtrlCreateCheckBox("Tuesday",10,30,540,220) Next GUICtrlSetData($GUI_userselection_list, $LC_tmp_chkbx) ; _ArrayDisplay($LC_tmp_chkbx) $GUI_userselection_btn1 = GUICtrlCreateButton("Set", 360, 232, 75, 25) $GUI_userselection_btn2 = GUICtrlCreateButton("Cancel", 440, 232, 75, 25) GUISetState(@SW_SHOW) EndFunc
  9. Thanks for the reply @BrewManNH , that's realy unfortunate This beceause I've a array that's rather big and bulky that fills the listview (in the example code $MT_users) I was realy happy whit the scroll bars and the simplified While statement Now I realy don't now how to start a GUI whit variable checkboxes or scrollbars or how to read the "settings" when the button "set" is pushed. I was hoping if there is an examplescript out there on whish I can build on??? I'm not sure where to start searching for some example's because I don't now what I need
  10. Seems a good update @DFerrato download seems to be broken , got this error message when I tried to unzip the file : Seems all the file's in the zip give this unspecified error if you push Skip.....
  11. Hello, I'm trying to make a listview inside a GUI (as shown in the attached file) but couldn't figure it out how to get it. (the added file is just a eddited screenshot whit paint ) In the end I was hoping to : Iff user is checked then act acordanly on checked day (iff this make any sense ) Strangly enough i couldn't find anything on this forum because i thought i wasn't the only one who tried this kind of thing.(or is realy dated -earlyer then 2005 :S ) Is there somebody who could show me an example script or show me the direction to acomplish this? ;In case here's the code I used $GUI_userselection = GUICreate("Form1", 523, 265, -3084, -341) ;Global $aList[100] $GUI_userselection_list = GUICtrlCreateListView("Users|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday", 10, 10, 504, 215, $WS_BORDER, $LVS_EX_FULLROWSELECT + $LVS_EX_CHECKBOXES) For $i = 1 To UBound($MT_users,1) - 1 ;$handle = GUICtrlCreateListViewItem($MT_users[$i][0] & "|" & $MT_users[$i][3], $GUI_userselection_list) $handle = GUICtrlCreateListViewItem("User" & $i , $GUI_userselection_list) _GUICtrlListView_SetColumnWidth($GUI_userselection_list, 0, $LVSCW_AUTOSIZE_USEHEADER) ;$aList[$i] = $i Next $GUI_userselection_btn1 = GUICtrlCreateButton("Set", 360, 232, 75, 25) $GUI_userselection_btn2 = GUICtrlCreateButton("Cancel", 440, 232, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[1] Case $GUI_userselection Switch $nMsg[0] Case $GUI_EVENT_CLOSE GUIDelete($GUI_userselection) Case $GUI_userselection_btn1 For $x = 1 To _GUICtrlListView_GetItemCount ( $GUI_userselection_list ) $MT_users[$x][8] = 0 If _GUICtrlListView_GetItemChecked($GUI_userselection_list, $x - 1) Then MsgBox(0, "listview item", _GUICtrlListView_GetItemTextString($GUI_userselection_list, $x - 1) & " " & @CRLF & "Line Checked = " & $x, 2) $MT_users[$x][8] = 1 EndIf Next EndSwitch EndSwitch WEnd
  12. @mLipok great work (Y) got the beta now
  13. tried to download the Beta 2.1.16 got the message below : Sorry, there is a problem This attachment is not available. It may have been removed or the person who shared it may not have permission to share it to this location. Error code: 2C171/1
  14. No and yes , the first 2 URL's are diffrent but whit the same Title. The other 2 are diffrent URL and diffrent Title. It's build something like this, maybe it helps a little? Global $A_URL[5][2] = _ [["URL" , "Window title"] , _ ["http://url1/location1/#/" , "title"] , _ ["http://url1/location2/#/" , "title"], _ ["http://url1/location3/#/" , "title_unique1"] , _ ["http://url1/location4/#/" , "title_unique2"]]
  15. unfortunaly this isn't posible because the links are inside a coorperate network and not accesible outside. But I've tried to find something different in a lot of way's , even "Autoit v3 Window Information"-tool doesn't give me something to work whit
  16. @ajag thanks for the reply, I'm a little bit further. It is somewhat clearer how to deal whit this. Unfortunaly I'm a little stuck in setting the right window on the right screen. (This code is meant to show 4 firefox windows on a computer whit 4 screens) What I'm trying to do is link 1 on screen 1 and link 2 on screen 2 ...... (resolution is 1920*1080) When I was trying things out it seems WinList give a random handle back and not in the order it was created (link 1 , link 2 ... ) . Is there a way around this? #include <Array.au3> Global $A_URL[4][2] = _ [["www.google.com" , "Google - Mozilla Firefox"] , _ ["www.google.com", "Google - Mozilla Firefox"] , _ ["www.google.com" , "other_title" ] , _ ["www.google.com" , "other_title" ]] Global $resolution = 1920 Global $screen_count = 4 If kill_firefox() Then start_firefox() If win_move() Then login_rotator() Func kill_firefox() ;~ Run("taskkill /IM firefox.exe /F", "", @SW_HIDE) ;~ Sleep(5000) Return True EndFunc Func start_firefox() For $i = 0 To 3 Local $ID = ShellExecute("firefox.exe", "-new-window " & $A_URL[$i][0] ,"C:\Program Files\Mozilla Firefox" ) Sleep(500) Next EndFunc Func win_move() $avWinList = WinList("[CLASS:MozillaWindowClass]") ;~ _ArrayDisplay($avWinList) For $i = 1 To $screen_count WinMove($avWinList[$i][1] , "", (($i * $resolution) - $resolution) , 0 ) Sleep(100) MouseClick("left", (($i * $resolution) - $resolution) + 10 , 80 ) Send("{F11}") Sleep(1000) Next Return True EndFunc Func login_rotator() ;----- login rotator Sleep(1000) MouseClick("left", 4783 , 362) Sleep(2000) MouseClick("left", 3935, 552) ;----- remove mouse from screen MouseMove( 1301, 1078) EndFunc
  17. both the first i want to move to place 1 and the other to another place on the screen.
  18. Hello, I'm having a problem whit winwait on firefoxscreens whit the same title and text. On mine quest on this forum and internet I've found some work around and solutions. unfortunaly This wasn't working for me. I've tried searching tru winlist or finding some unique text but wasn't finding any solution. Does anyone know how to get the wright handle? I just want to move the browser to the right place in the end whit WinMove. thnx in advanced. #include <Array.au3> Global $A_URL[4][2] = _ [["url1" , "same_title"] , _ ["url2", "same_title"] , _ ["url3" , "other_title" ] , _ ["url4" , "other_title" ]] ;~ _ArrayDisplay($A_URL) ;-----kill all firefox.exe ;~ Run("taskkill /IM firefox.exe /F", "", @SW_HIDE) ;Sleep(5000) For $i = 0 To 1 ConsoleWrite("running 1 : " & $i & @CRLF) Local $ID = ShellExecute("firefox.exe", "-new-window " & $A_URL[$i][0] ,"C:\Program Files\Mozilla Firefox" ) ConsoleWrite("$ID = " & $ID & @CRLF) Next sleep(200) ;~ Local $screen1HWND = WinWait($A_URL[0][1],"") ;~ If Not WinActive($screen1HWND) Then WinActivate($screen1HWND) ;~ ConsoleWrite("$screen1HWND = " & $screen1HWND & @CRLF) ;~ Local $screen2HWND = WinWait($A_URL[1][1],"") ;~ If Not WinActive($screen2HWND) Then WinActivate($screen2HWND) ;~ ConsoleWrite("$screen2HWND = " & $screen2HWND & @CRLF) $sWinTitle = $A_URL[0][1] $avWinList = WinList($sWinTitle) For $n = 1 to $avWinList[0][0] ConsoleWrite("Window " & $n & ": Text: " & WinGetText($avWinList[$n][1]) & @LF) Next For $i = 0 To 1 ;~ WinWait("title1", "", 10) ;~ WinActive("title1", "") ;~ WinMove ("title1", "", $i , $i ) Next
  19. I've a little bit more code , ( also thanks to @guinness whit resizing the GUI here ) I hope somebody could help me whit 3 issue's in this code. - The function "connect" doesn't seems the get the current tab id, whish i thought i could get this way? - The object $RDP_obj_ctrl seems to replace whit the GUI but is there a way it stay's whitin the tab and resizes whit the tab? - The buttons also are replaced when GUI is resized and could overlay the tab or each other, is there a simple way to work around this? #include <GUIConstants.au3> #include <GuiTab.au3> #include <MenuConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <Array.au3> #include <File.au3> #Include <GuiComboBoxEx.au3> Global Enum $CONTROLGETPOS_XPOS, $CONTROLGETPOS_YPOS, $CONTROLGETPOS_WIDTH, $CONTROLGETPOS_HEIGHT globals() create_gui() Func create_gui() Local $hGUI = GUICreate('', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) $button1 = GUICtrlCreateButton("Connect", 10, 10, 50, 20) $button2 = GUICtrlCreateButton("2", 70, 10, 50, 20) Local $iTab = GUICtrlCreateTab(10, 40, @DesktopWidth - 50 , @DesktopHeight - 50 , $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH is required. GUICtrlSetResizing($iTab, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) fetch_config() If $config_present Then Local $connection_count = UBound($configarray,1) -1 ;~ _ArrayDisplay($RDP_obj) ;~ ConsoleWrite("$connection_count = " & $connection_count & @CRLF ) ReDim $RDP_obj[$connection_count] ReDim $RDP_obj_ctrl[$connection_count] ;~ _ArrayDisplay($RDP_obj) Local $tab_holder = GUICtrlCreateTab(10, 40, 200, 100) For $x = 1 To $connection_count GUICtrlCreateTabItem($configarray[$x][1] ) $RDP_obj[$x-1] = ObjCreate("MsTscAx.MsTscAx.10") $RDP_obj_ctrl[$x-1] = GUICtrlCreateObj($RDP_obj[$x-1], 80, 80, 20, 60) Next GUICtrlCreateTabItem("") EndIf ; Assign the handle and tab control. _Tab_SetWidth($hGUI, $iTab) GUIRegisterMsg($WM_GETMINMAXINFO, _Event_Proc) GUIRegisterMsg($WM_SYSCOMMAND, _Event_Proc) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $button1 connect(_GUICtrlTab_GetItemText($tab_holder, _GUICtrlTab_GetCurSel($tab_holder))) EndSwitch WEnd GUIDelete($hGUI) EndFunc Func _Event_Proc($hWnd, $iMsg, $wParam, $lParam) If IsHWnd($hWnd) Then Switch $iMsg Case $WM_SYSCOMMAND Switch _WinAPI_LoWord($wParam) Case $SC_MINIMIZE, $SC_MAXIMIZE, $SC_RESTORE, $SC_SIZE AdlibRegister(_Tab_ResizeWidth, 10) EndSwitch Case $WM_GETMINMAXINFO AdlibRegister(_Tab_ResizeWidth, 10) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_Event_Proc Func _Tab_ResizeWidth() Return __Tab_SetWidth(Default, Default) EndFunc ;==>_Tab_ResizeWidth Func _Tab_SetWidth($hWnd, $iTab) Return __Tab_SetWidth($hWnd, $iTab) EndFunc ;==>_Tab_SetWidth Func __Tab_SetWidth($hWnd = Default, $iTab = Default) Local Static $hWnd_Static = 0, $iTab_Static = -9999 If IsHWnd($hWnd) And IsInt($iTab) And $iTab > 0 Then $hWnd_Static = $hWnd $iTab_Static = $iTab ElseIf IsKeyword($hWnd) And IsKeyword($iTab) Then Local $aCtrlPosTab = ControlGetPos($hWnd_Static, '', $iTab_Static) If Not @error Then Local $iWidth = Floor($aCtrlPosTab[$CONTROLGETPOS_WIDTH] / _GUICtrlTab_GetItemCount($iTab_Static)) - 2 ; Deduct 2px for the left/right arrows. _GUICtrlTab_SetItemSize($iTab_Static, $iWidth, 0) EndIf AdlibUnRegister(_Tab_ResizeWidth) EndIf Return True EndFunc ;==>__Tab_SetWidth Func connect($sessionid) ConsoleWrite("connecting to : " & $sessionid & @CRLF) EndFunc Func fetch_config() $config_present = False If FileExists($configfile) Then If _FileReadToArray($configfile, $configarray , 0 , "|") Then $config_present = True Return True Else Return False EndIf Else If Not _FileCreate($configfile) Then Return False Else Local $LC_fileSetTime = FileSetTime($configfile, @YEAR & @MON & @MDAY , $FT_CREATED) If $LC_fileSetTime = 0 Then Return False Else Local $set_rights = Run(@ComSpec & " /c icacls " & $configfile & " /grant Users:F" , "" , @SW_HIDE) If Not $set_rights Then Return False Else Local $file = FileOpen($configfile, 1) If $file = -1 Then Return False Else FileWrite($file, "ID|name|IP|username|domain|pass" & @CRLF) FileWrite($file, "1|name1|IP1|usr1|dom1|pass1" & @CRLF) FileWrite($file, "2|name2|IP2|usr2|dom2|pass2" & @CRLF) FileWrite($file, "3|name3|IP3|usr3|dom3|pass3" & @CRLF) FileWrite($file, "4|name4|IP4|usr4|dom4|pass4" & @CRLF) EndIf FileClose($file) fetch_config() Return True EndIf EndIf EndIf EndIf EndFunc Func globals() Global $config_present = False Global $configfile = @ScriptDir & "\config.rto" Global $configarray[0][0] Global $RDP_id = False Global $RDP_name = False Global $RDP_ip = False Global $RDP_usr = False Global $RDP_dom = False Global $RDP_pass = False Global $RDP_obj[0] Global $RDP_obj_ctrl[0] EndFunc
  20. @JLogan3o13 because .... coding reasons This is just some pease of code I've made so I can build on it when it's done. Also I'm using RDCMan now and it's working just like I meant to make mine
  21. Hello, At this moment I'm trying to make a RDP tool to make multiple connections and switch between them. Curently I'm having troubles in making multiple connections and got some error's. I know why I get the error's (trying to change a active connection) but I'm not sure how to solve this. Does somebody know a cleaver way to make it scalable into more connections in the same embeded window? Also I'm open for sugestions for making this code better Below the code I'm working on at the moment: #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #Include <GuiComboBoxEx.au3> Global $configfile = @ScriptDir & "\config.rto" Global $configarray[0][0] Global $RDP_id = False Global $RDP_name = False Global $RDP_ip = False Global $RDP_usr = False Global $RDP_dom = False Global $RDP_pass = False $Form1 = GUICreate("Form1",952, 675, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Connect", 160, 8, 75, 25) $Button2 = GUICtrlCreateButton("Disconnect", 240, 8, 75, 25) $Button3 = GUICtrlCreateButton("Button3", 320, 8, 75, 25) $oRDP = ObjCreate("MsTscAx.MsTscAx.10") $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 64, 44, 800, 600) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) GUISetState(@SW_SHOW) fetch_config() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 set_config(GUICtrlRead($Combo1)) Case $Button1 $oRDP.DesktopWidth = 800 $oRDP.DesktopHeight = 600 $oRDP.Fullscreen = False $oRDP.ColorDepth = 16 $oRDP.AdvancedSettings3.SmartSizing = True $oRDP.Server = $RDP_ip $oRDP.UserName = $RDP_usr $oRDP.Domain = $RDP_dom $oRDP.AdvancedSettings2.ClearTextPassword = $RDP_pass $oRDP.ConnectingText = "Connecting to " & $RDP_ip $oRDP.DisconnectedText = "Disconnected from " & $RDP_ip $oRDP.StartConnected = True $oRDP.Connect() Case $Button2 $oRDP.Disconnect() Case $Button3 WinSetState($oRDP_Ctrl, "", @SW_HIDE) EndSwitch WEnd Func cmdkey() ;cmdkey /generic:TERMSRV/ip1 /user:dom1\usr1 /pass:pass1 EndFunc Func set_config($selected = GUICtrlRead($Combo1)) Local $found = False Local $found_id = False $RDP_id = False $RDP_name = False $RDP_ip = False $RDP_usr = False $RDP_dom = False $RDP_pass = False For $x = 1 To UBound($configarray,1) -1 If $selected = $configarray[$x][1] Then ;~ ConsoleWrite ($configarray[$x][0]& @CRLF & $configarray[$x][1]& @CRLF & $configarray[$x][2]& @CRLF & $configarray[$x][3]& @CRLF & $configarray[$x][4]& @CRLF & $configarray[$x][5]& @CRLF) $found_id = $x $found = True EndIf Next If $found Then $RDP_id = $configarray[$found_id][0] $RDP_name = $configarray[$found_id][1] $RDP_ip = $configarray[$found_id][2] $RDP_usr = $configarray[$found_id][3] $RDP_dom = $configarray[$found_id][4] $RDP_pass = $configarray[$found_id][5] Return True Else Return False EndIf EndFunc Func fetch_config() If FileExists($configfile) Then ;~ ReDim $configarray[0][0] If _FileReadToArray($configfile, $configarray , 0 , "|") Then _GUICtrlComboBox_ResetContent($Combo1) _GUICtrlComboBox_BeginUpdate($Combo1) ;~ _GUICtrlComboBox_AddString($Combo1, "") For $i = 1 To UBound($configarray,1) -1 _GUICtrlComboBox_AddString($Combo1, $configarray[$i][1]) Next _GUICtrlComboBox_EndUpdate($Combo1) _GUICtrlComboBox_SetCurSel($Combo1, 0) If set_config(GUICtrlRead($Combo1)) Then Return True Else Return False EndIf Else Return False EndIf Else If Not _FileCreate($configfile) Then Return False Else Local $LC_fileSetTime = FileSetTime($configfile, @YEAR & @MON & @MDAY , $FT_CREATED) If $LC_fileSetTime = 0 Then Return False Else Local $set_rights = Run(@ComSpec & " /c icacls " & $configfile & " /grant Users:F" , "" , @SW_HIDE) If Not $set_rights Then Return False Else Local $file = FileOpen($configfile, 1) If $file = -1 Then Return False Else FileWrite($file, "ID|name|IP|username|domain|pass" & @CRLF) FileWrite($file, "1|name1|ip1|name1|dom1|pass1" & @CRLF) FileWrite($file, "2|name2|ip2|name2|dom2|pass2" & @CRLF) EndIf FileClose($file) fetch_config() Return True EndIf EndIf EndIf EndIf EndFunc edit : error at reuse connection : (51) : ==> The requested action with this object has failed.: $oRDP.Connect() $oRDP^ ERROR >Exit code: 1 Time: 13.73
  22. @Danp2 Nice this totaly works. onostly I'm nut shure how Could you explaine a bit of your code ? This so i understand and learn a bit more of (auto)it
  23. @Danp2, @FrancescoDiMuro I realy want to join this conversation and ask a smart question....... but I realy don't understand what you are saying So you are saying it isn't posible? Or there is another way?
  24. #include <IE.au3> Global $IE_flvto = _IECreate("https://www.flvto.biz/",0,1,1,1) Global $oForm = _IEFormGetObjByName ($IE_flvto, "convertForm") Global $oText = _IEFormElementGetObjByName ($oForm, "convertUrl") _IEFormElementSetValue ($oText, "https://www.youtube.com/watch?v=2H0yWKdZM8g") _IEFormSubmit($oForm) Global $oDivs = _IEGetObjByName($IE_flvto,"progress-bar") ;~ Global $oDivp = _IEPropertyGet($IE_flvto, "progress-bar") ;~ Global $oDiv = _IEFormElementGetObjByName ($IE_flvto, "progress-bar") ;~ Global $odiv = _IEPropertyGet ( $oDivp , "width" ) _IELoadWait($oForm) ConsoleWrite("waited" & @CRLF )
  25. I'm a little stuck and maybe I'm thinking it totaly wrong. could you look at this code ? : #include <IE.au3> Global $IE_flvto = _IECreate("https://www.website.com/",0,1,1,1) Global $oForm = _IEFormGetObjByName ($IE_flvto, "convertForm") Global $oText = _IEFormElementGetObjByName ($oForm, "convertUrl") _IEFormElementSetValue ($oText, "sometext") _IEFormSubmit($oForm) Global $oDivp = _IEPropertyGet($IE_flvto, "progress-bar") ;~ Global $oDiv = _IEFormElementGetObjByName ($IE_flvto, "progress-bar") Global $odiv = _IEPropertyGet ( $oDivp , "width" ) _IELoadWait($odiv) ConsoleWrite("waited")
×
×
  • Create New...