
donhorn20
Active Members-
Posts
29 -
Joined
-
Last visited
Everything posted by donhorn20
-
IniReadSection with ComboBox Drop down integration
donhorn20 replied to donhorn20's topic in AutoIt General Help and Support
Is it possible to take the same ini file, encrypt it ahead of time via _Crypt_ EncryptFile and have my script read those encrypted section names back as plain text within the combo box? -
Thanks @pseakins and @Nine for all the help. @Nine code was spot on as stated. The issue was I had a typo in my test file. The files do contain the "%" but there was a space issue. Once I corrected this minor oversight on my side (thanks to @pseakins making me take a deeper look at my file), it all worked. Thanks again for the speedy help. Much appreciated.
-
So I see what you did there with the _PathSplit and then passing that through the If StingInStr statement, but it seems to just list all my files and not display the mismatched ones Its almost like its not evaluating the sFileName within the StringInStr section. The consolewrite spits back Test1.pat Test2.pat Test3.pat and so on, even though Test1.pat should not of returned a result because its filename "Test1" matches the section within that file "%File Name:Test1".
-
Hey guys, I have a scenario that I am trying to wrap my head around to if it's even possible to code for. Let me lay out the scenario first before I get into to far. I have multiple files with different file names. There is a particular string within each text file that references the filename itself, just without the extension. I am trying to find all text files that possibly have a different string then the filename within the file. Example of a good file: Text1.pat (string within file is labeled as %File Name:Text1) Text2.pat (string within file is labeled as %File Name:Text2) Example of a bad file that I am trying to find all instances of: Text3.pat (string within file is labeled as %File Name:Text7) I can get the list of files from an array, but am stuck on how to pass that array through a possible check so that it compares the filename to a string within that file but strips off the extension. Any help or guidance would be great. So far I just have the basic search going for the files in question (taken from help file) #include <File.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <FileConstants.au3> Test() Func Test() ; List all the files and folders in the desktop directory. Local $aFileList = _FileListToArray(@DesktopDir & "\test", "*.pat", 1, True) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf ; Display the results returned by _FileListToArray. _ArrayDisplay($aFileList, "$aFileList") EndFunc
-
IniReadSection with ComboBox Drop down integration
donhorn20 replied to donhorn20's topic in AutoIt General Help and Support
Thanks @Nine, that did the trick. -
Trying to get this combo box drop down to read the data within my ini section names. Not able to return the key=value data when I hit the button on the gui. I can't seem to get the IniReadSection to recognize anything based off of my selection. What am I missing here? #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= ; original script borrowed from InunoTaishou and Subz $Form1 = GUICreate("Sample", 413, 213, 192, 124) $Combo1 = GUICtrlCreateCombo("", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Submit", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; Get the sections of the ini file Global $iFile = @ScriptDir & "\test5.ini" Global $aSections = IniReadSectionNames($iFile) ; If the IniReadSectionNames succeeded, convert the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1] If (Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($aSections, "|", 1), $aSections[1]) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $test = IniReadSection($iFile, $aSections) MsgBox($MB_SYSTEMMODAL, "", $test) EndSwitch WEnd I've attached my sample ini data too. test5.ini
-
How to Return the value "Simple Volume Size in MB"?
donhorn20 replied to donhorn20's topic in AutoIt General Help and Support
Well I looked into Scriptomatic and tried out the code you provided. It does return the drive size in bytes, but it still is the incorrect value being captured. I even tried the Win32_Volume to see if it would produce different results. But I still get the same output. Check out what I mean. Scriptomatic returns size in Bytes = 4398040765440 I convert that to MB 4398040765440 / 1048576 = 4194298.520507813 MB Notice this isn't even close to what the Windows Properties shows for this volume. As a matter of fact you get different results depending on how you look at the volume. Ultimately I need to find a way to get 4095.88 GB or 4194174 MB based off of disk # selected. Right now I am not seeing an easy way of extracting that data. Have you guys seen this type of discrepancy before? Here is the code with a simple input box if you want to see your own results. #include <ButtonConstants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <WindowsConstants.au3> Opt("GUICoordMode", 1) Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Opt("GUICloseOnEsc", 1) ;Send $GUI_EVENT_CLOSE message when ESC is pressed $GUI = GUICreate("", 175, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Label_DiskStart = GUICtrlCreateLabel("Disk #", 10, 20, 50, 17) ;Disk Start Label GUICtrlSetState(-1, $GUI_SHOW) ;Label $Input_DiskStart = GUICtrlCreateInput("", 60, 17, 65, 21, $ES_NUMBER) ;DiskStart Input / Numbers Only GUICtrlSetState(-1, $GUI_SHOW) ;Label $Button_Execute1 = GUICtrlCreateButton("Execute", 10, 60, 50, 25) ;Execute Button on left GUICtrlSetOnEvent(-1, "_Button1") ;Execute button calls the _Button function $Button_Close = GUICtrlCreateButton("Exit", 100, 60, 50, 25) ;Close Button GUICtrlSetOnEvent(-1, "_Exit") ;Close button calls _Exit function GUISetState() While 1 WEnd Func _Button1() Const $wbemFlagReturnImmediately = 0x10 Const $wbemFlagForwardOnly = 0x20 Local $oWMI, $oDrives, $sID, $sName, $iSizeinBytes, $Output $oWMI = ObjGet("winmgmts:\\.\root\cimv2") If IsObj($oWMI) Then $oDrives = $oWMI.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($oDrives) Then For $sDrive In $oDrives If $sDrive.Index = GUICtrlRead($Input_DiskStart) Then $sID = $sDrive.DeviceID $sName = $sDrive.Caption $iSizeinBytes = $sDrive.Size $sIndex = $sDrive.Index ConsoleWriteLine("ID: " & $sID & @CRLF & "Drive Index: " & $sIndex & @CRLF & "Drive Name: " & $sName & @CRLF & "Drive Size in Bytes: " & $iSizeinBytes & @CRLF) EndIf Next Else ConsoleWriteLine("Unable to pull Disk Info" & @CRLF) EndIf Else ConsoleWriteLine("Unable to connect to WMI" & @CRLF) EndIf EndFunc Func consolewriteline($text) ConsoleWrite($text & @CRLF) MsgBox(64,"",$text & @CRLF) EndFunc ;==>consolewriteline Func _Exit() ;Exits Application Exit EndFunc ;==>_Exit -
How to Return the value "Simple Volume Size in MB"?
donhorn20 replied to donhorn20's topic in AutoIt General Help and Support
Thanks JLogan3o13 for the reply. I do understand that simple math will get me that value. Maybe I wasn't clear enough in my original post. How can I extract the number 4194174 or 4095.88 when only providing the disk number to my interface? Scenario, a person enters the Disk number into an input field. I want to get the results of the disk 2, in this case the returned value could be 4194174 or if there is a way I can read from the disk management "Disk 2" section take the 4095.88 value, then I can do the math in the background to retain my results. Any ideas where I can find either one of these stored values, and how to extract them? -
How to Return the value "Simple Volume Size in MB"?
donhorn20 replied to donhorn20's topic in AutoIt General Help and Support
Sorry about that. I realized I didn't attach it after I posted. It's there now on the original post. -
How can I get the "Simple Volume Size in MB" for and Disk # I select. The value I am talking about is seen when you open Disk Management, select your disk, right-click > "New Simple Volume...". I would like to enter the desired disk number via an input box. Then return this "Simple Volume Size in MB" value. I don't want the DISKPART size as that is rounded (see picture). I already have script that extracts that, but I found out I need even more precise values. Any ideas of how to get this information? Been reading up on _WinAPI_GetDiskFreeSpaceEx() and _WinAPI_GetDriveNumber(), but I am not seeing how I could use these to get my results. One thing to note is these drives won't have drive letters associated with them at any point, so drive letter searching is useless.
-
Hey guys, what would be the best way to extract/read the following value from a diskpart, list disk, text file. I have a gui that the person specifies the disk number they want to use. Problem is, I need to extract the "Free" space value based off their Disk Input. Any ideas of the best way to do this? Here is what I am exporting to a basic text file right now. If the user inputs the number 3 on my input box, I want to read the file and pull back the value 7167. If they entered 2 I want to pull back 4095. I have looked at things like StringRegExp and _StringExplode, but not sure or very experienced in that, or even sure if that is what I should be doing for this scenario. Any ideas, input, or examples would be greatly appreciated. Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 60 GB 1024 KB Disk 1 Online 100 GB 10 GB Disk 2 Online 4096 GB 4095 GB * Disk 3 Online 7168 GB 7167 GB *
-
Hi everyone, Let me first start off by saying I love the many things people have posted and created. I have found many useful things to apply this to at my current job. I usually can find examples and tailor them to my specific needs, but this time I am a little stumped. My coding isn't the greatest and like I said, I can usually find what I need in the help or forums. But this time I am stumped. Scenario: I have been tasked to search and extract specific data from our ini files. My problem I run into is doing a global search across all of ini's and extracting the defined data. The key value I am searching on within each ini file is "HTTPServer". Can someone help me in performing the mass search/extract part. So far my script will extract the information I need, but it requires me to specify the ini name within the .au3 file. Like I said before, I would like to search the directory for all ini's named "drsys*.ini" and spit out all results I will attach 2 test.ini files that have been stripped down for simplicity sake that the code will look at. Any help would be greatly appreciated. #include <Array.au3> #include <MsgBoxConstants.au3> ;~ Location of specific ini. ;~ **********NOTE: This is a temp location, need it to search for drsys*.ini and extract from all ini within directory defined $sFile = @DesktopDir & "\drsys0001.ini" ;~ Search the ini for section name containing "HTTPServer" $sSearch = "HttpServer" ; Get section name from ini $aSections = IniReadSectionNames($sFile) ; Clear the result variable $sResult = "" ; Loop through the section names gathering the results For $i = 1 To $aSections[0] ; if we find the search variable in the section name If StringInStr($aSections[$i], $sSearch) Then ; We get the key/value pairing $aKey = IniReadSection($sFile, $aSections[$i]) ; And add them to the result $sResult &= $aKey[1][0] & "=" & $aKey[1][1] & @CRLF EndIf Next ; Results from ini MsgBox(0, "Result for " & $sSearch, $sResult) drsys0001.INI drsys0002.INI
-
I have some input boxes where the starting value ($InputFirst) needs to be greater then or equal to the end value ($InputLast). Problem I am encountering is if the starting value is a single digit number, say 2, and the ending value is any double digit number but the first number of the double digit is less then the first input box (12), I get an error for ($InputFirst) >= ($InputLast) statement. It's like it's treating the first digit as its comparison value and not the whole digit for the ($InputLast) value. Any ideas? Let me know if this even makes sense. I included my if statements I have for checking. If I need to provide more just let me know. ElseIf GUICtrlRead($InputFirst) = "" Then MsgBox($MB_SYSTEMMODAL, "", "No Values.") ElseIf GUICtrlRead($InputFirst) >= GUICtrlRead($InputLast) Then MsgBox($MB_SYSTEMMODAL, "", "Start is greater then End.") ElseIf GUICtrlRead($InputFirst) = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Start needs to be < 1")
-
Open links in any web browser
donhorn20 replied to donhorn20's topic in AutoIt General Help and Support
Thanks MikeII, I tested this out and it works just fine. I am sure there are other ways to accomplish this but for what I am doing this works just fine. -
Hi All, I have created a GUI interface tool that launched a bunch of different tasks for the employees here at my office. One of the buttons launches an HTML page that that takes them to an IE page with a bunch of links on them. This was scripted using the IE.au3. However, recently I was asked if I could have it open in their default browser, I.E, Chrome, FireFox, etc. Is there a simple way I can make this conversion. I have seen that there are other UDF files for FireFox and Chrome, but I am not quite sure the easiest way to do this would be. Do I need to make 3 separate source pages, one for each browser or is there a way I can use my existing code to open up the default browser? I know running ShellExecute() will do this but maybe I just have my code wrong as I don't see where I could implement the ShellExecute function with my current code. I stripped down my GUI to just include the button in question and placed some dummy data into the links I would be opening. I also included the same sample as an attachment. Any help on this would be greatly appriciated. #NoTrayIcon #RequireAdmin #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_LegalCopyright=Copyright 2013 All Rights Reserved. AutoIt v3 #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker ;~ #AutoIt3Wrapper_Run_Tidy=y ;~ #Tidy_Parameters=/pr=1 /bdir /rerc #endregion #region #include ;**** #include .au3 files #include <GuiConstants.au3> #include <EditConstants.au3 > #include <GuiButton.au3> #include <IE.au3> #include <Array.au3> #include <Misc.au3> #include <Process.au3> #include <GuiToolBar.au3> #include <RefreshSystemTray.au3> #endregion #region Opt ;**** Script Option settings Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled #endregion #region Global Variables ;**** Global Environment Variable Callouts and Script Settings ; --------- ; Global Variables called out in all functions ; --------- Global $Username = @UserName ;****Looks for logged in user on computer #endregion #region Runtime ; ------- ; Runtime ; ------- _MainMenu() While 1 Sleep(50) WEnd #endregion #region Functions ;**** Triggered by #Region Runtime ;~ --------- ;~ Functions ;~ --------- Func _MainMenu() ;~ GUI Interface Dimensions $GUIWidth = 450 ; Width of GUI _MainMenu() Box $GUIHeight = 250 ; Height of GUI _MainMenu() Box ;~ GUI Interface Controls $GUI = GUICreate("CS Tool - " & $Username & "", $GUIWidth, $GUIHeight, (@DesktopWidth - $GUIWidth) / 2, (@DesktopHeight - $GUIHeight) / 2) ;Create GUI _MainMenu() Box GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;Closes GUI _MainMenu() ; =================================================================== ;~ **** GUI Button Layout ;~ GUI Button for displaying AllSiteManagement Links GUICtrlCreateLabel("Site Management Links", 220, 140, 175, 25) $ButtonCurrentEV = GUICtrlCreateButton("All Site Links", 220, 160, 150, 25) GUICtrlSetOnEvent(-1, "_AllSiteManagement") GUISetState(@SW_SHOW, $GUI) ; =================================================================== EndFunc ;==>_MainMenu Func _Exit() ;Exits Application Exit EndFunc ;==>_Exit #region HTML Site Management Page List ;~ ****HTML SITE MANAGEMENT LIST Func _AllSiteManagement() ;Opens a web page list of all the Site Management Pages to navigate to. Located in File Menu Local $s_html = "", $o_object $s_html &= "<HTML>" & @CR $s_html &= "<HEAD>" $s_html &= "<TITLE>Site Management List</TITLE>" $s_html &= "<STYLE>body {font-family: Arial}</STYLE>" $s_html &= "</HEAD>" $s_html &= "<BODY>" $s_html &= "<table border=0 id='tableOne' cellspacing=5>" $s_html &= "<tr>" $s_html &= " <td align=center><b>Site Management Page & External Link</b></td>" $s_html &= "</tr><tr></tr><tr></tr>" $s_html &= "<tr>" $s_html &= " <td>Google</td>" $s_html &= "</tr>" $s_html &= "<tr>" $s_html &= " <td><a href='http://espn.go.com/sports/' target=_blank>ESPN Site 1</a></td>" $s_html &= " <td><a href='http://espn.go.com/nfl/' target=_blank>ESPN Site 2</a></td>" $s_html &= "</tr><tr></tr><tr></tr>" $s_html &= "<tr>" $s_html &= " <td>Yahoo</td>" $s_html &= "</tr>" $s_html &= "<tr>" $s_html &= " <td><a href='http://yahoo.com' target=_blank>Yahoo Site 1</a></td>" $s_html &= " <td><a href='http://sports.yahoo.com/' target=_blank>Yahoo Site 2</a></td>" $s_html &= "</tr><tr></tr><tr></tr>" $s_html &= "</table>" $s_html &= "</BODY>" $s_html &= "</HTML>" $o_object = _IECreate() _IEDocWriteHTML($o_object, $s_html) EndFunc ;==>_AllSiteManagement ;~ ****END HTML SITE MANAGEMENT LIST #endregion Sample GUI.au3
-
I currently have two functions, each being called out by a hotkeyset. In this case it is F4 calling out function1() and F6 calling out function2(). I would like to make it where if I press F4 two times it will execute function1(). If I press it three times it will execute function2(). If there is any other key stroke made then it will reset the count. This way I can then use F6 for something else. Is something like this even possible?
-
I have been searching the forums for some samples and came across the following script by member UEZ <> which provided a scrolling marquee. I can get it to function until the process is launched, but I need it to stay open until the it appears in the tray (hidden or shown). This is where I am running into some problems. Here are my scenarios of how I need it to run. - If no process (Agent.exe) is running after 5 seconds then stop marquee - If process (Agent.exe) and tray (Systems Agent) are present then stop marquee - If process (Agent.exe) is running but no tray (Systems Agent) then continue marquee until tray (Systems Agent) appears. Here is the code I have so far. It runs until the process is detected then exits. But I need it to stay open until the tray icon appears as well. This way the user knows it has been launched but is just running in the background. Any help on this would be greatly appriciated. You can test on your own station by swapping out the "Agent.exe" with any of your local exe applications running. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $dir = False GUICreate("Marquee Progress RTL", 400, 200) $Progress = GUICtrlCreateProgress(10, 60, 380, 25, 0x08, 0x2000) GUICtrlSendMsg($Progress, 0x040A, 1, 10) GUISetState() AdlibRegister("Reverse_Dir", 1350) Do ;~ Until GUIGetMsg() = $GUI_EVENT_CLOSE Until ProcessExists("Agent.exe") Local $PID = ProcessExists("Agent.exe") ; Will return the PID or 0 if the process isn't found. If $PID Then ProcessExists($PID) Exit Func Reverse_Dir() If $dir Then GUICtrlSetStyle($Progress, 0x08, 0x2000) $dir = False Else GUICtrlSetStyle($Progress, 0x08, $WS_EX_LAYOUTRTL) $dir = True EndIf EndFunc I ran the information tool to see what it returns for this exe in the tray menu and here is what I get, just in case someone is wondering. >>>> Window <<<< Title: Class: Shell_TrayWnd Position: 0, 984 Size: 1280, 40 Style: 0x96000000 ExStyle: 0x00000088 Handle: 0x0000000000010084 >>>> Control <<<< Class: ToolbarWindow32 Instance: 1 ClassnameNN: ToolbarWindow321 Name: Advanced (Class): [CLASS:ToolbarWindow32; INSTANCE:1] ID: 1504 Text: User Promoted Notification Area Position: 1093, 2 Size: 102, 38 ControlClick Coords: 11, 24 Style: 0x56008B4D ExStyle: 0x00000080 Handle: 0x00000000000100A4 >>>> ToolsBar <<<< 1: 3 Systems Agent
-
Help with my arrays and streamlining information
donhorn20 replied to donhorn20's topic in AutoIt General Help and Support
Thanks for the reply Neutro, I tried swapping my stuff out with what you suggested but I can't get my drop down box values to generate anything now. I had to change some of the other code just to get them to appear in the dropdown. Did it work for you? Also I think I understand the concept you were trying to relay to me but I pose this question. What would I do if the array values aren't in sequential order. Meaning, 1 = google, 2 =yahoo, 7 = msn, 11 = autoit... and so on? Would your logic still place the correct "site #" values? -
I have a script I recently created. My script is currently working great and thanks to other examples across this forum and the help file I was able to build it. HOWEVER, I feel like I could make this a lot cleaner and easier. To me it feels like I am entering the same data multiple times within the script. I have one combo box that uses an array. I was hoping that all the other parts of my script could pull the information from the array and use it but this is where my hang up is. I am not that familiar with arrays and writing code in general, still learning =). Was wondering if I could get some input and or help on this. Here is a little background on what my script does. I am trying to streamline a workflow I use at work. We deploy software to various hospitals and from time to time we are asked to install the same software from that hospital to our own computer for testing purposes. All that changes on my side in order to connect to a given facility is an environment change to point to the correct facilities. My utility currently creates and sets 3 environment variables appropriately. But like I stated before, I just feel like when I add new facilities to my script that I am adding it several times when it could probably all be done just once. I currently enter the same information in the following section $aValues (this is for the combo box drop down and what the array is used for), _AllSiteManagement(for access to the sites webpage), Func _001(which is each site information individually listed). What I would like to be able to do is have all the information in the combo box and have one "general" Func _### section. Right now, every new site I have to create a new Func _### section. Is there a way to not have to do this? Here is my current code with dummy information in its place. Let me know if you have any suggestions or examples I may be able to try to clean this up. Any help would be greatly appreciated. #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <IE.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) #Region ***GUI Information*** ;GUI Interface $GUI = GUICreate("Environment Variable Change", 400, 300, (@DesktopWidth - 400) / 2, (@DesktopHeight - 300) / 2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Events") ;GUI Combo Box & Step 1 Label which will set your environment variables GUICtrlCreateLabel("Step 1 - Choose a site", 200, 20, 150, 25) $COMBO = GUICtrlCreateCombo("", 200, 42, 175) GUICtrlSetOnEvent($COMBO, "_Events") ;GUI Label "Other Options" GUICtrlCreateLabel("Other Options", 30, 100, 80, 25) ;GUI Button for opening the environment variables $ButtonOpenEV = GUICtrlCreateButton("Open Environment Variables", 30, 120, 160, 25) GUICtrlSetOnEvent($ButtonOpenEV, "_EnvironmentVariables") ;GUI Button for displaying current environment variables $ButtonCurrentEV = GUICtrlCreateButton("Current Set Variables", 200, 120, 160, 25) GUICtrlSetOnEvent($ButtonCurrentEV, "_CurrentSettings") ;GUI Label "Global Options" GUICtrlCreateLabel("Global Options", 30, 220, 80, 25) ;GUI Button for launching the All Site Management Link List $ButtonOpenAllSiteManagement = GUICtrlCreateButton("All Site Management Links", 30, 240, 160, 25) GUICtrlSetOnEvent($ButtonOpenAllSiteManagement, "_AllSiteManagement") ;GUI Button for clearing the environment variables $Buttonreset = GUICtrlCreateButton("Clear Variables", 200, 240, 160, 25) GUICtrlSetOnEvent($Buttonreset, "_ResetAll") GUISetState() #EndRegion #Region ***Global Environment Variables*** ;Global Environment variables Global $SystemRegKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Global $UserRegKey = "HKEY_CURRENT_USER\Environment" Global $HTTPADDRESS = "_HTTPADDRESS" Global $TEXT = "_TEXT" Global $NAME = "_NAME" Global $Replace = 1 #EndRegion Global Environment Variables #Region Site List Defined ;Global setting to fill the combo with the values: Global $sComboValues, $Label_1 ;Declare the array that hold the controlID and the function to execute: ; This is the list of all Sites. If a site is added then the first $aValues within the [] will need to be increased. Currently set to 3 Global $aValues[3][2] = [["", ""], _ ["001 - Google", "_001()"], _ ["002 - Yahoo", "_002()"]];, _ For $i = 0 To UBound($aValues) -1 $sComboValues &= $aValues[$i][0] & "|" Next GUICtrlSetData($COMBO, $sComboValues, $aValues[0][0]) #EndRegion CS Site List Defined While 1 Sleep(250) WEnd Func _Events() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $COMBO ;read the value in the combo: Local $ValueSelected = GUICtrlRead($COMBO) ;Search the value in the array: For $i = 0 To UBound($aValues) -1 If $aValues[$i][0] = $ValueSelected Then ;Found then execute the function Return Execute($aValues[$i][1]) EndIf Next EndSwitch EndFunc Func _AllSiteManagement() ;Opens a web page list of all the Sites. Press "All Site Management Page" button. Local $s_html = "", $o_object $s_html &= "<HTML>" & @CR $s_html &= "<HEAD>" $s_html &= "<TITLE>Site Management List</TITLE>" $s_html &= "<STYLE>body {font-family: Arial}</STYLE>" $s_html &= "</HEAD>" $s_html &= "<BODY>" $s_html &= "<table border=0 id='tableOne' cellspacing=10>" $s_html &= "<tr>" $s_html &= " <td align=center><b>Site Management Page</b></td>" $s_html &= "</tr>" $s_html &= "<tr>" $s_html &= " <td><a href='http://www.google.com' target=_blank>001 - Google</a></td>" $s_html &= "</tr>" $s_html &= "<tr>" $s_html &= " <td><a href='http://www.yahoo.com' target=_blank>002 - Yahoo</a></td>" $s_html &= "</tr>" $s_html &= "</table>" $s_html &= "</BODY>" $s_html &= "</HTML>" $o_object = _IECreate() _IEDocWriteHTML($o_object, $s_html) EndFunc Func _CurrentSettings() ;Displays the Current Environment Variable settings within a msg box. Press the "Current Set Variables" button. Local $msg Local $var1 = RegRead($SystemRegKey,$HTTPADDRESS) Local $var2 = RegRead($SystemRegKey,$TEXT) Local $var3 = RegRead($SystemRegKey,$NAME) $Label_1 = MsgBox(4096,"Current Settings", $NAME & " = " & $var3 & @CRLF & "" & @CRLF & $HTTPADDRESS & " = " & $var1 & @CRLF & "" & @CRLF & $TEXT & " = " & $var2) EndFunc Func _ResetAll() ;Clears all defined Environment Variables. Press the "Clear Variables" button. RegDelete($SystemRegKey, $TEXT) ; Deletes TEXT System Variable and Value. RegDelete($SystemRegKey, $HTTPADDRESS) ; Deletes HTTPADDRESS System Variable and Value. RegDelete($SystemRegKey, $NAME) ; Deletes NAME System Variable and Value. RegDelete($UserRegKey, $TEXT) ; Deletes TEXT User Variable and Value. RegDelete($UserRegKey, $HTTPADDRESS) ; Deletes HTTPADDRESS User Variable and Value. RegDelete($UserRegKey, $NAME) ; Deletes NAME User Variable and Value. Sleep(100) EnvUpdate() MsgBox(0, "Environment", "Environment Variables cleared") EndFunc Func _EnvironmentVariables() ;Opens up System Environment Variables. Press the "Open Environment Variables" button. Run("C:\Windows\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables") EndFunc Func _Env() ;Silently opens up System Environment Variables Box and clicks OK button to double check that settings are applied. Sleep(500) EnvUpdate() Sleep(500) Run("C:\Windows\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables", @SW_HIDE) Sleep(500) Send("{ENTER}") EndFunc Func _001() Local $Value1 = "google.com" ;<<<< if this could be placed as another array variable I am ok with that i.e. ["001 - Google", "google.com", "_001()"]];, _ Local $Value2 = "c:\temp\guest001.txt" ; <<<<would like to be able to use ### in array to input after "guest", so I don't have to type again Local $Value3 = "Google" ;<<<< This is also already in the array, is there a way to auto gather this information? If $Replace = 1 Then RegWrite($SystemRegKey, $HTTPADDRESS, "REG_SZ", $Value1) RegWrite($SystemRegKey, $TEXT, "REG_SZ", $Value2) RegWrite($SystemRegKey, $NAME, "REG_SZ", $Value3) RegWrite($UserRegKey, $HTTPADDRESS, "REG_SZ", $Value1) RegWrite($UserRegKey, $TEXT, "REG_SZ", $Value2) RegWrite($UserRegKey, $NAME, "REG_SZ", $Value3) _Env() EndIf MsgBox(0, "Environment", "Environment Variables set for "&$Value3&"") EndFunc Func _002() Local $Value1 = "yahoo.com" ;<<<< if this could be placed as another array variable I am ok with that i.e. ["002 - Yahoo", "yahoo.com", "_002()"]];, _ Local $Value2 = "c:\temp\guest002.txt" ; <<<<would like to be able to use ### in array to input after "guest", so I don't have to type again Local $Value3 = "Yahoo" ;<<<< This is also already in the array, is there a way to auto gather this information? If $Replace = 1 Then RegWrite($SystemRegKey, $HTTPADDRESS, "REG_SZ", $Value1) RegWrite($SystemRegKey, $TEXT, "REG_SZ", $Value2) RegWrite($SystemRegKey, $NAME, "REG_SZ", $Value3) RegWrite($UserRegKey, $HTTPADDRESS, "REG_SZ", $Value1) RegWrite($UserRegKey, $TEXT, "REG_SZ", $Value2) RegWrite($UserRegKey, $NAME, "REG_SZ", $Value3) _Env() EndIf MsgBox(0, "Environment", "Environment Variables set for "&$Value3&"") EndFunc
-
Thanks for the suggested code, but I am still not understanding how I can make it so that when I click the keyboard END key that it will function like the END key should. However if I am within these two field boxes (phone or mobile) it will perform the copying of text? The code you provided still allows for the END button to produce results even if I am in a different program. I understand this is going to probably rely on a If/Then statement with the active windows being present or not, but just can't seem to get it.
-
FireFox, I appriciate the sample code and help provided so far. I am just not seeing how your sample code is works. I tried placing some code in the _IsPressed(... section but just not seeing it. Just to let you know, I have been reading the help files over and over before even posting to the forum. I just can't seem to grasp the proper statements thus the reason I am asking for more help. Whats wierd is the INFO box tool says that the Phone field box and Mobile field box are the same Control ClassID's. Would I even need to worry about the mouse position if the class ID's are the same? See info box information below. I just want it to work where when I place the cursor inside that field box and click END that the copy action is performed. If the cursor is in any other box besides the EDIT1 then the END button will function as normal. PHONE FIELD >>>> Window <<<< Title: Call Logging - [Work Group - 1 of 1] Class: BENDATAWINHEAT Position: 129, 0 Size: 850, 979 Style: 0x14CF8000 ExStyle: 0x00000100 Handle: 0x00500DF6 >>>> Control <<<< Class: Edit Instance: 1 ClassnameNN: Edit1 Name: Advanced (Class): [CLASS:Edit; INSTANCE:1] ID: 500 Text: Position: 92, 217 Size: 89, 16 ControlClick Coords: 50, 7 Style: 0x50000180 ExStyle: 0x00000000 Handle: 0x005B0856 MOBILE PHONE FIELD >>>> Window <<<< Title: Call Logging - [Work Group - 1 of 1] Class: BENDATAWINHEAT Position: 129, 0 Size: 850, 979 Style: 0x14CF8000 ExStyle: 0x00000100 Handle: 0x00500DF6 >>>> Control <<<< Class: Edit Instance: 1 ClassnameNN: Edit1 Name: Advanced (Class): [CLASS:Edit; INSTANCE:1] ID: 500 Text: Position: 306, 217 Size: 89, 16 ControlClick Coords: 35, 11 Style: 0x50000180 ExStyle: 0x00000000 Handle: 0x005A0856