Jump to content

zone97

Active Members
  • Posts

    181
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

zone97's Achievements

Prodigy

Prodigy (4/7)

9

Reputation

  1. Yes sir, thank you kindly for the help.
  2. Thanks, I was searching for multi, guess I should have searched for monitor. Thanks.
  3. I searched through this topic, but couldn't find what I needed. I have a 3 monitor setup, and would like these to appear on the right side, of the middle monitor? anyway to make that happen? Thanks
  4. Ok, so i have found out WHY it doesn't work, but id like to make it work as intended. Seems as if the GUI starts hidden, that's when the child windows AKA the settings, stop showing. I fixed it by showing the GUI for a flash, then it minimizes. This makes it work, but id like it to never show, not even a flash when started minimized to tray.. Is this a possibility?
  5. So I have a program I put together that uses the run from short cut function. Which when you specify run minimized from a short cut to the program, it runs minimized.. Sounds simple? however when you do this.. None of the child windows the program calls work? When ran normally via the shortcut, everything works well. Any idea why this may happen? #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\Icons\winsizer.ico #AutoIt3Wrapper_Outfile=..\program\winsizer.exe #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Res_Icon_Add=..\Icons\winsizer_off.ico #AutoIt3Wrapper_Run_Tidy=y #Tidy_Parameters=/tc 4 /reel #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;╔══════════════════════════════════════════════════════════╗ ;║ __ __.__ _________.__ ║ ;║ / \ / \__| ____ / _____/|__|_______ ___________ ║ ;║ \ \/\/ / |/ \ \_____ \ | \___ // __ \_ __ \ ║ ;║ \ /| | | \/ \| |/ /\ ___/| | \/ ║ ;║ \__/\ / |__|___| /_______ /|__/_____ \\___ >__| ║ ;║ \/ \/ \/ \/ \/ ║ ;╟──────────────────────────────────────────────────────────╢ ;║ Program by: Zone97 ║ ;║ Written on: 12/28/2016 ║ ;║ Function: Capture and store desktop window size and ║ ;║ locations. ║ ;╚══════════════════════════════════════════════════════════╝ ;╔══════════════════════════════════════════════════════════╗ ;║ Includes ║ ;╚══════════════════════════════════════════════════════════╝ #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <TrayConstants.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <GuiListView.au3> #include <Misc.au3> ; - Custom UDFs #include ".\Includes\ExtMsgBox.au3" #include ".\Includes\HotKeyInput.au3" #include ".\Includes\HotKey.au3" ;╔══════════════════════════════════════════════════════════╗ ;║ GUI Options ║ ;╚══════════════════════════════════════════════════════════╝ Opt("TrayMenuMode", 3) ;╔══════════════════════════════════════════════════════════╗ ;║ Variables ║ ;╚══════════════════════════════════════════════════════════╝ ; - System Locals Local $hDLL = DllOpen("user32.dll") Local $AbtConfig[7] = [5, 0, 0xBBBBBB, 0x333333, 12, "Courier New", 500] ; - System Globals Global $INIfile = "winsizer.ini" Global $GUITitle = "WinSizer 2.1d" Global $sState = @SW_SHOW Global $sShortcut = _RunFromShortcut() ; - GUI_Main Globals Global $Form1 = 9999, $List1, $List2, $Button1, $Button2, $Button3, $Button4, $TrayMenu, $TrayExit, $TrayActive, $TrayAbout, $TraySetKey ; - GUI_Settings Globals Global $Form2 = 9999, $bLabel1, $bLabel2, $bLabel3, $bLabel4, $bLabel5, $bLabel6, $bGroup1, $bRadio1, $bRadio2, $bRadio3, $bRadio4, $bRadio5, $bRadio6, $bInput1, $bInput2, $bInput3, $bInput4, $bInput5, $bInput6, $bButton1, $bButton2, $bCheckbox1, $NewClass, $NewWin, $xPos, $xSize, $yPos, $ySize ; - GUI_SetHotKey Globals Global $Form3 = 9999, $hkButton1, $hkButton2, $hkInput1, $hkLabel1 ; - Other Globals Global $iniTotal, $index, $sItem1, $sItem2, $sItems, $tClass, $tPos, $tSize, $tMode, $tAction, $hTimer, $IsDisabled ;╔══════════════════════════════════════════════════════════╗ ;║ Pre-startup checks ║ ;╚══════════════════════════════════════════════════════════╝ If IsArray($sShortcut) Then If $sShortcut[6] = 3 Then $sState = @SW_SHOW If $sShortcut[6] = 7 Then $sState = @SW_HIDE EndIf If _Singleton($GUITitle, 1) = 0 Then ; -- Check that it only is ran once! WinActivate($GUITitle) Exit EndIf TraySetToolTip($GUITitle) ;╔══════════════════════════════════════════════════════════╗ ;║ Hot keys ║ ;╚══════════════════════════════════════════════════════════╝ Global $hotkey = IniRead($INIfile, "Hotkeys", "Key1", "1626") _HotKey_Assign($hotkey, '_QuickAdd', $HK_FLAG_DEFAULT) ;╔══════════════════════════════════════════════════════════╗ ;║ Start of main loop ║ ;╚══════════════════════════════════════════════════════════╝ GUI_Main() _Refresh() While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[1] Case $Form1 ; - GUI_Main() Switch $nMsg[0] Case $GUI_EVENT_CLOSE _ExtMsgBoxSet($AbtConfig[0], $AbtConfig[1], $AbtConfig[2], $AbtConfig[3], $AbtConfig[4], $AbtConfig[5], $AbtConfig[6]) $Confirm = _ExtMsgBox(@ScriptFullPath, 4, "Confirm Close", "Are you sure you want to EXIT?", 0) _ExtMsgBoxSet(Default) If $Confirm = 1 Then Exit Case $GUI_EVENT_MINIMIZE WinSetState($Form1, "", @SW_HIDE) Case $Button1 ; Add New Button $sItem1 = GUICtrlRead(GUICtrlRead($List1)) If $sItem1 <> "" Then $sItem1 = StringTrimRight($sItem1, 1) ; Will remove the pipe "|" from the end of the string $sItems = StringSplit($sItem1, "|") $NewWin = $sItems[1] $NewClass = _WinGetClass($NewWin) $NewPos = WinGetPos($NewWin) $xSize = $NewPos[2] $ySize = $NewPos[3] $xPos = $NewPos[0] $yPos = $NewPos[1] GUI_Settings() EndIf Case $Button2 _Refresh() Case $Button3 ; Edit Button $sItem1 = GUICtrlRead(GUICtrlRead($List2)) If $sItem1 <> "" Then $index = _GUICtrlListView_GetSelectedIndices($List2) + 1 $sItem1 = StringTrimRight($sItem1, 1) ; Will remove the pipe "|" from the end of the string $sItems = StringSplit($sItem1, "|") $NewWin = $sItems[1] $NewClass = $sItems[2] $NewSize = StringSplit($tSize[$index], "x") $NewPos = StringSplit($tPos[$index], "x") $xSize = $NewSize[1] $ySize = $NewSize[2] $xPos = $NewPos[1] $yPos = $NewPos[2] GUI_Settings() EndIf Case $Button4 ; Delete Button $sItem2 = GUICtrlRead(GUICtrlRead($List2)) $index = _GUICtrlListView_GetSelectedIndices($List2) + 1 $sItem2 = StringTrimRight($sItem2, 1) ; Will remove the pipe "|" from the end of the string _DelWindow() EndSwitch Case $Form2 ; - GUI_Settings() Switch $nMsg[0] Case $bButton1 _AddEditWindow() GUIDelete($Form2) Case $bButton2 GUIDelete($Form2) EndSwitch Case $Form3 Switch $nMsg[0] Case $hkButton1 _HotKey_Release() $hotkey = _GUICtrlHKI_GetHotKey($hkInput1) IniWrite($INIfile, "Hotkeys", "Key1", $hotkey) _HotKey_Assign($hotkey, '_QuickAdd', $HK_FLAG_DEFAULT) _GUICtrlHKI_Release() GUIDelete($Form3) Case $hkButton2 GUIDelete($Form3) EndSwitch EndSwitch Switch TrayGetMsg() Case $TrayMenu WinSetState($Form1, "", @SW_SHOWNORMAL) _Refresh() Case $TrayExit Exit Case $TrayActive If BitAND(TrayItemGetState($TrayActive), $TRAY_CHECKED) = $TRAY_CHECKED Then TrayItemSetState($TrayActive, $TRAY_UNCHECKED) TraySetIcon(@ScriptFullPath, 200) Else TrayItemSetState($TrayActive, $TRAY_CHECKED) TraySetIcon(@ScriptFullPath, 201) EndIf Case $TrayAbout _About() Case $TraySetKey GUI_SetHotKey() EndSwitch ; - Set a timer to only check for active window every 2 seconds If Not WinExists($GUITitle & " Settings") Then Local $fDiff = TimerDiff($hTimer) $fDiff = Round($fDiff, 0) If $fDiff > 1000 Then Local $hTimer = TimerInit() _FindWindows() EndIf Else If WinExists($NewWin) Then If Not BitAND(GUICtrlRead($bCheckbox1), $GUI_CHECKED) = $GUI_CHECKED Then $tmpPos = WinGetPos($NewWin) GUICtrlSetData($bInput3, $tmpPos[2]) GUICtrlSetData($bInput4, $tmpPos[3]) GUICtrlSetData($bInput5, $tmpPos[0]) GUICtrlSetData($bInput6, $tmpPos[1]) EndIf EndIf EndIf _ErrorTraps() ; - Check for window to be active. WEnd ;╔══════════════════════════════════════════════════════════╗ ;║ GUI Functions ║ ;╚══════════════════════════════════════════════════════════╝ Func GUI_Main() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate($GUITitle, 520, 390, -1, -1) $List1 = GUICtrlCreateListView("Title|Class", 10, 20, 500, 110, $LVS_SORTASCENDING + $LVS_SINGLESEL) $List2 = GUICtrlCreateListView("Title|Class|Mode|Action", 10, 215, 500, 110, $LVS_SINGLESEL) $Group1 = GUICtrlCreateGroup("Currently open windows", 5, 5, 510, 180) $Group2 = GUICtrlCreateGroup("Windows to be monitored", 5, 200, 510, 180) $Button1 = GUICtrlCreateButton("Select", 187, 145, 75, 25) GUICtrlSetTip(-1, "CTRL-ALT-Z") $Button2 = GUICtrlCreateButton("Refresh", 269, 145, 75, 25) $Button3 = GUICtrlCreateButton("Edit", 187, 338, 75, 25) $Button4 = GUICtrlCreateButton("Delete", 269, 338, 75, 25) ; - Form options GUISetBkColor(0xC0C0C0, $Form1) GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 0, 320) GUICtrlSendMsg($List1, $LVM_SETCOLUMNWIDTH, 1, 159) GUICtrlSendMsg($List2, $LVM_SETCOLUMNWIDTH, 0, 233) GUICtrlSendMsg($List2, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlSendMsg($List2, $LVM_SETCOLUMNWIDTH, 2, 45) GUICtrlSendMsg($List2, $LVM_SETCOLUMNWIDTH, 3, 50) ; - Tray menu items $TrayActive = TrayCreateItem("Disabled") TrayCreateItem("") $TrayMenu = TrayCreateItem("Open") $TrayAbout = TrayCreateItem("About") $TraySetKey = TrayCreateItem("HotKey") TrayCreateItem("") $TrayExit = TrayCreateItem("Exit") GUISetState($sState) TrayItemSetState($TrayMenu, $TRAY_DEFAULT) #EndRegion ### END Koda GUI section ### EndFunc ;==>GUI_Main Func GUI_Settings() #Region ### START Koda GUI section ### Form= $Form2 = GUICreate($GUITitle & " Settings", 437, 185, -1, -1, $WS_EX_TOOLWINDOW) $bLabel1 = GUICtrlCreateLabel("Window title:", 8, 10, 65, 17) $bLabel2 = GUICtrlCreateLabel("Class name:", 8, 40, 61, 17) $bLabel3 = GUICtrlCreateLabel("Size:", 278, 82, 27, 17) $bLabel4 = GUICtrlCreateLabel("Position:", 278, 106, 44, 17) $bLabel5 = GUICtrlCreateLabel("X", 371, 84, 9, 17) $bLabel6 = GUICtrlCreateLabel("X", 371, 107, 9, 17) $bGroup1 = GUICtrlCreateGroup("Search Options", 8, 68, 107, 81) $bGroup2 = GUICtrlCreateGroup("Action Options", 124, 68, 107, 81) GUIStartGroup() $bRadio1 = GUICtrlCreateRadio("Title Only", 20, 86, 73, 17) $bRadio2 = GUICtrlCreateRadio("Class Only", 20, 101, 77, 17) $bRadio3 = GUICtrlCreateRadio("Both", 20, 116, 69, 17) GUIStartGroup() $bRadio4 = GUICtrlCreateRadio("Move", 136, 86, 73, 17) $bRadio5 = GUICtrlCreateRadio("Resize", 136, 101, 77, 17) $bRadio6 = GUICtrlCreateRadio("Both", 136, 116, 69, 17) $bInput1 = GUICtrlCreateInput($NewWin, 82, 8, 341, 21) $bInput2 = GUICtrlCreateInput($NewClass, 82, 38, 341, 21) $bInput3 = GUICtrlCreateInput($xSize, 326, 80, 40, 21) $bInput4 = GUICtrlCreateInput($ySize, 382, 80, 40, 21) $bInput5 = GUICtrlCreateInput($xPos, 326, 102, 40, 21) $bInput6 = GUICtrlCreateInput($yPos, 382, 102, 40, 21) $bButton1 = GUICtrlCreateButton("Save", 266, 126, 75, 25) $bButton2 = GUICtrlCreateButton("Cancel", 349, 126, 75, 25) $bCheckbox1 = GUICtrlCreateCheckbox("Pause Auto Update", 294, 62, 117, 17) ; - Form options GUISetBkColor(0xC0C0C0, $Form2) ; - Set form defaults GUICtrlSetState($bRadio3, $GUI_CHECKED) GUICtrlSetState($bRadio6, $GUI_CHECKED) ; - Check for defaults If $index <> "" Then If $tMode[$index] = "Both" Then GUICtrlSetState($bRadio3, $GUI_CHECKED) ElseIf $tMode[$index] = "Title" Then GUICtrlSetState($bRadio1, $GUI_CHECKED) ElseIf $tMode[$index] = "Class" Then GUICtrlSetState($bRadio2, $GUI_CHECKED) EndIf If $tAction[$index] = "Both" Then GUICtrlSetState($bRadio6, $GUI_CHECKED) ElseIf $tAction[$index] = "Move" Then GUICtrlSetState($bRadio4, $GUI_CHECKED) ElseIf $tAction[$index] = "Resize" Then GUICtrlSetState($bRadio5, $GUI_CHECKED) EndIf EndIf GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc ;==>GUI_Settings Func GUI_SetHotKey() #Region ### START Koda GUI section ### Form= $Form3 = GUICreate($GUITitle & " Hotkey", 255, 125, -1, -1, $WS_EX_TOOLWINDOW) $hkButton1 = GUICtrlCreateButton("Update", 86, 64, 75, 25) $hkButton2 = GUICtrlCreateButton("Cancel", 167, 64, 75, 25) $hkLabel1 = GUICtrlCreateLabel("Enter Hotkey (Click input box first.)", 8, 12, 200, 17, 0) $hkInput1 = _GUICtrlHKI_Create($hotkey, 6, 36, 237, 21) ; - Form options GUISetBkColor(0xC0C0C0, $Form3) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc ;==>GUI_SetHotKey ;╔══════════════════════════════════════════════════════════╗ ;║ App Functions ║ ;╚══════════════════════════════════════════════════════════╝ Func _ActiveWinList() $aList = WinList() For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And $aList[$i][0] <> $GUITitle And BitAND(WinGetState($aList[$i][1]), 2) And Not BitAND(WinGetState($aList[$i][1]), 16) Then ; - Not blank title, Self, hidden, or minimized! $winClass = _WinGetClass($aList[$i][0]) GUICtrlCreateListViewItem($aList[$i][0] & "|" & $winClass, $List1) EndIf Next EndFunc ;==>_ActiveWinList Func _AddEditWindow() Global $titles = IniReadSection($INIfile, "Titles") If $index = "" Then $RandNo = Random(100000, 999999, 1) Else $RandNo = $titles[$index][0] EndIf $NewWin = GUICtrlRead($bInput1) $NewClass = GUICtrlRead($bInput2) $NewSizeX = GUICtrlRead($bInput3) $NewSizeY = GUICtrlRead($bInput4) $NewPosX = GUICtrlRead($bInput5) $NewPosY = GUICtrlRead($bInput6) For $y = 1 To $iniTotal If $titles[$y][1] = $NewWin Then $RandNo = $titles[$y][0] EndIf Next If BitAND(GUICtrlRead($bRadio1), $GUI_CHECKED) = $GUI_CHECKED Then $Mode = "Title" If BitAND(GUICtrlRead($bRadio2), $GUI_CHECKED) = $GUI_CHECKED Then $Mode = "Class" If BitAND(GUICtrlRead($bRadio3), $GUI_CHECKED) = $GUI_CHECKED Then $Mode = "Both" If BitAND(GUICtrlRead($bRadio4), $GUI_CHECKED) = $GUI_CHECKED Then $Action = "Move" If BitAND(GUICtrlRead($bRadio5), $GUI_CHECKED) = $GUI_CHECKED Then $Action = "Resize" If BitAND(GUICtrlRead($bRadio6), $GUI_CHECKED) = $GUI_CHECKED Then $Action = "Both" IniWrite($INIfile, "Titles", $RandNo, $NewWin) IniWrite($INIfile, $RandNo, "Mode", $Mode) IniWrite($INIfile, $RandNo, "Action", $Action) IniWrite($INIfile, $RandNo, "Class", $NewClass) IniWrite($INIfile, $RandNo, "Size", $NewSizeX & "x" & $NewSizeY) IniWrite($INIfile, $RandNo, "Position", $NewPosX & "x" & $NewPosY) _Refresh() EndFunc ;==>_AddEditWindow Func _DelWindow() If $sItem2 <> "" Then Global $titles = IniReadSection($INIfile, "Titles") IniDelete($INIfile, "Titles", $titles[$index][0]) IniDelete($INIfile, $titles[$index][0]) $iniTotal = $iniTotal - 1 _Refresh() EndIf EndFunc ;==>_DelWindow Func _WinGetClass($Form1) If IsHWnd($Form1) = 0 And WinExists($Form1) Then $Form1 = WinGetHandle($Form1) Local $aGCNDLL = DllCall('User32.dll', 'int', 'GetClassName', 'hwnd', $Form1, 'str', '', 'int', 4095) If @error = 0 Then Return $aGCNDLL[2] Return SetError(1, 0, '') EndFunc ;==>_WinGetClass Func _INItoArray() Global $titles = IniReadSection($INIfile, "Titles") If Not @error Then $iniTotal = $titles[0][0] Global $tMode[$iniTotal + 1], $tAction[$iniTotal + 1], $tClass[$iniTotal + 1], $tSize[$iniTotal + 1], $tPos[$iniTotal + 1] For $x = 1 To $iniTotal $tMode[$x] = IniRead($INIfile, $titles[$x][0], "Mode", "") $tAction[$x] = IniRead($INIfile, $titles[$x][0], "Action", "") $tClass[$x] = IniRead($INIfile, $titles[$x][0], "Class", "") $tSize[$x] = IniRead($INIfile, $titles[$x][0], "Size", "") $tPos[$x] = IniRead($INIfile, $titles[$x][0], "Position", "") GUICtrlCreateListViewItem($titles[$x][1] & "|" & $tClass[$x] & "|" & $tMode[$x] & "|" & $tAction[$x], $List2) Next EndIf EndFunc ;==>_INItoArray Func _Refresh() _GUICtrlListView_DeleteAllItems($List1) _GUICtrlListView_DeleteAllItems($List2) _INItoArray() _ActiveWinList() $index = "" EndFunc ;==>_Refresh Func _FindWindows() If Not BitAND(TrayItemGetState($TrayActive), $TRAY_CHECKED) = $TRAY_CHECKED Then If $iniTotal > 0 Then For $y = 1 To $iniTotal If WinExists($titles[$y][1]) Then Local $tmpPos = WinGetPos($titles[$y][1]) $wSize = StringSplit($tSize[$y], "x") $wPos = StringSplit($tPos[$y], "x") If $tMode[$y] = "Both" And $tAction[$y] = "Both" Then WinMove("[TITLE:" & $titles[$y][1] & "; CLASS:" & $tClass[$y] & "]", "", $wPos[1], $wPos[2], $wSize[1], $wSize[2]) ElseIf $tMode[$y] = "Both" And $tAction[$y] = "Move" Then WinMove("[TITLE:" & $titles[$y][1] & "; CLASS:" & $tClass[$y] & "]", "", $wPos[1], $wPos[2]) ElseIf $tMode[$y] = "Both" And $tAction[$y] = "Resize" Then WinMove("[TITLE:" & $titles[$y][1] & "; CLASS:" & $tClass[$y] & "]", "", $tmpPos[0], $tmpPos[1], $wSize[1], $wSize[2]) ElseIf $tMode[$y] = "Title" And $tAction[$y] = "Both" Then WinMove("[TITLE:" & $titles[$y][1] & "]", "", $wPos[1], $wPos[2], $wSize[1], $wSize[2]) ElseIf $tMode[$y] = "Title" And $tAction[$y] = "Move" Then WinMove("[TITLE:" & $titles[$y][1] & "]", "", $wPos[1], $wPos[2]) ElseIf $tMode[$y] = "Title" And $tAction[$y] = "Resize" Then WinMove("[TITLE:" & $titles[$y][1] & "]", "", $tmpPos[0], $tmpPos[1], $wSize[1], $wSize[2]) ElseIf $tMode[$y] = "Class" And $tAction[$y] = "Both" Then WinMove("[CLASS:" & $tClass[$y] & "]", "", $wPos[1], $wPos[2], $wSize[1], $wSize[2]) ElseIf $tMode[$y] = "Class" And $tAction[$y] = "Move" Then WinMove("[CLASS:" & $tClass[$y] & "]", "", $wPos[1], $wPos[2]) ElseIf $tMode[$y] = "Class" And $tAction[$y] = "Resize" Then WinMove("[CLASS:" & $tClass[$y] & "]", "", $tmpPos[0], $tmpPos[1], $wSize[1], $wSize[2]) EndIf EndIf Next EndIf EndIf EndFunc ;==>_FindWindows Func _RunFromShortcut() ;~ ;johnmcloud - 2014 Local $tSI = DllStructCreate($tagSTARTUPINFO) DllCall('kernel32.dll', 'none', 'GetStartupInfoW', 'struct*', $tSI) If @error Then Return SetError(@error, @extended, 0) Local $vFlag = DllStructGetData($tSI, 'Flags') If BitAND($vFlag, 0x800) Then Local $sTitle = DllStructCreate('wchar ShortcutPath[261]', DllStructGetData($tSI, 'Title')) Local $sShortcutPath = DllStructGetData($sTitle, 'ShortcutPath') If $sShortcutPath Then Return FileGetShortcut($sShortcutPath) Else Return SetError(1, 0, 0) EndIf Else Return SetError(2, 0, 0) EndIf EndFunc ;==>_RunFromShortcut Func _QuickAdd() $NewWin = WinGetTitle("[ACTIVE]") $NewClass = _WinGetClass($NewWin) $NewPos = WinGetPos($NewWin) $xSize = $NewPos[2] $ySize = $NewPos[3] $xPos = $NewPos[0] $yPos = $NewPos[1] If $NewWin <> $GUITitle Then GUI_Settings() EndIf EndFunc ;==>_QuickAdd Func _ErrorTraps() If Not $IsDisabled = True And (WinExists($GUITitle & " Settings") Or WinExists($GUITitle & " Hotkey")) Then TraySetClick(0) GUICtrlSetState($Button1, $GUI_DISABLE) _HotKey_Disable() $IsDisabled = True EndIf If $IsDisabled And Not (WinExists($GUITitle & " Settings") Or WinExists($GUITitle & " Hotkey")) Then TraySetClick(9) GUICtrlSetState($Button1, $GUI_ENABLE) _HotKey_Enable() $IsDisabled = Not $IsDisabled EndIf EndFunc ;==>_ErrorTraps Func _About() _ExtMsgBoxSet($AbtConfig[0], $AbtConfig[1], $AbtConfig[2], $AbtConfig[3], $AbtConfig[4], $AbtConfig[5], $AbtConfig[6]) _ExtMsgBox(@ScriptFullPath, "Close", $GUITitle & " About", $GUITitle & @CRLF & "" & @CRLF & "Written By.................: ZoNE97" & @CRLF & "HotKey UDF By..............: Yashied" & @CRLF & "ExtMsgBox UDF By...........: Melba23" & @CRLF & "RunFromShortcut Function By: JohnMCloud", 0) _ExtMsgBoxSet(Default) EndFunc ;==>_About
  6. I have a need to download a report from salesforce in CSV format, on a every hour basis. I have used code found here to automate the login (minus the 2 part auth) and trigger the download. All of that works, but I would really like to hide the download window. I want to have everything happen in the background with no user intervention and nothing seen on the screen? Can this be done? Here is the code I have thus far. Also even though I think its set to open the second link in the first links parent window, it still want to open a second window?? #include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "hiddenuser" Local $sPass = "hiddenpass" Local $url1 = "https://my.salesforce.com/index.jsp" Local $url2 = "https://my.salesforce.com/00O3c000007JWJ8?csv=1" Local $oIE = _IECreate($url1, 1, 0) _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "email" And $oInput.name = "username" And $oInput.id = "username" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "pw" And $oInput.id = "password" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = "Log In" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE) Local $oIE = _IECreate($url2, 1, 0, 0) Sleep(1500) Send("{ENTER}") RunWait('taskkill /F /IM "iexplore.exe"')
  7. Ok, i get that COMPLETEDLY.. What I am needing is a trap, to do something JUST before pause takes effect. Just like the example I gave. OnAutoItExitRegister("OnClose") which does something just before closing the script.. If a function doesnt exist to do this, i'm out of luck as its too much work to build a custom context menu to pause/unpause just to do what i need.
  8. Actually trying to avoid that, my question is... Is there a way to trigger an action/function just before a script gets paused when its icon gets clicked.. For instance, say if a left or right click is detected, enable the button, then script gets paused. I know I can create a custom context menu and create function that simulates the pause.. Trying to avoid doing that. Didn't know if there was a built in functions like "onPause" that can be used instead of coding a whole menu and pause function. I am already using the "OnAutoItExitRegister("OnClose")" just curious if a similar function was available to catch a pause event.
  9. I'd like to keep the ability to pause the app.
  10. I looked but couldn't find this answer, but certain it has been asked before. Is there anyway a function can be triggered just before a script is "paused" when its icon is clicked. The default autoit gui will cause the script to pause if the trey icon is clicked right or left. I have a script that while running removes the close button from another application (to prevent accidental closure), when my script closes it restores the close button. But i'd like this to also happen should the script be paused. Any way to capture this, short of a whole context menu creation with a new pause function.. Thanks.
  11. I'm very new to using this UDF.. how do they differ? does json_objGet, create a 2d array of the values of a section? (because that is ultimately what the goal is for me.)
  12. Is parsing json data normally very slow? loading the file in... Local $file_json_raw = FileRead($ini_file_path & "\data.json") Local $file_json_data = Json_Decode($file_json_raw) takes about 6 seconds. Parsing the data into an array, While 1 ; list of all servers $server_id = json_get($file_json_data, '.servers[' & $a & '].id') If ($server_id == "") Then ExitLoop $server_name = json_get($file_json_data, '.servers[' & $a & '].name') $server_name_override = json_get($file_json_data, '.servers[' & $a & '].nameoverride') If ($server_name_override <> "") Then $server_name = $server_name_override WEnd takes about 30 seconds. The json file is about 900mb, the server section consist of about 2100 entries. Is there a quicker way to be handing the data?
  13. Worked. I thought I had tried that combination but didn't use local.. Would Dim have caused this? Also noticed I had placed the locals inside the while.. opps. mistook it for a function. Also the line "If @error Then ExitLoop ; pointless test" is crucial. Without it, it never ends the loop when its done parsing all the json data.
  14. I have a 2D array that I need to dynamically enlarge as it loops through some data.. The array is always going to have 2 columns, unknown number of rows.. Dim $servers[0] While 1 ; list of all servers Local $server_name, $server_name_override, $server_id If @error Then ExitLoop $server_id = json_get($file_json_data, '.servers[' & $a & '].id') $server_name = json_get($file_json_data, '.servers[' & $a & '].name') $server_name_override = json_get($file_json_data, '.servers[' & $a & '].nameoverride') If ($server_name_override <> "") Then $server_name = $server_name_override If ($server_name <> "") Then $Bound = UBound($servers) ReDim $servers[$Bound + 1] $servers[$Bound] = $server_name EndIf $a += 1 WEnd _ArrayDisplay($servers) 1D array works fine.. However this doesn't.. Dim $servers[0][0] While 1 ; list of all servers Local $server_name, $server_name_override, $server_id If @error Then ExitLoop $server_id = json_get($file_json_data, '.servers[' & $a & '].id') $server_name = json_get($file_json_data, '.servers[' & $a & '].name') $server_name_override = json_get($file_json_data, '.servers[' & $a & '].nameoverride') If ($server_name_override <> "") Then $server_name = $server_name_override If ($server_name <> "") Then $Bound = UBound($servers) ReDim $servers[$Bound + 1][0] $servers[$Bound][0] = $server_id $servers[$Bound][1] = $server_name EndIf $a += 1 WEnd _ArrayDisplay($servers)
  15. Switch $hWndFrom Case $hWndFrom Switch $iCode doing this did the trick.. Thank you.
×
×
  • Create New...