Jump to content

masonje

Active Members
  • Posts

    45
  • Joined

  • Last visited

About masonje

  • Birthday 08/19/1979

Profile Information

  • Location
    Cincinnati, OH
  • WWW
    http://masonje.com

masonje's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I'm having to dust off my autoit skills. Been a while. If I have an xml I need to post to a web service. How can I do that in autoit?
  2. I have a script that is reading through several locations in the reg using RegEnumKey. On the second For loop (nested, For in For), I'm getting an error. The Value of $HKCRProductsName = RegEnumKey($HKCRProducts, $x) is "Insufficient system resources exist to complete the requested service". Both $HKCRProducts and $x are valid values (or so they looked with a MsgBox). Any ideas? Full Code below: #include <String.au3> #include <array.au3> _UninstallSearch("Office 2007 Help") ;_UninstallSearch("help") Func _UninstallSearch($unSearch) $HKLMUninstall = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $HKCRProducts = "HKEY_CLASSES_ROOT\Installer\Products" For $i= 1 to 1000 $HKLMUuninstallName = RegEnumKey($HKLMUninstall, $i) ;If @error <> 0 then ExitLoop $name = RegRead($HKLMUninstall & "\" & $HKLMUuninstallName, "DisplayName") ;msgbox(0, "name", $name) if StringInStr($name, $unSearch) Then $UninstallString = RegRead($HKLMUninstall & "\" & $HKLMUuninstallName, "UninstallString") $ModifyPath = RegRead($HKLMUninstall & "\" & $HKLMUuninstallName, "ModifyPath") if $uninstallString = "" Then $uninstallString = $ModifyPath Else $uninstallString = $ModifyPath EndIf if $unSearch <> "" and StringInStr($uninstallString, "msiexec") > 0 Then $guidRead = _StringBetween($uninstallString, "{", "}") $guid = $guidRead[0] $guidSplit = StringSplit($guid, "-") $g1 = _StringReverse($guidSplit[1]) $g2 = _StringReverse($guidSplit[2]) $g3 = _StringReverse($guidSplit[3]) $g4 = _StringReverse($guidSplit[4]) $g51 = _StringReverse(StringLeft($guidSplit[5], 2)) $g52 = _StringReverse(StringLeft(StringRight($guidSplit[5], 10), 2)) $g53 = _StringReverse(StringLeft(StringRight($guidSplit[5], 8), 2)) $g54 = _StringReverse(StringLeft(StringRight($guidSplit[5], 6), 2)) $g55 = _StringReverse(StringLeft(StringRight($guidSplit[5], 4), 2)) $g56 = _StringReverse(StringLeft(StringRight($guidSplit[5], 2), 2)) $g5 = $g51 & $g52 & $g53 & $g54 & $g55 & $g56 $GuidFull = $guidSplit[1] & $guidSplit[2] & $guidSplit[3] & $guidSplit[4] & $guidSplit[5] ;"key of feature found in HKEY_CLASSES_ROOT\Installer\Features\" & $guidReverse $guidReverse = $g1 & $g2 & $g3 & $g4 & $g5 ;RegDelete("HKEY_CLASSES_ROOT\Installer\Features\" & $guidReverse) MsgBox(0, $name, $HKLMUuninstallName & @CR & "FG: " & $GuidFull & @cr & "RG: " & $guidReverse) ;MsgBox(0, "$unSearch", $unSearch) For $x= 1 to 10000 $HKCRProductsName = RegEnumKey($HKCRProducts, $x) MsgBox(0, $x, $HKCRProductsName) $HKCRProductsProductName = RegRead($HKCRProducts & "\" & $HKCRProductsName, "ProductName") if $HKCRProductsProductName <> "" Then MsgBox(0, $HKCRProducts & "\" & $HKCRProductsName, $name & @CR & $HKCRProductsProductName, .5) if $name = $HKCRProductsProductName > 0 Then msgbox(0, "", $HKCRProducts & "\" & $HKCRProductsName & " = " & $HKCRProductsProductName) ;RegDelete($HKCRProducts & "\" & $HKCRProductsName) EndIf Next EndIf EndIf Next EndFunc
  3. "It's going to bite you", as my Grandma would say... Didn't see the _XMLSelectNodes() function. Thanks! Guess it goes to show... don't drink and code. Users only get hurt. ;-)
  4. ...man I like dealing with the registry and INI files better.... Any way, need to read all the "name" values for each child node under "SWD/Advertisements". All of those children have the same name of "Advertisement" All of the examples I have seen have a known value of "name" and getting the rest of the values is simple. I have tried looking through all the posts (holy cow there are a lot) and still haven't seen one that fits my issue. How do I go about getting all of the "name" values... _XMLGetAttrib ("/SWD/Advertisements/Advertisement", "name") ...That only brings back the first one when I can have almost hundreds of these "/SWD/Advertisements/Advertisement" nodes Below is a sample xml: <SWD> <Advertisements> <Advertisement name="Some Program Name" package="{guid 1}"> <!-- bla bla bla --> </Advertisement> <Advertisement name="Other program" package="{guid 2}"> <!-- bla bla bla --> </Advertisement> <Advertisement name="My Program" package="{guid 3}"> <!-- bla bla bla --> </Advertisement> </Advertisements> <Packages> <Package name="Some Program Name"> <!-- bla bla bla --> </Package> <Package name="Other program"> <!-- bla bla bla --> </Package> <Package name="My Program"> <!-- bla bla bla --> </Package> </Packages> <Programs> <Program name="Some Program Name"> <!-- bla bla bla --> </Program> <Program name="Other program"> <!-- bla bla bla --> </Program> <Program name="My Program"> <!-- bla bla bla --> </Program> </Programs> </SWD> Thanks again for the help and amazing and way cool functions edelator!!! Bet you didn't know what you were getting into when you put this out there ha? ;-) Edit - I will also need to read the "package" to deal with the file system later
  5. I'm a big fat dork. I didn't realize I was setting up a 3d array. This is what I needed and it works now. Thanks for the help guys.... Dim $x[1][3] _ArrayAddAdv($x, $SW) _ArrayAddAdv($x, $SMABQ) _ArrayAddAdv($x, $SMLV) _ArrayDisplay($x, "Whole array") Func _ArrayAddAdv(ByRef $avArray, $sValue) If IsArray($avArray) Then $sValueSplit = StringSplit($sValue, ";") ReDim $avArray[UBound($avArray) + 1][3] $UBound = UBound($avArray) - 1 $avArray[0][0] = $UBound $avArray[$UBound][0] = $sValueSplit[1] $avArray[$UBound][1] = $sValueSplit[2] $avArray[$UBound][2] = $sValueSplit[3] SetError(0) Return 1 Else SetError(1) Return 0 EndIf EndFunc ;==>_ArrayAddAdv
  6. ok... Thanks for the tip... Anyway, did some more reading on ReDim and I think this is what it should look like but it's not panning out. What's wrong with this picture? I keep getting, "Array variable has incorrect number of subscripts or subscript dimension range exceeded." #include <Array.au3> $SW = "\\10.1.2.5\share;.Apps.SW.KMA.Corp;.AppsGrps.Apps.SW.KMA.Corp" $SMABQ = "\\10.1.5.2\share;.Applications.ABQ.SM.KMA.Corp;.AppsGrps.Applications.ABQ.SM.KMA.Corp" $SMLV = "\\10.4.5.3\share;.Applications.LV.SM.KMA.Corp;.Applications.LV.SM.KMA.Corp" Dim $x[1][1][1] _ArrayAddAdv($x, $SW) _ArrayAddAdv($x, $SMABQ) _ArrayAddAdv($x, $SMLV) _ArrayDisplay($x, "Whole array") Func _ArrayAddAdv(ByRef $avArray, $sValue) If IsArray($avArray) Then $sValueSplit = StringSplit($sValue, ";") ReDim $avArray[UBound($avArray) + 1][1][1] $UBound = UBound($avArray) - 1 $avArray[0][0][0] = $UBound $avArray[$UBound][0][0] = $sValueSplit[1] $avArray[$UBound][1][0] = $sValueSplit[2] $avArray[$UBound][0][1] = $sValueSplit[3] SetError(0) Return 1 Else SetError(1) Return 0 EndIf EndFunc ;==>_ArrayAddAdv
  7. I need to add values to 3 column array with unknown number of rows, but I can't quite figure out how to expand the array AND add the data in. One of the guys at work had a 1 column _ArrayAddAdv function, but I can't quite figure out what to add to make it work for me. Here is some sample code and guess as to how to make it work. #include <Array.au3> $SW = "\\10.1.2.5\share;.Apps.SW.KMA.Corp;.AppsGrps.Apps.SW.KMA.Corp" $SMABQ = "\\10.1.5.2\share;.Applications.ABQ.SM.KMA.Corp;.AppsGrps.Applications.ABQ.SM.KMA.Corp" $SMLV = "\\10.4.5.3\share;.Applications.LV.SM.KMA.Corp;.Applications.LV.SM.KMA.Corp" Dim $avArray[1][1][1] _ArrayAddAdv($avArray, $SW) _ArrayAddAdv($avArray, $SMABQ) _ArrayAddAdv($avArray, $SMLV) _ArrayDisplay( $avArray, "Whole array" ) Func _ArrayAddAdv(ByRef $avArray, $sValue) If IsArray($avArray) Then $sValueSplit = StringSplit($sValue, ";") ReDim $avArray[UBound($avArray) + 1] $avArray[0][0][0] = UBound($avArray) - 1 $avArray[UBound($avArray) - 1] = $sValueSplit[ ;something here but I'm not sure what... SetError(0) Return 1 Else SetError(1) Return 0 EndIf EndFunc ;==>_ArrayAddAdv Each office is a little different and that is why I have to set up my scripts with separate info for each location. Makes scripting deployments difficult. I was using different dims for each piece of info, but it is making my script more difficult to manage as I add functionality. Thanks for your help
  8. OK, getting warmer. I think something like example 1 works best, but 2 is too fixed. There has to be some way to get the msg read correct. I took example 1 concept and incorporated it into my existing script, but I keep getting GUICtrlRead($msg) = 0 and it's stuck throwing the MsgBox(0, '', 0) ever iteration of the while loop. Thoughts?... #include <GuiConstants.au3> #include <Array.au3> $iniFile = @ScriptDir & "\menue.ini" $iniSections = IniReadSectionNames($iniFile) Dim $buttonID[20] $GUI_W = "290" $GUI_H = "285" GUICreate("MaosnNet Admin", $GUI_W, $GUI_H, (@DesktopWidth-$GUI_W)/10, (@DesktopHeight-$GUI_H)/10) ;Local Admin group and positioning $laHors = "8" ;horizontal positioning of Local Admin group box $laVert = "140" ;vertical positioning of Local Admin group box $laHorsBut = "88" ;horzontal button positioning compared to Local Admin group box & used as multable $laVertBut = "30" ;vertical button positioning compared to Local Admin group box & used as multable $laButSize = "75, 25" ;Size of buttons in Local Admin group box GUICtrlCreateGroup("Local Administration", $laHors, $laVert, 265, 138) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else $h = 0 $v = 0 $x = 1 For $i = 1 To $iniSections[0] if $iniSections[$i] <> "Setup" then $buttonID[$i] = GUICtrlCreateButton($iniSections[$i], 8 + $laHors + $laHorsBut * $h, 16 + $laVert + $laVertBut * $v, $laButSize) $h = $h + 1 if $h > 2 Then $h = 0 $v = $v + 1 EndIf ;MsgBox(0, $i,$iniSections[$i]) EndIf Next EndIf GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $buttonID[1] To $buttonID[$iniSections[0]] MsgBox(0, '', GUICtrlRead($msg)) Case Else ;;; EndSwitch WEnd Edit...Found it!!! Case $buttonID[2] To $buttonID[$iniSections[0]] Array 0 & 1 are not used. I tried to change $i to 0 and the case statement to Case $buttonID[1] To $buttonID[$iniSections[0]] but that ended up with the same thing. Ultimately it's because I'm skipping section "setup" that was jacking with me. Thanks for your help guys (or gals).
  9. Cool, I get that, but how do I set up the while loop to check for variables that have not yet been created
  10. I have a script that I want to be able to tweak the menu buttons with an INI file. My problem is that I don't know how to set the variables to be read in the while loop. Any ideas? #include <GuiConstants.au3> $iniFile = @ScriptDir & "\menue.ini" $iniSections = IniReadSectionNames($iniFile) $GUI_W = "290" $GUI_H = "285" GUICreate("MaosnNet Admin", $GUI_W, $GUI_H, (@DesktopWidth-$GUI_W)/10, (@DesktopHeight-$GUI_H)/10) ;Local Admin group and positioning $laHors = "8" ;horizontal positioning of Local Admin group box $laVert = "140" ;vertical positioning of Local Admin group box $laHorsBut = "88" ;horzontal button positioning compared to Local Admin group box & used as multable $laVertBut = "30" ;vertical button positioning compared to Local Admin group box & used as multable $laButSize = "75, 25" ;Size of buttons in Local Admin group box GUICtrlCreateGroup("Local Administration", $laHors, $laVert, 265, 138) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else $h = 0 $v = 0 For $i = 1 To $iniSections[0] if $iniSections[$i] <> "Setup" then $buttonName = $iniSections[$i] ;$Button_$iniSections[$i] = GUICtrlCreateButton("Gateway", 8 + $laHors + $laHorsBut * 0, 16 + $laVert + $laVertBut * 0, $laButSize) GUICtrlCreateButton($buttonName, 8 + $laHors + $laHorsBut * $h, 16 + $laVert + $laVertBut * $v, $laButSize) $h = $h + 1 if $h > 2 Then $h = 0 $v = $v + 1 EndIf EndIf Next EndIf GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd a sample of the ini file: [setup] [Gateway] cmd=c:\Program Files\Mozilla Firefox\firefox.exe parm=https://gateway.domain.com:445 [L. Station] cmd=c:\Program Files\Mozilla Firefox\firefox.exe parm=http://drive.domain.com [D-Link] cmd=c:\Program Files\Mozilla Firefox\firefox.exe parm=http://dlink.domain.com [Webmin 1] cmd=c:\Program Files\Mozilla Firefox\firefox.exe parm=https://opn01.domain.com:10000" [Webmin 2] cmd=c:\Program Files\Mozilla Firefox\firefox.exe parm=https://opn02.domain.com:10000" [Map Network] cmd= parm= [unmap Network] cmd= parm= [Putty] cmd=putty.exe parm= [Winscape] cmd=winscp.exe parm=
  11. Rock!!! Thanks for the help. I will give it a shot.
  12. Yes it does. I have never seen that option. What does that mean for AutoIT?
  13. OK, we all know you can edit an RDP file in notepad, but when you try to use FileOpen -> FileReadLine in AutoIT on a .rdp file, it comes back with gibberish and blank lines. I'm hoping to add a function to edit rdp file settings in my rdp console script but this is kinda putting the brakes on it. Any one have any ideas on the type of encryption (if that is the case) that Micro$oft puts on the rdp files? Viva-La AutoIT!!! Edit PS, wanted to create this script b/c the Remote Desktop Settings window does not give you all the functionality than is possible when compared to editing the settings in an rdp file in notepad... Hence my reason for wanting to create this script.
  14. Added some settings to save previous connection and some other little fixes. Hope to add a function to edit rdp files. rdp2.au3
  15. Not too fancy I suppose. After I created this I found some others out there that were much more elaborate. Still, I'm happy w/ my little setup. My list of servers is growing and (like many of you) didn't want to clutter my desktop w/ gobs of .rdp files. I would like to use something like what MikeOsdx setup, but I already built this, and for some reason his script errors out. Haven't looked into why. Saves an ini file to the script directory for the rdp sessions. If you also want to use a .rdp file to add features (user name/pw) and link it to the mstsc command line you can, but it's also set to be in the script directory. Just didn't want to save the whole path. Might have been able to do some of this in fewer lines, but I'm getting better than when I first started w/ AutoIT (more nested statements) Not quite a at this yet but I'm getting there. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.2.0 Author: Jon Mason Date: 4/1/2007 Script Function: simple script to help manage my growing number of rdp sessions #ce ---------------------------------------------------------------------------- #include <GuiConstants.au3> #include <Array.au3> $ip = "" $rdp = @SystemDir & "\mstsc.exe" if Not FileExists($rdp) Then MsgBox(48, "Error", "Can not find " & $rdp & @CR & "Now exiting.") Exit EndIf $iniFile = @ScriptDir & "\mstsc.ini" GuiCreate("mstsc Options+", 220, 310) $mnu_Options = GuiCtrlCreateMenu ("Options") $mnu_exitOnConnect = GuiCtrlCreateMenuitem ("Exit on connect",$mnu_Options) $mnu_writeRDPcmd = GuiCtrlCreateMenuitem ("Print RDP command",$mnu_Options) GuiCtrlCreateLabel("Saved Connections", 10, 10) GuiCtrlCreateLabel("Name:", 10, 60) GuiCtrlCreateLabel("Server/Workstation:", 10, 110) GuiCtrlCreateLabel(".rdp base:", 10, 160) $Cm_Saved = GuiCtrlCreateCombo("", 10, 30, 200, 21) $In_Name = GuiCtrlCreateInput("", 10, 80, 200, 20) $In_ServerIP = GuiCtrlCreateInput("", 10, 130, 200, 20) $In_RDPFile = GuiCtrlCreateInput("", 10, 180, 150, 20) $In_Width = GuiCtrlCreateInput("800", 100, 230, 50, 20) $In_Height = GuiCtrlCreateInput("600", 160, 230, 50, 20) $ch_Console = GuiCtrlCreateCheckbox("Console", 10, 210, 70, 20) GUICtrlSetTip(-1, "Takes over console at the server side" & @CR & _ "Usefull if you want to login as Admin but not start a 2nd instance") $ch_FullScr = GuiCtrlCreateCheckbox("Full Screen", 10, 230, 80, 20) GUICtrlSetTip(-1, "Create RDP session to take up entire screen") $Ch_Height = GuiCtrlCreateCheckbox("Height", 160, 210, 80, 20) $Ch_Width = GuiCtrlCreateCheckbox("Width", 100, 210, 50, 20) $Bt_Conect = GuiCtrlCreateButton("Connect", 10, 260, 60) $Bt_Save = GuiCtrlCreateButton("Save", 80, 260, 60) $Bt_Remove = GuiCtrlCreateButton("Remove", 150, 260, 60) $Bt_RDPBrowse = GuiCtrlCreateButton("Browse", 165, 178, 50) readSaved() readPref() GuiSetState() While 1 $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Bt_Conect $ip = GUICtrlRead($In_ServerIP) $w = GUICtrlRead($Ch_Width) $h = GUICtrlRead($Ch_Height) $rdpF = GUICtrlRead($In_RDPFile) $go = 1 if $ip = "" Then MsgBox(48, "Error", "No IP or URL to connect to") $go = 0 EndIf if $w = 1 Then if GUICtrlRead($In_Width) = "" Then MsgBox(48, "Error", "RDP width specified w/o entering value") $go = 0 EndIf EndIf if $h = 1 Then if GUICtrlRead($In_Height) = "" Then MsgBox(48, "Error", "RDP width specified w/o entering value") $go = 0 EndIf EndIf if $rdpF <> "" Then if not FileExists(@ScriptDir & "\" & $rdpF) Then MsgBox(48, "Error", "File Not found:" & @CR & @ScriptDir & "\" & $rdpF) $go = 0 EndIf EndIf if $go = 1 Then Connect() EndIf Case $Bt_Save ;save screen Select Case GUICtrlRead($In_Name) = "" MsgBox(48, "Error", "Please enter a name to save too") Case GUICtrlRead($In_ServerIP) = "" MsgBox(48, "Error", "Please enter a server URL/short name/IP address to save") case Else Save() EndSelect Case $Bt_Remove if MsgBox(4, "Verify Remove", "Are you sure you want to remove " & GUICtrlRead($Cm_Saved) & "?") = 6 Then Remove() EndIf Case $Cm_Saved ;if the user changes a selection in the drop down box, update the screen UpdateScr() Case $ch_FullScr ;disable width options if full screen is checked FullScrCheck() Case $mnu_exitOnConnect If BitAnd(GUICtrlRead($mnu_exitOnConnect),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($mnu_exitOnConnect,$GUI_UNCHECKED) Else GUICtrlSetState($mnu_exitOnConnect,$GUI_CHECKED) EndIf writePref() Case $mnu_writeRDPcmd If BitAnd(GUICtrlRead($mnu_writeRDPcmd),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($mnu_writeRDPcmd,$GUI_UNCHECKED) Else GUICtrlSetState($mnu_writeRDPcmd,$GUI_CHECKED) EndIf writePref() Case $Bt_RDPBrowse ;Open File Dialog to "My Documents" $file = FileOpenDialog("Choose file...", @ScriptDir, "Visio Images (*.rdp)") If $file <> "1" Then $fileStringSplit = StringSplit($file, "\") GUICtrlSetData($In_RDPFile, $fileStringSplit[$fileStringSplit[0]]) EndIf Case Else ;;; EndSwitch WEnd writePref() Exit Func readPref() $exitOnConnect = IniRead($iniFile, "conf", "exitOnConnect", "yes") $writeRDP = IniRead($iniFile, "conf", "writeRDP", "no") if $exitOnConnect = "yes" Then GUICtrlSetState($mnu_exitOnConnect,$GUI_CHECKED) if $writeRDP = "yes" Then GUICtrlSetState($mnu_writeRDPcmd,$GUI_CHECKED) EndFunc Func writePref() If BitAnd(GUICtrlRead($mnu_exitOnConnect),$GUI_CHECKED) = $GUI_CHECKED Then $exitOnConnect = "yes" Else $exitOnConnect = "no" EndIf If BitAnd(GUICtrlRead($mnu_writeRDPcmd),$GUI_CHECKED) = $GUI_CHECKED Then $writeRDP = "yes" Else $writeRDP = "no" EndIf IniWrite($iniFile, "conf", "exitOnConnect", $exitOnConnect) IniWrite($iniFile, "conf", "writeRDP", $writeRDP) EndFunc Func Connect() $run = $rdp ;mstsc.exe /v:n060app01.esde.kroger.com /console if GUICtrlRead($In_RDPFile) <> "" Then $run = $run & ' "' & @ScriptDir & '\' & GUICtrlRead($In_RDPFile) & '"' EndIf $run = $run & " /v:" & $ip if GUICtrlRead($ch_Console) =1 then $run = $run & " /Console" if GUICtrlRead($ch_FullScr) =1 then $run = $run & " /f" Else if GUICtrlRead($Ch_Width) = 1 then $run = $run & " /w:" & GUICtrlRead($In_Width) if GUICtrlRead($Ch_Height) = 1 then $run = $run & " /h:" & GUICtrlRead($In_Height) EndIf ;see the rdp command or to run it? if IniRead($iniFile, "conf", "writeRDP", 'no') = "yes" Then Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send($run) Else Run($run) EndIf ;exit program after starting connection? if IniRead($iniFile, "conf", "exitOnConnect", '') = "yes" Then Exit EndIf ;save last connect if GUICtrlRead($Cm_Saved) <> "" And GUICtrlRead($Cm_Saved) = GUICtrlRead($In_Name) Then IniWrite($iniFile, "conf", "last", GUICtrlRead($Cm_Saved)) EndIf EndFunc ;reads ini file and populates drop down box Func readSaved() GUICtrlSetData($Cm_Saved, "") ;blank saved pull down $saved = IniReadSectionNames($iniFile) if not @error Then _ArraySort($saved) $c = "" For $i = 1 To $saved[0] if StringLeft($saved[$i], 4) = "rdp-" Then $name = StringRight($saved[$i], StringLen($saved[$i]) - 4) if $c = "" Then $c = $name Else $c = $c & "|" & $name EndIf EndIf Next GUICtrlSetData($Cm_Saved, $c) EndIf EndFunc ;saves settings on screen ini file Func Save() IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "IP", GUICtrlRead($In_ServerIP)) IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "h", GUICtrlRead($In_Height)) IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "w", GUICtrlRead($In_Width)) IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "rdpFile", GUICtrlRead($In_RDPFile)) if GUICtrlRead($ch_Console) = 1 Then $console = "checked" Else $console = "unchecked" EndIf if GUICtrlRead($ch_FullScr) = 1 Then $fullScreen = "checked" Else $fullScreen = "unchecked" EndIf if GUICtrlRead($Ch_Width) = 1 Then $widthCh = "checked" Else $widthCh = "unchecked" EndIf if GUICtrlRead($Ch_Height) = 1 Then $heightCh = "checked" Else $heightCh = "unchecked" EndIf IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "console", $console) IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "fullScreen", $fullScreen) IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "heightCh", $heightCh) IniWrite($iniFile, "rdp-" & GUICtrlRead($In_Name), "widthCh", $widthCh) ;UpdateScr() readSaved() EndFunc ;updates screen info to reflect saved rdp setting in ini file Func UpdateScr() $ip = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "IP" , "null") $name = GUICtrlRead($Cm_Saved) $w = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "w" , "800") $h = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "h" , "600") $wC = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "widthCh" , "null") $hC = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "heightCh" , "null") $fc = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "fullScreen" , "null") $con = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "console" , "null") $rdpF = IniRead($iniFile, "rdp-" & GUICtrlRead($Cm_Saved), "rdpFile" , "null") ;MsgBox(0, "", $name) GUICtrlSetData($In_ServerIP, $ip) GUICtrlSetdata($In_Name, $name) if $w <> "null" Then GUICtrlSetdata($In_Width, $w) Else GUICtrlSetdata($In_Width, 800) EndIf if $h <> "null" Then GUICtrlSetdata($In_Height, $h) Else GUICtrlSetdata($In_Height, 600) EndIf if $rdpF = "null" Then GUICtrlSetdata($In_RDPFile, "") Else GUICtrlSetdata($In_RDPFile, $rdpF) EndIf Switch $hC Case "Checked" GUICtrlSetState($Ch_Height, $GUI_CHECKED) case Else GUICtrlSetState($Ch_Height, $GUI_UNCHECKED) EndSwitch Switch $wC Case "Checked" GUICtrlSetState($Ch_Width, $GUI_CHECKED) case Else GUICtrlSetState($Ch_Width, $GUI_UNCHECKED) EndSwitch Switch $fc Case "Checked" GUICtrlSetState($ch_FullScr, $GUI_CHECKED) FullScrCheck() case Else GUICtrlSetState($ch_FullScr, $GUI_UNCHECKED) FullScrCheck() EndSwitch Switch $con Case "Checked" GUICtrlSetState($ch_Console, $GUI_CHECKED) case Else GUICtrlSetState($ch_Console, $GUI_UNCHECKED) EndSwitch EndFunc ;disables and unchecks screen size options if full screen is checked ;and re-enables then if full screen is unchecked Func FullScrCheck() if GUICtrlRead($ch_FullScr) = 1 Then GUICtrlSetState($Ch_Width, $GUI_DISABLE) GUICtrlSetState($Ch_Height, $GUI_DISABLE) GUICtrlSetState($In_Width, $GUI_DISABLE) GUICtrlSetState($In_Height, $GUI_DISABLE) ;uncheck w & h optison if full screen is shcedked GUICtrlSetState($Ch_Height, $GUI_UNCHECKED) GUICtrlSetState($Ch_Width, $GUI_UNCHECKED) Else GUICtrlSetState($Ch_Width, $GUI_ENABLE) GUICtrlSetState($Ch_Height, $GUI_ENABLE) GUICtrlSetState($In_Width, $GUI_ENABLE) GUICtrlSetState($In_Height, $GUI_ENABLE) EndIf EndFunc ;removes saved rdp setting on screen Func Remove() IniDelete($iniFile, "rdp-" & GUICtrlRead($Cm_Saved)) GUICtrlSetdata($In_Name, "") GUICtrlSetdata($In_ServerIP, "") GUICtrlSetdata($In_RDPFile, "") GUICtrlSetdata($In_Width, 800) GUICtrlSetdata($In_Height, 600) GUICtrlSetState($Ch_Height, $GUI_UNCHECKED) GUICtrlSetState($Ch_Width, $GUI_UNCHECKED) GUICtrlSetState($ch_FullScr, $GUI_UNCHECKED) GUICtrlSetState($ch_Console, $GUI_UNCHECKED) readSaved() EndFunc Thoughts?
×
×
  • Create New...