Jump to content

Search the Community

Showing results for tags 'switch'.

  • 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 15 results

  1. Software Installer Version: 2.0 It's been been a long year, but I finally got some time to rework this project. I re-wrote everything from scratch because the old version was getting too complicated with so many options and sub-menus. This new version is much easier to use and I have been testing for a few days and it seems very stable. For those who are new to this software, it helps you install software silently/unattended. This new version tries to determine the silent switch automatically. You can also re-organize the order in which the software installs by dragging & dropping them in the listview. It now supports creating profiles and checks for missing software (and automatically unchecks them, so it does not attempt to install non-existent software). One feature I included was because I have seen several people on Youtube talk about disliking bright screens at night. So, now you can choose from a few color theme (half of them are dark). I dabbled a bit more into GDI+ to draw a few things and show my logo with a transparent background (hint: I'm not good at GDI+). Under the Help menu, you will find a User Guide, which goes through most of it's features. I included a new icon if you want to use when you compile the script (in the Assets > Misc folder). If you have questions, comments or suggestions, all are welcome. Hope you enjoy! Here it is in action: Software_Installer_2.0.zip
  2. 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.
  3. No luck in using search for switch user. I have two user accounts on a Win10 64bit PC and want to easily switch from one user to the other by a desktop Icon. I found a solution here , but it uses shutdown restart with registry tweaks. Is there a way to just Logout/Login ? Any ideas ? I will code myself, but some pointers are welcome.
  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. Hi guys, Could someone please tell me what I'm doing wrong with this code? I'm trying to take user input and then run a function with the same name, but it's not calling the function. So in the below after pressing Shift+F8 I would enter the text (without quotes) "testFunc". As you can see I've also tried this with IF statements, I'm new to using Switch/Case. HotKeySet("+{F8}", RunManually) Func RunManually() ;Use a case statement with 1 hot key and an InputBox to manually run functions $funcName = InputBox("Which Func to Run?", "Enter the name of the function to run") MsgBox(0, "Entered value", $funcName) ;If $funcName = testFunc Then testFunc() ;If $funcName = test2Func Then test2Func() Switch $funcName Case testFunc MsgBox(0, "Calling", "Calling Function") testFunc() MsgBox(0, "Called", "Function call finished") Case test2Func MsgBox(0, "Calling", "Calling Function") test2Func() MsgBox(0, "Called", "Function call finished") EndSwitch EndFunc While 1 ;testFunc() Sleep(1000) WEnd Func testFunc() MsgBox(0, "func running", "Seems to work!") EndFunc Func test2Func() MsgBox(0, "func 2 running", "2 Seems to work!") EndFunc Thanks!
  6. I have never used switch in AutoIT earlier. But today, when I started to implement it in my code, I am getting errors. So I tried to execute default example, but still getting the same error. Any suggestions please...
  7. Hi, I want to tell pixelsearch to search for red color shades in for example 5 different x,y,h,w of the screen. If color red was not found in these 5 area, then do something. I wrote this, but it's working only if the first case is not found. Is select a good choice? or it's better to use switch or if or something else? ٍEdit: all "do something"s are same function. (search for red color untill in these 5 areas, it couldnot find red color, then if it couldn't find red color, perform that 1 function) Thanks Select Case 1 $color1 = PixelSearch(67, 614, 77, 617, 0xE62121, 10) If @error Then do something... EndIf Case 2 $color2 = PixelSearch(165, 614, 175, 617, 0xE62121, 10) If @error Then do something... EndIf Case 3 $color3 = PixelSearch(265, 614, 275, 617, 0xE62121, 10) If @error Then do something... EndIf Case 4 $color4 = PixelSearch(365, 614, 375, 617, 0xE62121, 10) If @error Then do something... EndIf Case 5 $color5 = PixelSearch(465, 614, 475, 617, 0xE62121, 10) If @error Then do something... EndIf EndSelect
  8. Hi all! I have a problem with creating the right varibles in the switch statment and wonder if some on can help me figure out the best way to procide? i got the part when i create all trayitems with a "FOR" statement from an ini file working, but i fail when it comes to the switch statement. ini file look like this.. [Links] Calulator=Calc.exe and so on... here is part of my script.. it works for a few min.. then the hole application hangs (when compiled, seems to work in test mode, before i compile it?) is this part that seems to cose the error? Case Else If $Msg > 0 Then _DebugOut("While Statement - $Msg: " & $Msg) $aSearch = _ArraySearch($Linksarray, $gText, 0, 0, 0, 1, 1, 0) If @error Then Else $aSearch1 = _ArraySearch($Linksarray, $Linksarray[$aSearch][0], 0, 0, 0, 1, 1, 0) If @error Then Else _DebugOut("While Statement - $aSearch1: " & $Linksarray[$aSearch1][0]) _DebugOut("While Statement - $aSearch1: " & $Linksarray[$aSearch1][1]) ShellExecute($Linksarray[$aSearch][1], "", "", "open") EndIf EndIf EndIf here is both functions... Func _WinMain() _readConfigFile() Opt("TrayMenuMode", 11) Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled _TrayInit() ; Main GUI Loop Local $tvHandle = 0 $iBegin = TimerInit() $LatencyUrl = IniRead($ConfigFile, "General", "LatencyUrl", "www.charger.se") $LatencyMS = IniRead($ConfigFile, "General", "LatencyMS", "500") HotKeySet("+!z", '_ShowITSupport') HotKeySet("+!x", '_ShowITSupport') While 1 $Msg = GUIGetMsg() $gText = _GetMenuText($Msg) If TimerDiff($iBegin) > 5000 Then ; Loop until 5 sec have passed _Ping($LatencyUrl, $LatencyMS) #cs Local $net_test = _IsInternetConnectedEx() ; ConsoleWrite("$net_test: " & $net_test & @CRLF) If $net_test = 1 Then Local $net_test2 = __GetConnectedAdapterIPMAC() If StringInStr($net_test2, "Wireless") Or StringInStr($net_test2, "Wired") Then EndIf Else ConsoleWrite("$net_test2? " & __GetConnectedAdapterIPMAC() & @CRLF) EndIf #ce ; ConsoleWrite("Counter: " & $iBegin & @CRLF) $iBegin = TimerInit() EndIf Switch $Msg Case $ToggleLogonUser _DebugOut("While Statement - $ToggleLogonUser: " & $gText) _ToggleLogonUser() Case $TrayTS _DebugOut("While Statement - $TrayTS: " & $gText) _DebugOut(@ScriptDir & "TeamViewerQS_sv-idcnnz7xxq.exe" & @CRLF) FileInstall("Res\TeamViewerQS_sv-idcnnz7xxq.exe", @ScriptDir & "\TeamViewerQS_sv-idcnnz7xxq.exe", 0) ShellExecute("TeamViewerQS_sv-idcnnz7xxq.exe", "", @ScriptDir, 'open') ; Sleep(10000) Case $ResetInternet _DebugOut("While Statement - $ResetInternet: " & $gText) $tmpNessage = MsgBox(20, "Warning", "You are about to do a complete Network reset!") If $tmpNessage = 6 Then _DebugOut("While Statement - $ResetInternet: MsgBox, Returns: " & $tmpNessage) Else _DebugOut("While Statement - $ResetInternet: MsgBox, Returns: " & $tmpNessage) EndIf Case $TrayExit _DebugOut("While Statement - $TrayExit: " & $gText) _TrayIconDelete($nTrayIcon1) ExitLoop Case Else #cs If $Msg > 0 Then _DebugOut("While Statement - $Msg: " & $Msg) $aSearch = _ArraySearch($Linksarray, $gText, 0, 0, 0, 1, 1, 0) If @error Then Else $aSearch1 = _ArraySearch($Linksarray, $Linksarray[$aSearch][0], 0, 0, 0, 1, 1, 0) If @error Then Else _DebugOut("While Statement - $aSearch1: " & $Linksarray[$aSearch1][0]) _DebugOut("While Statement - $aSearch1: " & $Linksarray[$aSearch1][1]) ShellExecute($Linksarray[$aSearch][1], "", "", "open") EndIf EndIf EndIf #ce EndSwitch Sleep(10) WEnd _TrayIconDelete($nTrayIcon1) EndFunc ;==>_WinMain Func _TrayInit() Opt('TrayMenuMode', 3) ; Default tray menu items (Script Paused/Exit) will not be shown. Opt('TrayAutoPause', 0) ; Script will not be paused when clicking the tray icon. ;Opt("TrayOnEventMode", 1) Opt('MustDeclareVars', 0) ; *** Create the tray icon *** ;Func _TrayIconCreate($sToolTip = "", $sIconFile = @AutoItExe, $nIconID = 0, $sCallback = "", $nMsg = 0, $hIcon = 0) ;TraySetIcon(@ScriptFullPath, "201") $nTrayIcon1 = _TrayIconCreate("Datornamn: " & @ComputerName & @CRLF & "IPAdress: " & @IPAddress1 & " ," & @IPAddress2, @ScriptFullPath, -1) _TrayIconSetClick(-1, 16) _TrayIconSetState() ; Show the tray icon ; *** Create the tray context menu *** Local $iIndex = _ArraySearch($GeneralArray, "Kund", 0, 0, 0, 1, 1, 0) $TrayMenuname = "ChaQ - " & $GeneralArray[$iIndex][1] $nTrayMenu1 = _TrayCreateContextMenu() ; is the same like _TrayCreateContextMenu(-1) or _TrayCreateContextMenu($nTrayIcon1) $nSideItem3 = _CreateSideMenu($nTrayMenu1) _SetSideMenuText($nSideItem3, $TrayMenuname) _SetSideMenuColor($nSideItem3, 0x00FFFF) ; yellow; default color - white _SetSideMenuBkColor($nSideItem3, 0x802222) ; bottom start color - dark blue _SetSideMenuBkGradColor($nSideItem3, 0x4477AA) ; top end color - orange _SetSideMenuImage($nSideItem3, "shell32.dll", 309, True) $TrayCase = _TrayCreateItem("SupportCenter, Add a Case") _TrayCreateItem("") _TrayItemSetIcon($TrayCase, @ScriptFullPath, -7) $TrayTS = _TrayCreateItem("Teamviwer") _TrayCreateItem("") _TrayItemSetIcon($TrayTS, @ScriptFullPath, -9) $MenuLinks = _TrayCreateMenu("Links") _TrayCreateItem("") _TrayItemSetIcon($MenuLinks, "shell32.dll", -44) $MenuTools = _TrayCreateMenu("Program") _TrayCreateItem("") _TrayItemSetIcon($MenuTools, "", 0) $chargeitem = _TrayCreateMenu("Tools") $chargeitem1 = _TrayCreateMenu("Settings", $chargeitem) _TrayCreateItem("") $TrayExit = _TrayCreateItem("Exit") _TrayItemSetIcon($TrayCase, @ScriptFullPath, -7) _TrayItemSetIcon($MenuLinks, "shell32.dll", -318) _TrayItemSetSelIcon($MenuLinks, "shell32.dll", -44) _TrayItemSetIcon($MenuTools, "shell32.dll", -20) _TrayItemSetSelIcon($MenuTools, "shell32.dll", -20) _TrayItemSetIcon($chargeitem, @ScriptFullPath, -11) _TrayItemSetSelIcon($chargeitem, @ScriptFullPath, -11) _TrayItemSetIcon($chargeitem1, @ScriptFullPath, -11) _TrayItemSetSelIcon($chargeitem1, @ScriptFullPath, -11) _TrayItemSetIcon($TrayHelp, "mstsc_101.ico", 0) _TrayItemSetIcon($TrayTS, @ScriptFullPath, -9) _TrayItemSetIcon($TrayExit, "shell32.dll", -28) ; *** Sub menu items *** For $x = 1 To $Linksarray[0][0] _DebugOut("$Linksarray " & $Linksarray[$x][0]) If StringInStr($Linksarray[$x][1], "http") Then $Tray_Item[$x] = _TrayCreateItem($Linksarray[$x][0], $MenuLinks) _TrayItemSetIcon($Tray_Item[$x], "shell32.dll", -14) Else $Tray_Item[$x] = _TrayCreateItem($Linksarray[$x][0], $MenuTools) _TrayItemSetIcon($Tray_Item[$x], $Linksarray[$x][1], "") EndIf Next $EnableBit = _TrayCreateItem("Enable (BIT/WSUS)", $chargeitem) $DisableBit = _TrayCreateItem("Disable (BIT/WSUS)", $chargeitem) $ResetInternet = _TrayCreateItem("Reset Internet Connection", $chargeitem) $ToggleLogonUser = _TrayCreateItem("Toggle Username/logon screen", $chargeitem) _TrayItemSetIcon($TrayTSSite, "shell32.dll", -14) _TrayItemSetIcon($TraySupportSite, "shell32.dll", -14) _TrayItemSetIcon($TraySupportSite1, "shell32.dll", -14) _TrayItemSetIcon($DisableBit, "shell32.dll", -275) _TrayItemSetIcon($EnableBit, "shell32.dll", -276) _TrayItemSetIcon($ResetInternet, @ScriptFullPath, -12) _TrayItemSetIcon($ToggleLogonUser, "regedit.exe", -1) GUICtrlSetState($chargeitem, $GUI_DISABLE) GUICtrlSetState($EnableBit, $GUI_DISABLE) GUICtrlSetState($DisableBit, $GUI_DISABLE) GUICtrlSetState($ResetInternet, $GUI_DISABLE) EndFunc ;==>_TrayInit
  9. I taught myself how to script and have done some pretty basic stuff so far. I wrote the script below to detect the current orientation of my monitor, then switch it to a different orientation. I'm bored and I've got the day off, so I'd like to tackle a new challenge. Please review the script below to get an idea of my skill level, then suggest something challenging for me to write. Just no API usage. Thanks! $Desktop_Height = @DesktopHeight $Desktop_Width = @DesktopWidth Run("control desk.cpl") WinWaitActive("Screen Resolution") ControlSend("Screen Resolution", "", "", "!o") If $Desktop_Height < $Desktop_Width Then ControlSend("Screen Resolution", "", "", "{Down}") ElseIf $Desktop_Height > $Desktop_Width Then ControlSend("Screen Resolution", "", "", "{Up}") EndIf ControlSend("Screen Resolution", "", "", "!a") WinWaitActive("Display Settings") ControlSend("Screen Resolution", "", "", "!k") WinWaitActive("Screen Resolution") ControlSend("Screen Resolution", "", "", "!{F4}") Exit
  10. Can you nest switches? I have nested switches sometimes 3 deep in my app, yet au3Check will pick random endswitch statements and tell me its missing a Wend.. example: switch Case $1 = "Option A" ;do something Case $1 = "Option B" ;do something Case $1 = "Option C" switch Case $A = "Enabled" ;do something Case $A = "Disabled" ;do something Endswitch Case $1 = "Option H" ;do something Endswitch One of the errors I got in my script: "C:\1\2.au3"(1471,4) : error: missing Wend. EndSwitch ^ My script is too large to post, (over 3k in total size)
  11. Hello friends , I was working on my project today and got a wild idea with Switch..EndSwitch statements, it looks like this: #include <MsgBoxConstants.au3> $iWildInteger = 10 Switch $iWildInteger Case 1 MsgBox($MB_OK, "AutoIt Forums", "The value of $iWildInteger is " & 1 & '.') Case 2, Else MsgBox($MB_OK, "AutoIt Forums", "The value of $iWildInteger is " & 2 & ' or else.') EndSwitchA case with Else and another value... I tried it but It didn't work , I think its great to have a feature like this so that I don't have to have a separate case for it Please note that this is *NOT* a feature request , This is a poll for opinion on this feature (before making a feature request in the BT ), Vote wisely, TD
  12. 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
  13. 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
  14. I'm attempting to created a windows task using SCHTASKS, but seem to have my formatting incorrect as a double quote is getting stripped out. How might I correct my code to resolve this dilemma? #RequireAdmin #include <AutoItConstants.au3> Global $TaskName, $sStartTime, $Program, $ProgramName, $Argument $TaskName = "MyTask" $sStartTime = "15:00" $ProgramName = "\\Server\share\myapp.exe" $Argument = " /verbose" $Program = '"' & $ProgramName & '"' & $Argument & '"' MsgBox(0, "Program with Argument", $Program) Scheduler() Func Scheduler() Local $sCmd, $sStartDate, $sDateTime, $sXtra_Parms, $Result Local $QueryTask = Run("SCHTASKS /QUERY /TN " & $TaskName, "", @SW_HIDE, $STDOUT_CHILD) Local $line = "" If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Or @OSVersion = "WIN_8" Or @OSVersion = "WIN_81" Then $sXtra_Parms = " /Z /V1" While 1 $line &= StdoutRead($QueryTask) If @error Then ExitLoop WEnd If $line = "" Then MsgBox(1, "Task Command", 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms) $sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms ;$sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & $Program & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms Else $sCmd = 'SCHTASKS /CHANGE /TN ' & $TaskName & ' /ST ' & $sStartTime EndIf $Result = Run($sCmd, "", @SW_HIDE) If $Result > 0 Then MsgBox(64, "Success!!", "The task was successfully created.") Else MsgBox(48, "Sorry...", "There was a problem scheduling this installation, please contact the HelpDesk for assistance.") EndIf EndFunc ;==>Scheduler The task is created with the above code, except the formatting is wrong so I getting an invalid directory error upon run time. The above creates this command (Serversharemyapp.exe" /verbose) in the task scheduler. What I'm actually trying to get is ("Serversharemyapp.exe" /verbose) The first double quote is being stripped out using my faulty code. Any suggestions? Thanks for your time, -Mike
  15. I want to do several Pixelsearches on my Screen to find out if i can find the Chrome Browser ^^ Instead of one big search on the screen i run $pixesearch1,$pixesearch2,$pixesearch3 etc. on a sliced up Screen. I have done something similar before.. But i wanted to ask if i should use Switch or Select? Do they only run ONE of their cases? or run as many cases that are True?
×
×
  • Create New...