Jump to content

Search the Community

Showing results for tags 'Case'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 16 results

  1. Recently I was working on a script with icons using GuiCtrkCreatIcon. I decided to change the sub folder name of the icons to a more meaning name, however made a typo. I tested the .exe on my test computer and it worked flawlessly (because both icon folder where on my test computer) 😁 But after I installed the script on the intended computers , I got chaos!😵 Zooming into the problem, I discovered, that because the icons could not be found, the ControlID were returned with a value of 0 and thus played havoc within the GuiGetMsg() switch/case statement. I have been able to reproduce this (see example) #include <GUIConstantsEx.au3> ;============================================================================================================ ; PLEASE, do not save this example in the example folder: C:\Program Files (x86)\AutoIt3\Examples\Helpfile ;============================================================================================================ Example() Func Example() GUICreate(" My GUI Icons", 250, 250) $Icon1 = GUICtrlCreateIcon("shell32.dll", 10, 20, 20) $Icon2 = GUICtrlCreateIcon(@ScriptDir & '\Extras\horse.ani', -1, 20, 40, 32, 32) $Icon3 = GUICtrlCreateIcon("shell32.dll", 7, 20, 75, 32, 32) GUISetState(@SW_SHOW) ;$Icon2 = -1 ; ==> When this line is uncommented the script "works", so -1 could be a potential fix. ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Icon2 Beep (500,500) EndSwitch WEnd GUIDelete() EndFunc ;==>Example If you save the above script outside the Autoit example folder and run it, it will keep beeping because GuiCtrlCreatIcon did not find horse.ani and return $Icon2=0. At the moment GUICtrlCreateIcon () only returns the conntrolID on success and 0 on failure. I would like to propose a return of -1 on failure, so a existing and working script won't go awry when the icon can not be found.
  2. Hi guys!, i have a problem to convert Python code to AutoIt code, in fact i had not coded with Python yet!, this code is about permutation a string's case, i will be happy with your comments :)❤; Python code: # Python code to print all permutations # with respect to cases # Function to generate permutations def permute(inp): n = len(inp) # Number of permutations is 2^n mx = 1 << n # Converting string to lower case inp = inp.lower() # Using all subsequences and permuting them for i in range(mx): # If j-th bit is set, we convert it to upper case combination = [k for k in inp] for j in range(n): if (((i >> j) & 1) == 1): combination[j] = inp[j].upper() temp = "" # Printing current combination for i in combination: temp += i print(temp), # Driver code permute("Hello") # This code is contributed by Sachin Bisht My code in AutoIt: ; https://www.geeksforgeeks.org/permute-string-changing-case/ _PermuteCase("ABC") Func _PermuteCase($sText) If StringRegExp($sText, "^[A-Za-z]{1,}$") Then Local $iLength = StringLen($sText) ; Get length of the text. Local $iMaxPerm = 2 ^ $iLength ; Number of permutations is 2^n Local $sLow_Text = StringLower($sText) ; Converting string to lower case Local $asChrs = StringToASCIIArray($sLow_Text) ; Split the text into array of chars. For $i = 1 To $iMaxPerm Step 1 For $j = 0 To $asChrs[0] ;................................................... Next Next Else Return SetError(-1, 0, "Error: Input is incorrect!") EndIf EndFunc ;==>_PermuteCase ====================== SOLUTION by @TheXman ======================
  3. I created a quick script to set/clear the topmost status of a window. It works like top <title> /on | /off I want the title match to be case insensitive and to work on partial strings. For example, if the window of note is titled "APLX for Windows" I want top apl /on to work. The AutoIt manual says that for WinTitleMatchMode Mode -1 to -4 Force lower case match according to other type of match. so I assumed that by aut.Opt "WinTitleMatchMode",-1 I would be doing a lower case match on existing windows. As long as I lcase(title) for the comparison it should match on "APLX for Windows" but it does not Is this a bug or am I misreading the docs?
  4. From From here, bottom of the post I am not arguing the logic of this, merely would like to point out that if there is such a rule, it is not documented... Are there other such rules? Skysnake
  5. @JLogan3o13 I apologize, I did not think of it that way. I have attached all the code and the Ini File information. Please let me know if I need to add anything else to help understand what is happening. thank you. Guys, I apologize in advance as I did not search for my answer before posting. I just could not figure out a way to search that made since so I decided to go ahead and post my question. Getting to it. Background: this is being used to validate file names before moving to a new location. though i have not included all the code, below is what i am having a problem with. I have an ini file that i am reading values from. Func ConfigDefineVars() -- I read the value of $ValidationRDA and everything is good then I set $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA the code that will be used in the select case in Func FileSplitCount(). The problem i have is that even though the numbers = each other they are not recognizing as =. This is what i am getting in my log file i create. 2017-12-04 14:09:53 : RDA was 2403 should have been 2403: If I move $SplitFile[$ValidationRDALocation] <> $ValidationRDA to the Case line under the function it works correctly. I think this has to do with my use of ' ' around the '$SplitFile[$ValidationRDALocation]' but i don't know what option i have in Func ConfigDefineVars I am not ready to define $SplitFile. I have tried adding it to my Global Vars at the top of my script but that did not seem to help. There will be more fail this is just the first one in the select case. Any help or ideas would be greatly appreciated. thanks, Damon Example of a filename used. DWRSSD-37087-95-026.%-064.00-Tatum Family %-%-1230 Academy Rd-%-PERM-TRUE-2403.pdf This file will fail on the 95, it should be 095. The problem i am getting is with the 2403 it fails even though the ini file value ValidationRDA = 2403 Ini File: [SSD_FolderPaths] pendingFolder=C:\Users\bg01152\Desktop\SSD Test\pending reviewFolder=C:\Users\bg01152\Desktop\SSD Test\review completedFolder=C:\Users\bg01152\Desktop\SSD Test\Completed FileNetProperties=DocumentTitle,ZipCode,County,MapAndGroupID,ParcelID,PropertyOwner,Subdivision,StreetAddress,LotNumber,DocumentType,Approved,RDANumber ValidationDocumentTitle=DWRSSD ValidationDocumentTitleLocation=1 ValidationCountyCodeLocation=3 ValidationRDA=2403 ValidationRDALocation=12 Validation3=TRUE Validation3Location=11 Validation4=PERM Validation4Location=10 #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> ;------------Global Vars --------------------- Global $SplitFile, $aFileList, $FileLog, $dFolder, $sFolder, $cFolder, $ConfigFile, $t Global $ValidationDocumentTitle, $ValidationDocumentTitleLocation, $ValidationCountyCodeLocation, $ValidationRDA Global $ValidationRDALocation, $Validation3, $Validation3Location, $Validation4, $Validation4Location, $FileNetPropertiesSplit Global $CaseCountyCheck, $CaseRDALocationCheck, $CaseValidation3LocationCheck, $CaseValidation4LocationCheck, $SplitFile ;;--------------------------------Check and Read Config files-------------------------------- $SysConfigFile = @ScriptDir & "\SysConfig.ini" ;----------------PreCheck for Config File-------------- If FileExists ($SysConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- $FileNetEXE = @ScriptDir & "\" & IniRead ($SysConfigFile, "FileNetUploader","FileName","") $delimiter = IniRead ($SysConfigFile, "FileInformation", "Delimiter","") $Filter = IniRead ($SysConfigFile, "FileInformation", "Filter", "") $ConfigFile = @ScriptDir & "\Config.ini" ;----------------PreCheck for Config File-------------- If FileExists ($ConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- ;;-------------------------------------------------------------------------------------------- $Sections = IniReadSectionNames ($ConfigFile) ;MsgBox (0,"test", $Sections[0] & @CRLF & $Sections[1] & @CRLF & $Sections[2] & @CRLF & $Sections[3] & @CRLF & $Sections[4]);TESTING ONLY - DELETE WHEN DONE $p = 0 Do $t = 0 ;used for precheck $p = $p + 1 ConfigDefineVars($Sections[$p]) ;MsgBox(0,"ConfigDefineVars", $sFolder & @CRLF & $dFolder & @CRLF & $cFolder);TESTING ONLY - DELETE WHEN DONE PreCheck($dFolder, $sFolder, $cFolder) ;Runs a Pre-check to make sure folder structure exists before running the program If $t = 0 Then ;MsgBox(0,"PreCheck Run", "Running next functions");TESTING ONLY - DELETE WHEN DONE ListArray($sFolder, $Filter) ;Puts File Names in String Array ;_ArrayDisplay ($aFileList, $Sections[$p]) If $t = 0 Then FileSplitCount($dFolder, $aFileList) ;Takes filename String Array and splits by $delimiter ;MsgBox(0,"PreCheck Run2", "Running split function");TESTING ONLY - DELETE WHEN DONE Else ;MsgBox(0,"PreCheck Run2", "Skipping split function");TESTING ONLY - DELETE WHEN DONE EndIf Else ;MsgBox(0,"PreCheck Run", "Skipping next functions");TESTING ONLY - DELETE WHEN DONE EndIf Until $p = $Sections[0] ExitScript() ;Exit script Function Func ConfigDefineVars($SectionsNum);Defines Variables from config file Sections $sFolder = IniRead ($ConfigFile, $SectionsNum, "pendingFolder","") ;Pending Folder, Folder that is awaiting the process $dFolder = IniRead ($ConfigFile, $SectionsNum, "reviewFolder","") ;Review Folder, Files that did not pass validation check and division needs to review $cFolder = IniRead ($ConfigFile, $SectionsNum, "completedFolder","") ;Completed Folder, Once process is completed this would be location files get moved to $FileNetProperties = IniRead ($ConfigFile, $SectionsNum, "FileNetProperties","") $FileNetPropertiesSplit = StringSplit ($FileNetProperties,",") $ValidationDocumentTitle = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitle","") $ValidationDocumentTitleLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitleLocation","") $ValidationCountyCodeLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationCountyCodeLocation","") $ValidationRDA = IniRead ($ConfigFile, $SectionsNum, "ValidationRDA","") $ValidationRDALocation = IniRead ($ConfigFile, $SectionsNum, "ValidationRDALocation","") $Validation3 = IniRead ($ConfigFile, $SectionsNum, "Validation3","") $Validation3Location = IniRead ($ConfigFile, $SectionsNum, "Validation3Location","") $Validation4 = IniRead ($ConfigFile, $SectionsNum, "Validation4","") $Validation4Location = IniRead ($ConfigFile, $SectionsNum, "Validation4Location","") If $ValidationCountyCodeLocation = 999 Then $CaseCountyCheck = 1 <> 1 Else ;MsgBox (0,"test of county code", "location = " &$ValidationCountyCodeLocation) $CaseCountyCheck = StringLen('$SplitFile[$ValidationCountyCodeLocation]') <> 3 ; Checks for 3 digit County Code EndIf If $ValidationRDALocation = 999 Then $CaseRDALocationCheck = 1 <> 1 Else $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA ; Checks for 4 Digit RDA EndIf If $Validation3Location = 999 Then $CaseValidation3LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation3Location]' <> $Validation3 ; Checks that Approved = True EndIf If $Validation4Location = 999 Then $CaseValidation4LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation4Location]' <> $Validation4 ; Checks that Document Type = PERM EndIf EndFunc Func ValidationCheck ($check1) $blank = StringLen ($check1) If $check1 Then EndIf EndFunc Func PreCheck($dFolder, $sFolder, $cFolder) ;----------------PreCheck for Destination Folder-------------- If FileExists ($dFolder) <> 1 Then $t = 1 Return Else $FileLog = FileOpen($dFolder & "\FileLog.log", 1) EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Source Folder-------------- If FileExists ($sFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Pending Folder -- " & $sFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Completed Folder--------- If FileExists ($cFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Completed Folder -- " & $cFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- EndFunc Func ListArray($sFolder, $Filter) $aFileList = _FileListToArray($sFolder, $Filter, 1) ;Create an array of files from the source folder filtering by filetype ;in the config.ini files for the specified section If @error = 1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") _FileWriteLog($FileLog, "Path to File(s) is Invalid") $t = 1 Return EndIf If @error = 4 Then ;MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") _FileWriteLog($FileLog, "No File(s) were found, exiting.") $t = 1 Return EndIf EndFunc ;==>ListArray
  6. Hello Im using Metro UDF and there is a code when menu panel is shown by clicking on menu button. And what I want I want make instead Case $GUI_MENU_BUTTON, this $MenuSelect[1].. Case While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($Form1) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Exit Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE, $Form1) Case $GUI_MENU_BUTTON ;Create an Array containing menu button names Local $MenuButtonsArray[5] = ["Themes Demo", "Settings", "About", "Contact", "Exit"] ; Open the metro Menu. See decleration of $MenuButtonsArray above. Local $MenuSelect = _Metro_MenuStart($Form1, 150, $MenuButtonsArray) Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array. Case "0" ConsoleWrite("Returned 0 = Starting themes demo. Please note that the window border colors are not updated during this demo." & @CRLF) ;_ThemesDemo() Case "1" ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF) Case "2" ConsoleWrite("Returned 2 = About button clicked." & @CRLF) Case "3" ConsoleWrite("Returned 3 = Contact button clicked." & @CRLF) Case "4" ConsoleWrite("Returned 4 = Exit button clicked." & @CRLF) _Metro_GUIDelete($Form1) Exit EndSwitch WEnd I tried something like this what I found on forum but not work ;~ Case Else ;~ For $i = 0 To $MenuSelect ;~ ;MsgBox("","",$liczba) ;~ ;MsgBox("","",$MenuSelect) ;~ If $MenuSelect == "1" Then ;~ ;If $MenuSelect[$i] = "0" Then ;~ ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF) ;~ ;EndIf ;~ Elseif $MenuSelect == "2" Then ;~ ConsoleWrite("Returned 2" & @CRLF) ;~ ExitLoop ;~ EndIf ;~ Next
  7. I am working on a Video Player Test Script. I am reading a text file into a 3d array to be displayed in a GUI. Array Content: [x][0]FileName.mp4 [x][1]UsageCount -> Up to a 4 digit number [x][2]EnableUsageCount (True/False) In the GUI the user can check the filename box, edit the number of usages and check EnableUsageCount to turn on the UsageCount control using the UsageCount number for the maximum number of plays. To make this easier to deal with I have removed the EnableUsageCount section, and am just concentrating on getting a method to put the edited (or unchanged) UsageCount in the array. Currently nothing is read into the array, due to my using the wrong method in the Case statement. Here are code snippets of what I am trying to do: ; Snippets from script ; I read the text file at the bottom and put the .mp4 filenames in $aManifest[x][0] and UsageCount in $aManifest[x][1] ; Then I create a GUI to display the .mp4 filenames with checkboxes and the UsageCount to the right. UsageCount is editable by the user. ; If the filename is checked, I want to read the filename into $aCheckedVideos[x][0] and the updated UsageCount in $aCheckedVideos[x][1] ; The GUICtrlRead($aVideoName[$i]) with Case $GUI_CHECKED & UNCHECKED works for the checkboxes ; This section puts the filenames in the GUI with a checkbox For $i = 0 to $iMMCount Step 1 $sMP4Text = $aManifest[$i][0] $iMP4Length = StringLen($sMP4Text) $aVideoName[$i] = GUICtrlCreateCheckbox($sMP4Text,$iLeft, $iTop) $iTop += 30 Next ; This section reads numbers from the Manifest array, and I want to be able to change the number and have them saved. ; So the Case $GUI_CHECKED & UNCHECKED won't work here, and I can't figure out what I should be doing here. For $i = 0 to $iMMCount Step 1 $sUsageText = $aManifest[$i][1] $aUsageCount[$i] = GUICtrlCreateInput($sUsageText,$iLeft, $iTop, 50,18, $GUI_DOCKAUTO) GUICtrlSetPos($aUsageCount[$i],200) $iTop += 30 Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idCloseGUI For $i = 0 To $iMMNewCount Step 1 Switch GUICtrlRead($aVideoName[$i]) Case $GUI_CHECKED $aCheckedVideos[$i][0] = $aManifest[$i][0] ; If checked, I put the results into a two D array Case $GUI_UNCHECKED ; where Video Name is $aCheckedVideos[x][0] EndSwitch Switch GUICtrlRead($aUsageCounter[$i]) Case $GUI_CHECKED $aCheckedVideos[$i][1] = $aUsageCount[$i] ;I want to put the text (numbers) in $aCheckedVideos[x][1] Case $GUI_UNCHECKED ;but what is returned is blank, probably due to EndSwitch ; $GUI_CHECKED being the wrong thing. Next ExitLoop EndSwitch WEnd ;The txt file I'm reading has the following: ;~ /** Title #1: Big Buck Bunny 1080p **/ ;~ "Name": "Big Buck Bunny", ;~ "URI": "..\\MediaFiles\\bbb_1080_60s.mp4", ;~ "UsageCount": 9999, ;~ "URI": "..\\MediaFiles\\bbb_1080_60s_enc1.mp4", ;~ "UsageCount": 45, ;~ "URI": "..\\MediaFiles\\bbb_1080_60s_enc1.mp4", ;~ "UsageCount": 2, ;~ /** Title #2: Tears of Steel 4K **/ ;~ "Name": "Tears of Steel 4K", ;~ "URI": "..\\MediaFiles\\tos_4K_60s_HEVC.mp4", ;~ "UsageCount": 9876, ;~ "URI": "..\\MediaFiles\\tos_4K_60s_HEVC_enc2.mp4", ;~ "UsageCount": 0, ;~ "URI": "..\\MediaFiles\\tos_4K_60s_HEVC_enc2.mp4", ;~ "UsageCount": 5, I am certain that the section Switch GUICtrlRead($aUsageCounter[$i]) Case $GUI_CHECKED $aCheckedVideos[$i][1] = $aUsageCount[$i] ;I want to put the text (numbers) in $aCheckedVideos[x][1] Case $GUI_UNCHECKED ;but what is returned is blank, probably due to EndSwitch ; $GUI_CHECKED being the wrong thing. is wrong, and this is what I am looking for help with. Instead of $GUI_CHECKED what should I be looking for? The worst part of this is I had this working late last night, and then lost my changes and cannot for the life of me remember how I had this working. Help is truly appreciated! Jibberish
  8. Hey guys I hope that I can get a little help with this one In this GUI example using GUIListViewEx, I have a list based on items found in test.txt. _____________________________________________ item1 item2 item3 ____________________________________________ etc.... When an item is selected, and I click the GetInfo button, a message will show the text of that item. Is it possible to activate a case like that as soon as the item is selected, so I don't need a button to start the case? #include <GUIConstantsEx.au3> #include <GUIListViewEx.au3> Global $MainGUI_ManageItemList Global $File = "test.txt" Global $FileToArray = FileReadToArray("test.txt") Call ("MainGUI_ManageItemList") Func MainGUI_ManageItemList() Local $Button1 $MainGUI_ManageItemList = GUICreate("Manage Item List", 800, 400, -1, -1) $cLV = GUICtrlCreateListView("[items]", 10, 10, 400, 775, $LVS_NOCOLUMNHEADER) GUICtrlSetFont(-1, 12, 800, 0, "@Arial Unicode MS") _GUICtrlListView_SetColumnWidth($cLV, 0, 378) $Button1 = GUICtrlCreateButton("Button 1", 425, 10, 80, 30) $RemoveItem = GUICtrlCreateButton("Remove Item", 425, 50, 80, 30) $GetInfo = GUICtrlCreateButton("GetInfo", 425, 120, 80, 30) GUISetState(@SW_SHOW, $MainGUI_ManageItemList) ; Intialise ListView Global $iLV_Index = _GUIListViewEx_Init($cLV) ; Insert lines _GUIListViewEx_Insert($FileToArray, True) ; Register required messages _GUIListViewEx_MsgRegister(True, False, False, False) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button1 MsgBox(0,"","Button 1 is pressed") Case $RemoveItem _GUIListViewEx_Delete() Case $GetInfo $ItemSelected = _GUICtrlListView_GetSelectedIndices($cLV, True) If IsArray($ItemSelected) And $ItemSelected[0] <> 0 Then ;This part makes sure it doesn't crash when no item is selected. $ItemSelectedText = _GUICtrlListView_GetItemText($cLV, $ItemSelected[1]) msgbox (0, "Selected item", $ItemSelectedText) EndIf EndSwitch WEnd EndFunc ;==>Main
  9. Good Afternoon All Let me start by saying... I'm not sure if this belongs in the GUI part of the forum as it's more of a loop / code / dynamic GUI layout issue. I understand if you move it though. I have been doing some crazy things in AutoIT lately and one of them just so happens to be an accidental infinite loop. I am dynamically populating my GUI labels... so that means if I have a users ip address I create $L_PP1_WhoISSearch However, if I assign a function to a non existent label... for instance a user has no ip address or it is invalid, I get an infinite loop / crash. The While loop below just goes crazy running ShellExecute. Since the label $L_PP1_WhoISSearch doesn't exist, the function WhoISSearch() just runs ShellExecute to infinity... What should I do differently??? Is there a trigger I can set in the Gui to ignore missing cases??? Sorry, I can only provide "snippets" of my code since it's for work. Thanks you all!!! ; This is my loop of doom if the $L_PP1_WhoISSearch doesn't exist in my gui. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $L_PP1_DashboardLink DashboardLink01() Case $L_PP1_WhoISSearch WhoISSearch() Case $B_PP1_BACK02 GUIDelete() Gui01_PP_INC() Case $B_PP1_EXIT02 Exit EndSwitch WEnd Func WhoISSearch() ShellExecute('http://whois.arin.net/rest/nets;q=' & $PP1_SourceIPClick01 & '?showDetails=true&showARIN=false&showNonArinTopLevelNet=false') ;MsgBox (0, "", 'WTF') EndFunc; This is my dynamic label for my Gui. ElseIf $i = 5 Then $L_PP1_SourceIP = GUICtrlCreateLabel($LabelVariable & ' ' & $aArray_Variable_PP_Gui01[$i], 10, $L_PP1_Var_StartHeight, 316, 19) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") $L_PP1_Var_StartHeight += 22 $L_PP1_WhoISSearch = GUICtrlCreateLabel('WhoIS Search: ' & $PP1_SourceIPClick01, 10, $L_PP1_Var_StartHeight, 316, 19) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") GUICtrlSetColor(-1, 0x0000FF) $L_PP1_Var_StartHeight += 22
  10. Hello, Please look at the code: ; As always, this is a decoy script ;) Global $sNum = Random(1, 4, 1) & "E" Switch $sNum Case "1E" And "2E" MsgBox(64, "TEST", "1E or 2E") Case "3E" And "4E" MsgBox(64, "TEST", "3E or 4E") EndSwitch MsgBox(64, "TEST", "The number was: " & $sNum) If $sNum = 1E or 2E it works, but when $sNum = 3E or 4E it shows the MsgBox for 1st Case How can I get it to work? Thanks In Advance TD
  11. This is a spin-off of >Seeker's function which i rewrote and tried to optimize for doing only sentence casing and for better Unicode handling. Haven't done a lot of testing with it, but it seems to work well so far. #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SentenceCase ; Description ...: Capitalize the first letter of sentences. ; Syntax ........: _SentenceCase(Byref $sString) ; Parameters ....: $sString: [in/out] A string value. ; Return values .: Success: A string is returned. ; Failure: Sets @error = 1 and returns 0. ; Author ........: iCode ; Modified ......: 30-MAR-2015 ; Remarks .......: ; Related .......: http://www.autoitscript.com/forum/topic/147086-udf-for-title-case-initial-caps-and-sentence-case/ ; Link ..........: http://www.autoitscript.com/forum/topic/169290-sentence-case-capitalize-first-letter-of-sentences/ ; Example .......: No ; =============================================================================================================================== Func _SentenceCase(ByRef $sString) Local $aStr = StringRegExp($sString, "(*UCP)(?s)[[:alpha:]].+?(?:[.?!:;]|\z)\s*|[^[:alpha:]]+", 3) If @error Then Return SetError(1, 0, 0) Local $sChar, $sRet = "" For $i = 0 To UBound($aStr) - 1 If StringRegExp($aStr[$i], "(*UCP)(?s)^[[:alpha:]]+.*?[.?!:;]") Then $sChar = StringLeft($aStr[$i], 1) If StringIsLower($sChar) Then $aStr[$i] = StringUpper($sChar) & StringTrimLeft($aStr[$i], 1) EndIf EndIf $sRet &= $aStr[$i] Next Return $sRet EndFunc CHANGE LOG: 28-MAR-2015 - initial version 30-MAR-2015 - added more sentence terminition characters ( ; : ) - should probably get these from a variable?
  12. I am having problem. I have script that has a main GUI window that allows you to select which kind of encryption you'd like to use. When I go to start the script, for some reason the case statement for the: $iSubmit button for the child GUI runs right away and tried to read the data from the input on the child window, which hasn't been created yet, and then pops up the MsgBox. I have been scouring the forums for something of similar nature, but unsuccessful. I have checked helpfile and it seems I am doing this correct. Here is my script: ; includes #include <GUIConstantsEx.au3> #include <Crypt.au3> ; vars Local $hGUI, $msg = 0, $hInput, $iButton, $hDecode, $dButton Local $aChkBx[8], $cValue, $iChild, $iMsg, $iPswd, $iMsgBox Local $iPswdBox, $iSubmit ;main line GUI() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $hGUI Switch $msg[0] Case $GUI_EVENT_CLOSE Quit() Case $iButton getCheckbox() inputChild() ;Crypt(, $cValue) Case $dButton getCheckbox() EndSwitch Case $iChild Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($iChild) Case $iSubmit $iMsg = GUICtrlRead($iMsgBox) $iPswd = GUICtrlRead($iPswdBox) MsgBox(0, "title", "msg:" & $iMsg & " paswrd:" & $iPswd) EndSwitch EndSwitch WEnd ;functions Func GUI() $hGUI = GUICreate("Short-Order Encrypter", 300, 200) GUICtrlCreateLabel("Encrypt a Message!", 95, 15) GUICtrlCreateLabel("This is a simple input and output encryption program.", 25, 35) GUICtrlCreateLabel("You will select which method of encryption, then", 30, 48) GUICtrlCreateLabel("input your text by pressing the Input button,", 40, 61) GUICtrlCreateLabel("or you will press the Decode button to", 55, 74) GUICtrlCreateLabel("decode an encrypted message.", 65, 87) $iButton = GUICtrlCreateButton("Input", 50, 160, 70, 30) $dButton = GUICtrlCreateButton("Decode", 160, 160, 70, 30) $aChkBx[0] = GUICtrlCreateCheckbox("Text", 15, 105) $aChkBx[1] = GUICtrlCreateCheckbox("3DES", 67, 105) $aChkBx[2] = GUICtrlCreateCheckbox("AES (128bit)", 122, 105) $aChkBx[3] = GUICtrlCreateCheckbox("AES (192bit)", 208, 105) $aChkBx[4] = GUICtrlCreateCheckbox("AES (256bit)", 32, 130) $aChkBx[5] = GUICtrlCreateCheckbox("DES", 121, 130) $aChkBx[6] = GUICtrlCreateCheckbox("RC2", 172, 130) $aChkBx[7] = GUICtrlCreateCheckbox("RC4", 224, 130) GUISetState(@SW_SHOW) EndFunc ;==>GUI Func getCheckbox() Local $i, $readArray, $cCounter = 0 For $i = 0 To UBound($aChkBx) - 1 Step 1 $readArray = GUICtrlRead($aChkBx[$i]) If $readArray = 1 Then $cCounter += 1 $cValue &= $i EndIf Next If $cCounter > 1 Then MsgBox(0, "Encryption Type", "Could not specify encryption type due to multiple selections. Please make sure you have only selected on type of encryption") $cValue = "" Return ElseIf $cCounter = 0 Then MsgBox(0, "Encryption Type", "You must select an encryption type in the Short-Order Encrypter window") Return EndIf EndFunc ;==>getCheckbox Func inputChild() If $cValue = "" Then Return EndIf $iChild = GUICreate("Input Message", 386, 120, -1, -1, -1, -1, $hGUI) GUICtrlCreateLabel("Message", 5, 10) GUICtrlCreateLabel("Password", 200, 10) $iMsgBox = GUICtrlCreateInput("", 5, 25, 180, 60) $iPswdBox = GUICtrlCreateInput("", 200, 25, 180, 60) $iSubmit = GUICtrlCreateButton("Encrypt", 172, 90) GUISetState() EndFunc ;==>inputChild #cs Func Crypt($iMsg, $iPass, $iflag) Local $mFlag[8] $mFlag[0] = "TEXT" $mFlag[1] = $CALG_3DES $mFlag[2] = $CALG_AES_128 $mFlag[3] = $CALG_AES_192 $mFlag[4] = $CALG_AES_256 $mFlag[5] = $CALG_DES $mFlag[6] = $CALG_RC2 $mFlag[7] = $CALG_RC4 EndFunc ;==>Crypt #ce Func Quit() GUIDelete($hGUI) Exit EndFunc ;==>Quit
  13. This code loads the result of a regread into a variable and then parses the result: $RegResult = RegRead($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks") Select Case $RegResult = "" $RegWriteResult = RegWrite($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks", "REG_DWORD", "0") TrayTip("Registry Read", "AutoShareWks Reg key not found and was created. The read result was: " & $RegResult & " " & @error & _ ". The write result was: " & $RegWriteResult & " " & @error, 5) Case $RegResult = "0" ; 0 indicates sharing is off TrayTip("Registry Read", "Auto Drive Sharing is currently DISABLED.", 5) Case $RegResult = "1" ; 1 indicates sharing is on TrayTip("Registry Read", "Auto Drive Sharing is currently ENABLED", 5) EndSelect The problem is that the value of AutoShareWks is boolean and either 1 or 0. The documentation for regread states that if failure of the regread, "" is returned. However it seems to also interpret 0 as "" and trigger a false failure. Even @error has the same issue. If the reading value is 0, @error will trigger. So, how can I get around this false failure trigger? EDIT: I figured out a work around like this: $RegResult = RegRead($HKLM & "\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters", "AutoShareWks") Select Case $RegResult = "0" ; 0 indicates sharing is off TrayTip("Registry Read", "Auto Drive Sharing is currently DISABLED.", 5) Case $RegResult = "1" ; 1 indicates sharing is on TrayTip("Registry Read", "Auto Drive Sharing is currently ENABLED.", 5) Case Else ; Default Actions TrayTip("Registry Read", "AutoShareWks value not present in registry. Auto Drive Sharing is currently ENABLED.", 5) EndSelect However, still....... Why is the error process not catching it correctly?
  14. so my script was made to load drivers based on a selection from a combo box. i've created a VERY robust system to load drivers when imaging with wds or ghost using a winPE wim. WDS does not work correctly with injected drivers. so comes into play my script/program that loads from a winPE wim after wds loads. anyone knows WDS is pretty powerful but it does not always have proper drivers once the winPE loads. so my program loads drivers into winPE based on the model / device. so if we get a new model of laptop or desktop and we want to save up that image to wds we find 32bit drivers and we load them into my program. wds then in turn loads my winPE with my program set to autolaunch and presenting all these options. if winPE contained a generic driver then all is good. if not then we go through my list and usually one of the drivers does work but in case it doesn't we add to my list. that's just the pre-amble incase anyone asks what i'm doing. reminder that this has worked flawlessly for the better part of a year. but now with more devices it's getting cumbersome to manually edit my code, then compile, then mount edit and recompile the winPE wim and inject my autoit program into it. takes a maximum of 5 minutes but when you're constantly testing it gets VERY bad. here's a snippet of the array for the combobox. Local $aList[300][2] = [["___________", "___________"], _ ["ASUS", "ASUS"], _ ["HP Probook 4430s", "HP Probook 4430s"], _ ["Lenovo S10-3", "Lenovo S10-3"], _ ["Lenovo x200/x230", "Lenovo x200/x230"], _ so this populates a combo box that lists these entries. i use a case select to determine which box was selected. very manual editing when i need to add another device. Func selection() $sSel = GUICtrlRead($cb_platform) $iIndex = _ArraySearch($aList, $sSel) Select Case $iIndex = 1 ;~ ASUS $driver = (@scriptdir & "\drivers\hp32\Netrtl32.inf") $nothing = $option Case $iIndex = 2 ;~ HP Probook 4430s $driver = (@scriptdir & "\drivers\hp4430\hp86win7.inf") $nothing = $option Case $iIndex = 3 ;~ Lenovo S10-3 $driver = (@scriptdir & "\drivers\lenovos103\Netrtl32.inf") $nothing = $option EndFunc this is the part of the script which i'm trying to revamp. right now my script works very awesome for what we're doing. however i want it more streamlined. as you can see once a combobox selection is selected, then it goes to that CASE and populates those variables then it kicks down to a function that i have that continues either ghost or wds depending on a selected radio box. this is what i have now for the array for the combobox. $drivers_folder=_FileListToArray(@scriptdir & "\drivers\","*",2) $cb_platform = GUICtrlCreateCombo("",10,40,600,120,-1,-1) For $i=1 To Ubound($drivers_folder)-1 GUICtrlSetData($cb_platform,$drivers_folder[$i]) Next this populates the combox based on the folder i have with each individual device. instead of creating a long winded array. the problem i have now is i don't know how to make it load the driver within that folder without a case select. i was thinking maybe something that got the name of the folder selected, then appended a "*.inf" at the end to load. but i'm totally in the dark of how to do this. if you'd like me to post all my code to help, please let me know.
  15. When trying to tab my way to the Login-button in my program it instantly activates it even without me pressing anything else than tab. Tried to make a: Case Send('{ENTER}') ExitLoop But no results. Is there any other way to make the button activate when I press enter and not activate when tabbed onto? Thanks for all help #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=..\Compilation\DeloitteADController.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseX64=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <AD.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 262, 145, 193, 124) $Username = GUICtrlCreateInput("", 112, 24, 121, 21) $Password = GUICtrlCreateInput("", 112, 64, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) GUICtrlCreateLabel("Username", 24, 24, 52, 17) GUICtrlCreateLabel("Password", 24, 64, 50, 17) $Login = GUICtrlCreateButton("Login", 24, 104, 75, 25) $Cancel = GUICtrlCreateButton("Cancel", 160, 104, 75, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Cancel Exit Case Send('{ENTER}') ExitLoop Case $Login ExitLoop EndSwitch WEnd _AD_Open(GUICtrlRead($Username), GUICtrlRead($Password)) If @error Then Exit MsgBox(16, "Active Directory Example Script", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) Global $iReply = MsgBox(308, "Active Directory Functions - Example 1", "This script adds a user to a group." & @CRLF & @CRLF & _ "Are you sure you want to change the Active Directory?") If $iReply <> 6 Then Exit #region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Active Directory Functions - Example 1", 514, 124) GUICtrlCreateLabel("User account (FQDN or samAccountName):", 8, 10, 231, 17) GUICtrlCreateLabel("Group name (without leading CN=):", 8, 42, 231, 17) Global $lUser = GUICtrlCreateInput(@UserName, 241, 8, 259, 21) Global $IGroup = GUICtrlCreateInput("", 241, 40, 259, 21) Global $BOK = GUICtrlCreateButton("Assign user to group", 8, 72, 121, 33) Global $BCancel = GUICtrlCreateButton("Cancel", 428, 72, 73, 33, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON)) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 Global $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $BCancel Exit Case $BOK Global $sUser = GUICtrlRead($lUser) Global $sGroup = GUICtrlRead($IGroup) ExitLoop EndSwitch WEnd Global $iValue = _AD_AddUserToGroup($sGroup, $sUser) If $iValue = 1 Then MsgBox(64, "Active Directory Functions - Example 1", "User '" & $sUser & "' successfully assigned to group '" & $sGroup & "'") ElseIf @error = 1 Then $sStrippedGroup = StringStripWS($sGroup, 8) Global $iStrippedValue = _AD_AddUserToGroup($sStrippedGroup, $sUser) If @error = 1 Then MsgBox(64, "Active Directory Functions - Example 1", "Group '" & $sGroup & "' does not exist") EndIf ElseIf @error = 2 Then MsgBox(64, "Active Directory Functions - Example 1", "User '" & $sUser & "' does not exist") ElseIf @error = 3 Then MsgBox(64, "Active Directory Functions - Example 1", "User '" & $sUser & "' is already a member of group '" & $sGroup & "'") Else MsgBox(64, "Active Directory Functions - Example 1", "Return code '" & @error & "' from Active Directory") EndIf _AD_Close()
  16. While i am waiting for Better Solutions for Finding Multiple @error Cases and React according to them, i am hoping that some1 could explain me what my problem in this (time consuming) function is.. The Idea is that i check for @Errors from the 3 PixelSearch i am doing, and give Message according to it. I am changing Colors In Paint for Every Loop To Test If the Color Searches Are Correct. All Cases are Working Fine, and the Right MsgBoxes are Triggered, Except the Case where all 3 Colors are Missing: HotKeySet("{ESC}", "End") Global $pixelSearchError1 = @error Global $pixelSearchError2 = @error Global $pixelSearchError3 = @error While 1 Sleep(10) $pixelsearch1 = PixelSearch(100,300,200,512,0x0000ff,10) ;Blue $pixelSearchError1 = @error $pixelsearch2 = PixelSearch(250,310,400,512,0xfa0000,10) ;Red $pixelSearchError2 = @error $pixelsearch3 = PixelSearch(500,300,600,512,0x00ff00,10) ;Green $pixelSearchError3 = @error Call("_errorcheck") WEnd Func _errorcheck() Sleep(100) Select ;Check for Blue Color, Then Proceed. Case Not $pixelSearchError1 ;Found Blue MsgBox(0,"Message","Blue Pixel Found!") Select ;Blue Found. Now check for Red Case Not $pixelSearchError2 ;Found Blue and Red MsgBox(0,"Message","Blue and Red Pixel Found!") Select ;Blue and Red found. Now check for Green Case Not $pixelSearchError3 ;Found Blue, Red and Green MsgBox(0,"Message","Blue,Red and Green Pixel Found!") Case $pixelSearchError3 ;Blue, Red But not Green MsgBox(0,"Message","Found Blue, Red But Not Green") EndSelect Case $pixelSearchError2 ;Blue Found, But Not Red MsgBox(0,"Message","Blue Found, But Not Red") Select ;Blue and Red found. Now check for Green Case Not $pixelSearchError3 ;Found Blue, Green But not Red MsgBox(0,"Message","Found Blue, Green But Not Red") Case $pixelSearchError3 ;Blue, But not Red or Green MsgBox(0,"Message","Could only Find Blue") EndSelect EndSelect Case $pixelSearchError1 ;Blue Not Found MsgBox(0,"Message","Blue Pixel Not Found") Select ;Blue Not Found. Now check for Red Case Not $pixelSearchError2 ;Found Red, But not Blue MsgBox(0,"Message","Found Red, But not Blue") Select ;Found Red, But not Blue Now check for Green Case Not $pixelSearchError3 ;Red and Green, but not Blue MsgBox(0,"Message","Red,Green But not Blue") Case $pixelSearchError3 ;Red, But not Blue or Green MsgBox(0,"Message","Could only Find Red") EndSelect Case $pixelSearchError2 ;Could not find Blue or Red MsgBox(0,"Message","Could not Find Blue and Red") Select ;Blue and Red Not found. Now check for Green Case Not $pixelsearch3 ;Only found Green MsgBox(0,"Message","Only found Green") Case $pixelSearchError3 ;Did not Find Blue,Red or Green MsgBox(0,"Message","No Color was found") EndSelect EndSelect EndSelect Sleep(10) EndFunc I Made a Picture that should make it far easier to see where one Select Case Starts and Ends Check the Link Below. http://imageshack.us/f/9/selectcasegreenerror.gif/ I can't see why the Last Case is not working.. When Blue,Red AND Green are Missing i still get the "Only found Green" Please Help Also, Building the Cases Like this takes up allot of Time and Space, so if you have a Easier way please Tell Like: If Not @error 1 And @error 2 And @error 3 Then But i don't think that Works. I probably want to run 5 PixelSearches and that would mean 5 Select an 32 Cases !!!1!!11 So it would be Great if there was another way of doing this If not, Please do still tell what the problem of my Function is
×
×
  • Create New...