Jump to content

Sticky

Active Members
  • Posts

    64
  • Joined

  • Last visited

About Sticky

  • Birthday 09/19/1984

Recent Profile Visitors

429 profile views

Sticky's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. Seeker, Sorry for the delayed response! This needs to run locally on each affected user's machine. The way I implemented this was by compiling the code and placing the exe on a shared folder on the network available to the user's that need to run this. I then used a group policy to run this on start up - worked like a charm!
  2. Thank you very much for your help, much appreciated!
  3. That did the trick! Is this the only way to have local files open in IE?
  4. When running the following code, line 3 causes $script_browser to no longer be an Internet Explorer object, which you can see in the error messages caused by lines 5 & 7. #include <IE.au3> $script_browser = _IECreate() _IENavigate($script_browser, @ScriptDir& "\step1.html") Sleep(2500) _IENavigate($script_browser, @ScriptDir& "\step2.html") Sleep(2500) _IENavigate($script_browser, @ScriptDir& "\step3.html") --> IE.au3 V2.4-0 Error from function _IENavigate, $_IEStatus_InvalidObjectType --> IE.au3 V2.4-0 Error from function _IENavigate, $_IEStatus_InvalidObjectType
  5. Looks like you're referencing old documentation as I found this: http://msdn.microsoft.com/en-us/library/windows/desktop/dd562467(v=VS.85).aspx Looks like you need to use this instead of AutoSize, and pass False instead of 'false' $obj.stretchToFit = False
  6. Your suspicions were correct: RunWait('cmd.exe /c REG SAVE "' & $s_Val & ' "' & @ScriptDir & '\"' &$TimeStamp & '\Evidence\' & @ComputerName &'_"' & $i+1 & '.dat /y"') Should be: RunWait('cmd.exe /c REG SAVE ' & $s_Val & ' "' & @ScriptDir & '\' &$TimeStamp & '\Evidence\' & @ComputerName &'_' & $i+1 & '.dat" /y') I just outputted the string of what you were submitting to the RunWait function, this eases the visualization of your command to help fix it.
  7. So selenium is clicking confirm and you're just needing AutoIt to continuously poll for a new javascript pop up and perform an action on it such as clicking Ok?
  8. I am attempting to do the exact same thing! My end goal is to be able to upload files through the autoit webserver, and then print them at home. A free, universal webbased remote print to home to any printer solution. You're about to make my brain explode with autoit webserver ideas.
  9. Thank you for the help Melba! I noticed one way to get around the detection of text running out of the richedit control. If you write a few lines, then return to the top, write a few more, and continue repeating returning to the top, it will never detect text running off the screen. Is there maybe a way to detect when a vertical scroll bar shows up in the control?
  10. Maybe if I go character by character, get the height of each one based on its font size, and keep track of the heighest character on each line... sounds like it might cause some massive calculations every single time a change happens... Any other thoughts or solutions?
  11. Thanks for your input James! Correct me if I'm wrong, but if you change the size or color with an edit control, then the entire control receives the formatting, and not just selected text, right? The choir director will be using different font colors and sizes to indicate which section in the choir sings what, on the same "slide".
  12. I am attempting to have any text that is not completely visible at the bottom of a richedit control with no scrollbars to jump to the next available richedit control. I believe I've figured out every proof of concept to get this going, except for being able to calculate when text has hit the bottom of the current control. I have found _GuiCtrlRichEdit_SetSpaceUnit("pt"), but am unable to see a way to use this to my benefit. I've also found _GUICtrlRichEdit_GetLineCount($hWnd) but since I do not know the height of each individual line, it doesn't do what I need. Keep in mind that there can be multiple fonts and multiple sizes. Maybe there's a way to hook into how the richedit control generates a vertical scrollbar only when needed? You might be asking why I'm wanting to do this; I'm creating an easy method of displaying lyrics for a choir. The director copy pastes into one richedit control, and it automatically creates as many richedits as needed to hold all the text with no scrollbars in order to be later shown "slide" by "slide". The slides will just be a zoomed version [_GUICtrlRichEdit_SetZoom($hRichEdit, 250)] of each richedit control in order.
  13. I have a script that constantly writes to a text file on a server share which needs to remain unlocked. Every once in a while, it would end up locked so I needed a way to unlock it. I used the following line to kick off a scheduled task on the server hosting the share and file: Run(@ComSpec & " /c "&'C:\Windows\System32\Schtasks.exe /Run /s SERVERNAME /tn "TASKNAME"', @SystemDir, @SW_HIDE) The below script is compiled and has its own scheduled task assigned with the filename being passed as a parameter. Tested and working on XP SP3 and Win Server 2003. #include <Constants.au3> #include <Array.au3> If $CmdLine[0] > 0 Then _closeLockedFile($CmdLine[1]) Else MsgBox(0, "Error", "Must pass the file name to check as a parameter") EndIf Func _closeLockedFile($file) Local $foo = Run(@ComSpec & " /c net file", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line, $output = "" While 1 $line = StdoutRead($foo) If @error Then ExitLoop $output &= $line Wend $foundFiles = StringSplit($output, @CRLF) ;find beginning of file list While 1 If StringInStr($foundFiles[1], "---------------------------------------------------------------------") Then _ArrayDelete($foundFiles, 1) ExitLoop Else _ArrayDelete($foundFiles, 1) EndIf WEnd For $i = 1 To $foundFiles[0] If $i > UBound($foundFiles) - 1 Then _ArrayDelete($foundFiles, $i - 1) ExitLoop EndIf ;remove blank lines If $foundFiles[$i] = "" Then _ArrayDelete($foundFiles, $i) $i -= 1 EndIf Next $foundFiles[0] = UBound($foundFiles) - 1 $suckersKilled = 0 For $f = 1 To $foundFiles[0] $fileId = StringMid($foundFiles[$f], 1, 11) $filePath = StringMid($foundFiles[$f], 12, 40) $fileLocks = StringMid($foundFiles[$f], 73, 5) $fileId = StringStripWS(StringStripWS($fileId, 1), 2) $filePath = StringStripWS(StringStripWS($filePath, 1), 2) $fileLocks = Int(StringStripWS(StringStripWS($fileLocks, 1), 2)) If StringRight($filePath, Stringlen($file)) = $file And $fileLocks > 0 Then ;kill the sucker! Run(@ComSpec & " /c net file "&$fileId&" /close", @SystemDir, @SW_HIDE) $suckersKilled += 1 EndIf Next Return $suckersKilled EndFunc
  14. After using the above script, several of my Outlook users have complained of slow-down or a complete freeze of Outlook while this does its maintenance. To get around this, I've used _Timer_GetIdleTime() to hook into Window's idle time. By doing this, the sync issues and conflicts are only removed when the user hasn't touched their mouse or keyboard for over 1 minute. If they do, this stops in its tracks and waits for a minute of idle time before picking up where it left off. If the computer is idle all day long, it will check for new sync issues and conflicts at a maximum of every 10 minutes. #NoTrayIcon #include <Array.au3> #include <Timers.au3> Global $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") Global $lastRemoval = TimerInit() Global $removeReady = False Global $receiptSetting = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail","Receipt Response") Global $firstStart = True Global $idleTime const $olFolderConflicts=19 const $olFolderSyncIssues=20 const $olFolderDeletedItems=3 const $PR_SEARCH_KEY = "http://schemas.microsoft.com/mapi/proptag/0x300B0102" AdlibRegister("_idleControl", 500) While 1 Sleep(100) If $removeReady = True Then If TimerDiff($lastRemoval) > (10 * 60 * 1000) Or $firstStart = True Then ;more than 10 minutes $firstStart = False _clearSyncsConfs() EndIf EndIf WEnd Func _clearSyncsConfs() Dim $searchKeys[1] $searchKeys[0] = 0 $oOApp = ObjCreate("Outlook.Application") If $oOApp = 0 Then Exit;looks like Outlook isn't installed $myNamespace = $oOApp.GetNamespace("MAPI") ;store the current receipt response setting $receiptSetting = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail","Receipt Response") ;don't respond to any possible receipts, as these are duplicates we're deleting RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail", "Receipt Response", "REG_DWORD", 1) ;empty conflicts $myFolder = $myNamespace.GetDefaultFolder($olFolderConflicts) $myItems = $myFolder.Items().Count For $i = $myItems To 1 Step -1 ;get the items search key which remains unique and does not change _ArrayAdd($searchKeys, $myFolder.Items($i).PropertyAccessor.GetProperty($PR_SEARCH_KEY)) ;mark as read first to prevent read receipt confusion massacre $myFolder.Items($i).UnRead = False ;delete $myFolder.Items($i).Delete() If $removeReady = False Then _stopDeletion() _idleWait() EndIf Next ;empty sync issues $myFolder = $myNamespace.GetDefaultFolder($olFolderSyncIssues) $myItems = $myFolder.Items().Count For $i = $myItems To 1 Step -1 _ArrayAdd($searchKeys, $myFolder.Items($i).PropertyAccessor.GetProperty($PR_SEARCH_KEY)) $myFolder.Items($i).UnRead = False $myFolder.Items($i).Delete() If $removeReady = False Then _stopDeletion() _idleWait() EndIf Next ;permanently delete sync issues and conflicts $myFolder = $myNamespace.GetDefaultFolder($olFolderDeletedItems) $myItems = $myFolder.Items().Count For $i = $myItems To 1 Step -1 $found = _ArraySearch($searchKeys, $myFolder.Items($i).PropertyAccessor.GetProperty($PR_SEARCH_KEY), 1) If $found > 0 Then $myFolder.Items($i).Delete() If $removeReady = False Then _stopDeletion() _idleWait() EndIf Next ;restore the receipt response setting _stopDeletion() $lastRemoval = TimerInit() Return EndFunc Func _idleControl() $idleTime = _Timer_GetIdleTime() If $idleTime > (60 * 1000) Then ; 1 minute $removeReady = True Else $removeReady = False EndIf EndFunc Func _idleWait() While $removeReady = False Sleep(1000) WEnd $receiptSetting = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail","Receipt Response") EndFunc Func _stopDeletion() Sleep(3500) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail", "Receipt Response", "REG_DWORD", $receiptSetting) EndFunc Func ErrFunc() AdlibUnRegister("_idleControl") _stopDeletion() $lastRemoval = TimerInit() $removeReady = False $error = "We intercepted an Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext MsgBox(0, "Error Removing Items from Outlook", $error) Local $err = $oMyError.number If $err = 0 Then $err = -1 $g_eventerror = $err ; to check for after this function returns Exit Endfunc
  15. For all the BES Admins out there who's users require Cached Exchange Mode in Outlook 2007, and enable it even though it's not officially supported (like myself) and realize the consequences are bloated sync issues and conflicts, I've developed this script (kudos to Juvigy): #NoTrayIcon #include <Array.au3> const $olFolderConflicts=19 const $olFolderSyncIssues=20 const $olFolderDeletedItems=3 const $PR_SEARCH_KEY = "http://schemas.microsoft.com/mapi/proptag/0x300B0102" Dim $searchKeys[1] $oOApp = ObjCreate("Outlook.Application") $myNamespace = $oOApp.GetNamespace("MAPI") ;store the current receipt response setting $receiptSetting = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail","Receipt Response") ;don't respond to any possible receipts, as these are duplicates we're deleting RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail", "Receipt Response", "REG_DWORD", 1) ;empty conflicts $myFolder = $myNamespace.GetDefaultFolder($olFolderConflicts) $myItems = $myFolder.Items().Count For $i = $myItems To 1 Step -1 ;get the item's search key which remains unique and does not change across exchange mailboxes unlike the EntryID _ArrayAdd($searchKeys, $myFolder.Items($i).PropertyAccessor.GetProperty($PR_SEARCH_KEY)) ;mark as read first to prevent read receipt confusion massacre $myFolder.Items($i).UnRead = False ;delete the mail item $myFolder.Items($i).Delete() Next ;empty sync issues $myFolder = $myNamespace.GetDefaultFolder($olFolderSyncIssues) $myItems = $myFolder.Items().Count For $i = $myItems To 1 Step -1 _ArrayAdd($searchKeys, $myFolder.Items($i).PropertyAccessor.GetProperty($PR_SEARCH_KEY)) $myFolder.Items($i).UnRead = False $myFolder.Items($i).Delete() Next ;permanently delete sync issues and conflicts $myFolder = $myNamespace.GetDefaultFolder($olFolderDeletedItems) $myItems = $myFolder.Items().Count For $i = $myItems To 1 Step -1 ;see if the searchkey is in the deleted sync or conflict mail items $found = _ArraySearch($searchKeys, $myFolder.Items($i).PropertyAccessor.GetProperty($PR_SEARCH_KEY), 1) If $found > 0 Then $myFolder.Items($i).Delete() Next ;restore the receipt response setting RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Options\Mail", "Receipt Response", "REG_DWORD", $receiptSetting)
×
×
  • Create New...