Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all 12506 articles
Browse latest View live

A Report topic only - Ignore mass spam

$
0
0

This is just a topic started to report that the mass spam that occurred yesterday, appears to be happening again today.

 

I am deliberately avoiding viewing those topics, and will just report this one with a note to clarify.

 

P.S. This means, that no-one else should report those topics. Apparently that just creates extra work for the Mods when clearing up these attacks.


On and Off switch on a simple script

$
0
0

If my script is a while loop, I've been trying to think of a way to enter and exit the loop at the press of a hotkey, in this case F1 and F2. I have tried 3-4 different methods that I thought of but some just press 2 indefinitely, others don't do anything at all. I know that you can make an Exit function that will completely exit the script, but I want to be able to turn the script back on with just the press of an hotkey and I think if you exit the script you can no longer do that so that's why I'm trying to find a way with Exitloop instead.

 

This is the last thing I tried (doesn't do anything)

#include <Misc.au3> Global $ON_OFF = 0 If _IsPressed("F1") Then $ON_OFF = 1 ; OFF If _IsPressed("F2") Then     Do         While 1             send("{2}")             If $ON_OFF = 1 Then ExitLoop         WEnd     Until $ON_OFF = 1         $ON_OFF = 0 EndIf

Thanks.

Little Math bug?

$
0
0

Hello everyone,

 

I have a little logical question about basic math with AutoIT. I did caunting a little bit and somehow my program giveing me back wrong number all the time. I start searching for the problem and run step by step till i found out this:

Local $Number = 19.2 If $Number > 0 Then Do   $Number = $Number - 1 Until $Number < 1 EndIf MsgBox(0, "", $Number)

This should give me back 0.2 but somehow it giveing as resoult 0.199999999999999 and it is not accurate. Any idea how it is posible? It is totaly unlogic for me. I do not know why it is not accurate, but if i write only this: 1.2 - 1 It give the right resoult (0.2). If it is some kinda bug, then can anyone help to me, how i can get the 0.2 out from $number? Cause i need only the decimal number. I use the integer part for other calculation.

 

$Number is a dynmic number, but in example i use a fix number cause it is easyer.

want to create GUI window for connecting network share path

$
0
0

Actually i'm looking for GUI window,which i can add share folder path names in the list and when ever i need i should connect to selected path by clicking connect button.

-I'm nt sure wht function should i add to connect.

 

I attached the screen shot which i created

 

Basically i'm looking to add all the network share path in the list,which i have access .so that i can connect easily.

 

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>
Main()
Func Main()
 
Local $iGUIWidth = 600, $iGUIHeight = 500
Local $OK,$Add,$Remove
Local $idListBox,$Add,$Connect
GUICreate("New GUI", $iGUIWidth, $iGUIHeight)
$idListBox = GUICtrlCreateList("List", 10, 10, 400, 200)
$Connect = GUICtrlCreateButton("Connect", 500, 10, 70, 25)
$Add = GUICtrlCreateButton("Add", 500, 40, 70, 25)
$OK=GUICtrlCreateButton("OK", 500, 100, 70, 25)
$Remove=GUICtrlCreateButton("Remove", 500, 200, 70, 25)
 
GUISetState(@SW_SHOW)
 
; Loop until the user exits.
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Add
            Main()
 
    EndSwitch
WEnd
EndFunc
 

 

post-38870-0-42308900-1425533848_thumb.p

[Solved] Is there a Function for Capitilizing the First Letter of Each Word in a String?

$
0
0

Hi

 

 

Before I go and write it myself,

Is there a function for capitilizing the first letter of each word in a string?

 

 

Thank you

Does AutoIT support the testing of .Net desktop apps?

$
0
0

Hi,

 

May I know if I can use AutoIT for testing .net based desktop applications. We are using some third part controls as well on the forms e.g. ComponentOne grid, combo box etc

Any suggestions?

 

Thanks

need help Recursion level has been exceeded - AutoIt will quit to prevent stack overflow

$
0
0

i am trying to run my program but it will crash after some minuets, i have search the forum and did not found any useful answer.

Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.:
sleep(1)
AutoIt         
sleep(500) $i=0 $g=2 change($i) func change($i) ; function changing       if $i >= $g Then       $i=0    MouseClick( "left",1,1)   Tooltip("1", 0, 0)       sleep(1)       send("{enter}")          sleep(1)          $i=$i+1           search($i)       EndIf       MouseClick("left" ,1,1)       sleep(1)       send("{down}")       sleep(1)       send("{enter}")       $i=$i+1       Tooltip($i, 0, 0)       search($i)    EndFunc    Func search($i)       sleep(1)       change($i)    EndFunc

Online Video steaming performance testing

$
0
0

Hi,

 

 

I got a requirement to test the video streaming performance. I had seen few forums on testing radio streaming. but not sure If I can use Autoit for performance testing of video streaming.

 

The video streaming streaming testing includes 2 types:

 

1. Live streaming testing

2. Saved Video streaming testing.

 

 

Please Help.

 

 

Regards,

Ashish


Changing a window's icon.

$
0
0

Hi,

 

I'd like to know if it's possible to change the icon of window other then my own created one.

 

For example - notepad's icon into some other icon.

 

Thanks in advance,

SK.

Inject Javascript in IE

$
0
0

I can inject Javascript by _IEHeadInsertEventScript() function. But the code only runs when "onclick" or "oncontextmenu" event is fired. Is there any way to inject javascript/JQuery to any page and run immediately and automatically with or without _IEHeadInsertEventScript() function.

_Ftp_FileGet non download file .zip

$
0
0

Good evening, I have a routine to download files from a website in FTP, which works fine with all files except files with the extension .ZIP.
Is there a particular reason that does not work with these types of files?
I enclose an excerpt of the routine, which again works with all other files

About pitesse help would be welcome.

Thank You
 

Spoiler

This program is long and complex. <3

$
0
0

Firstly... this program creates a slideshow on a secondary monitor, as well as a screensaver slideshow on the primary monitor.

It's a bit overwhelming if you just dive into it, but it's coded fairly easy and there are comments to explain what's going on.

 

I have 2 annoying errors.

 

Error 1: Lines 136 - 141

For some reason, it doesn't reset the txt file.

Minor annoyance, it just causes my logs to be very large at times so they open slow and are hard to scroll through.

  1.     Local $logFileSize = FileGetSize($logFile)
  2.     If $logFileSize > 5242880 Then ;5 megabytes
  3.         FileClose($logFile)
  4.         FileDelete($logFile)
  5.         $logFile = FileOpen(@WorkingDir & "\FSS Log.txt", 2) ;Erases log file due to extreme size
  6.     EndIf

Error 2: Lines 1039 - 1067

I'll explain what's going on in this...

System Idle alone isn't enough to tell the screensaver not to run. It doesn't account for videos (youtube, Netflix, etc)

So, to combat this... Several screenshots are taken of the screen, then compared to the current screen. This will tell the program if the screen is changing.

 

My error is that sometimes it will properly take screenshots and all is well, and sometimes it won't. The workaround is to check if the screenshots have been taken, and then skip the comparison if they have not.

My workaround still has issues sometimes, which I'm working on -.-

Memo: I notice the errors with the compiled script. I'm not sure if the same thing happens when running straight from the au3

AutoIt         
  1. Func CaptureScreen()
  2.     LogProgram("=CaptureScreen=")
  3.     $currentShot = 1
  4.     LogProgram("ssRows: " & $ssRows)
  5.     LogProgram("ssColumns: " & $ssColumns)
  6.     LogProgram("currentShot: " & $currentShot)
  7.     ;Vertical
  8.     For $currentYpos = 0 To $ssRows - 1 Step +1
  9.         LogProgram("currentYpos: " & $currentYpos)
  10.         ;Horizontal
  11.         For $currentXpos = 0 To $ssColumns - 1 Step +1
  12.             LogProgram("currentXpos: " & $currentXpos)
  13.             _ScreenCapture_Capture(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp", _
  14.                     ($incrementX * $currentXpos), _
  15.                     ($incrementY * $currentYpos), _
  16.                     ($incrementX * ($currentXpos + 1)), _
  17.                     $incrementY * ($currentYpos + 1), 0)
  18.             If FileExists(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp") = 1 Then
  19.                 LogProgram("screensaver " & $currentShot & ".bmp saved")
  20.             Else
  21.                 LogProgram("screensaver " & $currentShot & ".bmp save error")
  22.                 $captureError = 1
  23.             EndIf
  24.             $currentShot += 1
  25.             LogProgram("currentShot: " & $currentShot)
  26.             Sleep(50)
  27.         Next ;x
  28.         Sleep(50)
  29.     Next ;y

Whole Program:

AutoIt         
  1. #include <File.au3>
  2. #include <GetFileProperty.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <Misc.au3>
  5. #include <Timers.au3>
  6. #include <WindowsConstants.au3>
  7. #include <WinAPI.au3>
  8. #include <Array.au3>
  9. #include <ImageSearch.au3>
  10. #include <ScreenCapture.au3>
  11. #include <GDIPlus.au3>
  12. #include <Date.au3>
  13.  
  14. ;Find Log File information
  15. Local $logCheck = FileOpen(@WorkingDir & "\FSS.txt", 0)
  16. Local $line = FileReadLine($logCheck, 1)
  17. If StringSplit($line, " = ", 1)[2] = "On" Then
  18.     Global $keepLog = 1
  19.     Global $keepLog = 0
  20. FileClose($logCheck)
  21.  
  22. Global $logFile = FileOpen(@WorkingDir & "\FSS Log.txt", 2) ;Overwrites previous contents of file
  23. FileWrite($logFile, "Program Start" & @CRLF)
  24. FileWrite($logFile, "Time: " & _NowTime() & ", " & _NowDate() & @CRLF & @CRLF)
  25.  
  26. ;Only allow one instance of the program to run.
  27. If _Singleton("Fullscreen Slideshow", 1) = 0 Then
  28.     Exit
  29.  
  30. Global $pictureFolder ;Fixes declared warning
  31. ;Settings
  32. ;====================================
  33. ;Can be edited via external text file (FSS.txt)
  34. GetSettings()
  35. ;====================================
  36.  
  37. Global $desktop
  38. Global $ssTimerSet = 0
  39. Global $countedImages = 0
  40. Global $imageWasShown = 1
  41. Global $hidden = 0
  42. Global $VNChidden = 0
  43. Global $LoopCount = 1
  44. Global $taskbarActivationHide = 0
  45. Global $imageList = _FileListToArray($pictureFolder)
  46. Global $imageCount = $imageList[0]
  47. Global $imageShown[$imageCount + 1]
  48. Global $resetCount = 0
  49. Global $reset = 0
  50. Global $changeImage = 0
  51. Global Const $STM_SETIMAGE = 0x0172
  52. Global $currActiveWindow = WinGetHandle("")
  53. Global $smImageChangeBlack = 0
  54. Global $smImageWidth, $smImageHeight, $smpHeight, $smpWidth, $smCenterX, $smCenterY, _
  55.         $smPicName, $activeWindowPosition, $smRefreshImage, $smImageChangeTimer, $smSSMTimer, _
  56.         $startWithWindows, $closeWithScreensaver, $smPic, $smGdiPic, $position
  57. Global $pmImageWidth, $pmImageHeight, $pmpHeight, $pmpWidth, $pmCenterX, $pmCenterY, _
  58.         $pmPicName, $pmSSTimer, $pmPic, $pmGdiPic, $pmSSChangeTimer, $blinkTaskbar, $forceFSSOn
  59. Global $pmGUIhandle, $smGUIhandle, $captureError
  60. Global $changeQuadrant = ($ssChangePercent * 0.01) * ($ssRows * $ssColumns)
  61. Global $screenShotCount = $ssRows * $ssColumns
  62. Global $currentShot = 1
  63. Global $incrementX = @DesktopWidth / $ssColumns
  64. Global $incrementY = @DesktopHeight / $ssRows
  65. Global $currentXpos, $currentYpos, $result
  66. Global $pmChangeImage = 1
  67. Global $screenSaverIsOn = 0
  68. Global $winSize[2]
  69.  
  70. ;Prevents CloseProgram() function on startup
  71. RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow", "Close Program", "REG_SZ", 0)
  72.  
  73. ;Preliminary setup - Creates GUI, displays 1 image
  74. ;====================================
  75. GetImageForDisplaySM()
  76. GetImageForDisplayPM()
  77. CreateGUI()
  78. MoveGUIWindow()
  79. $smImageChangeTimer = TimerInit() ;Reset Image Change Timer
  80. $pmSSTimer = TimerInit() ;Reset Primary Screensaver Timer
  81. $pmSSChangeTimer = TimerInit() ;Reset Primary Screensaver Image Change Timer
  82. ShowImageSM()
  83. ShowImagePM()
  84. ;Main Program
  85. ;====================================
  86.     ;Debug
  87. ;~  ToolTip(CheckIfFSSshouldDisplay() & @CRLF & _
  88. ;~          "Active: " & $activeWindowPosition[0] & ", " & $activeWindowPosition[1] & @CRLF & _
  89. ;~          "Mouse: " & MouseGetPos(0) & ", " & MouseGetPos(1) & @CRLF & _
  90. ;~          "Desktop: " & $desktop & @CRLF & _
  91. ;~          "Monitor: " & @DesktopWidth & "x" & @DesktopHeight _
  92. ;~          , 100, 5)
  93.     ;======
  94. ;~  Local $temp = _Timer_GetIdleTime()
  95. ;~  ToolTip("SS: " & $screenSaverIsOn & @CRLF & "Idle: " & $temp, 100, 5)
  96.  
  97.     ;==========================
  98.  
  99.     ;These functions are set in settings (FSS.txt)
  100.     ShowTrayIcon() ;Should Tray Icon be shown?
  101.     StartWithWindows() ;Start program with Windows? (doesn't function)
  102.     ;================
  103.     AlwaysOnTop() ;Force slideshow to be on top of other windows
  104.     LoseFocus() ;Lose focus in case slideshow becomes the active window
  105.  
  106.     ;Should Fullscreen Slideshow be on or off
  107.     If CheckIfFSSshouldDisplay() = "Show" Then
  108.         ShowFSS()
  109.     Else
  110.         HideFSS()
  111.     EndIf
  112.     ScreensaverOperations()
  113.     ChangeImageSM()
  114.     DisplayTaskbar()
  115.     CloseProgram()
  116.  
  117.     ;Only every 5 times
  118.     LogProgram("Loop Count: " & $LoopCount)
  119.     FileWrite($logFile, "Loop Count: " & $LoopCount & @CRLF)
  120.     If $LoopCount > 5 Then
  121.         $LoopCount = 1
  122.         ;Pre-cautionary in case of changes in Monitor dimensions (if secondary monitor is unplugged)
  123.         MoveGUIWindow()
  124.         ;Check settings for changes
  125.         GetSettings()
  126.     Else
  127.         $LoopCount += 1
  128.     EndIf
  129.  
  130.     LogProgram(@CRLF & "=======================================================================")
  131.     Local $logFileSize = FileGetSize($logFile)
  132.     If $logFileSize > 5242880 Then ;5 megabytes
  133.         FileClose($logFile)
  134.         FileDelete($logFile)
  135.         $logFile = FileOpen(@WorkingDir & "\FSS Log.txt", 2) ;Erases log file due to extreme size
  136.     EndIf
  137.     ;Allow CPU to rest
  138.     Sleep(10)
  139.     LogProgram("Time: " & _NowTime() & ", " & _NowDate())
  140.  
  141. ;Beginning of Functions
  142. ;====================================
  143.  
  144. Func GetSettings()
  145.     LogProgram("=Get Settings=")
  146.     Global $settingsFile = FileOpen(@WorkingDir & "\FSS.txt", 0)
  147.     Local $lineNumber = 1
  148.     LogProgram("lineNumber: " & $lineNumber)
  149.     Local $line = FileReadLine($settingsFile, $lineNumber)
  150.     Local $lineSplit, $description, $value
  151.  
  152.     ;Move to the Fullscreen Slideshow Section
  153.     While $line <> "Fullscreen Slideshow"
  154.         $line = FileReadLine($settingsFile, $lineNumber)
  155.         LogProgram("lineNumber: " & $lineNumber)
  156.         LogProgram("line: " & $line)
  157.         $lineNumber += 1
  158.         Sleep(10)
  159.     WEnd
  160.  
  161.     ;Read until the next section
  162.     While $line <> "Fullscreen Screensaver"
  163.         $line = FileReadLine($settingsFile, $lineNumber)
  164.         If $line = "Fullscreen Screensaver" Then
  165.             ExitLoop
  166.         ElseIf $line = "" Then
  167.             ExitLoop
  168.         EndIf
  169.         ;Split line by Description and value
  170.         $lineSplit = StringSplit($line, " = ", 1)
  171.         $description = $lineSplit[1]
  172.         $value = $lineSplit[2]
  173.         If $description = "Picture Folder" Then
  174.             LogProgram("Picture Folder: " & $value)
  175.             $pictureFolder = $value
  176.         ElseIf $description = "Show Tray Icon" Then
  177.             LogProgram("Show Tray Icon: " & $value)
  178.             Global $showIcon = $value
  179.         ElseIf $description = "Secondary Monitor Width" Then
  180.             LogProgram("SM Width: " & $value)
  181.             Global $smWidth = $value
  182.         ElseIf $description = "Secondary Monitor Height" Then
  183.             LogProgram("SM Height: " & $value)
  184.             Global $smHeight = $value
  185.         ElseIf $description = "Monitor Position (Left, Right)" Then
  186.             LogProgram("SM Position: " & $value)
  187.             Global $smPosition = $value
  188.         ElseIf $description = "Activation Mode (Inactive, Timer)" Then
  189.             LogProgram("SM Activation Mode: " & $value)
  190.             Global $smActivationMode = $value
  191.         ElseIf $description = "Screensaver Mode Timer Seconds" Then
  192.             LogProgram("SMSSM Seconds: " & $value)
  193.             Global $smSSMsec = $value
  194.             $smSSMsec = $smSSMsec * 1000 ;Convert to milliseconds
  195.         ElseIf $description = "Change Method (Timer, Refresh)" Then
  196.             LogProgram("SM Change Method: " & $value)
  197.             Global $smChangeMethod = $value
  198.         ElseIf $description = "Image Change Time (In Seconds)" Then
  199.             LogProgram("SM Image Change Seconds: " & $value)
  200.             Global $smImageChangeSec = $value
  201.             $smImageChangeSec = $smImageChangeSec * 1000 ;Convert to milliseconds
  202.         ElseIf $description = "Image Order (Ordered, Random, Random No Repeat)" Then
  203.             LogProgram("SM Image Order: " & $value)
  204.             Global $smImageOrder = $value
  205.         ElseIf $description = "Taskbar Size (Default: 40)" Then
  206.             LogProgram("Taskbar Size: " & $value)
  207.             Global $taskbarSize = $value
  208.         ElseIf $description = "Start with Windows (Yes, No)" Then
  209.             LogProgram("Start with Windows: " & $value)
  210.             Global $startWithWindows = $value
  211.         EndIf
  212.         $lineNumber += 1
  213.     WEnd
  214.  
  215.     $lineNumber += 2 ;Move past 'Fullscreen Screensaver' line
  216.  
  217.     ;Read until the next section
  218.     While $line <> ";===================================="
  219.         $line = FileReadLine($settingsFile, $lineNumber)
  220.         LogProgram("lineNumber: " & $lineNumber)
  221.         LogProgram("line: " & $line)
  222.         If $line = ";====================================" Then
  223.             ExitLoop
  224.         EndIf
  225.         ;Split line by Description and value
  226.         $lineSplit = StringSplit($line, " = ", 1)
  227.         $description = $lineSplit[1]
  228.         $value = $lineSplit[2]
  229.         If $description = "Turn Screensaver On (Yes, No)" Then
  230.             LogProgram("Screensaver Turned On?: " & $value)
  231.             Global $screensaverActivated = $value
  232.         ElseIf $description = "Activation Time (In Seconds)" Then
  233.             LogProgram("Screensaver Activation Seconds: " & $value)
  234.             Global $pmSSActivationSec = $value
  235.             $pmSSActivationSec = $pmSSActivationSec * 1000 ;Convert to milliseconds
  236.         ElseIf $description = "Image Change Time (In Seconds)" Then
  237.             LogProgram("Screensaver Image Change Seconds: " & $value)
  238.             Global $pmSSChangeImageSec = $value
  239.             $pmSSChangeImageSec = $pmSSChangeImageSec * 1000 ;Convert to milliseconds
  240.         ElseIf $description = "Taskbar Blink Time (In Seconds)" Then
  241.             Global $taskbarBlinkSec = $value
  242.             $taskbarBlinkSec = $taskbarBlinkSec * 1000 ;Convert to milliseconds
  243.         ElseIf $description = "Rows (Horizontal Cuts)" Then
  244.             LogProgram("Rows: " & $value)
  245.             Global $ssRows = $value
  246.         ElseIf $description = "Columns (Vertical Cuts)" Then
  247.             LogProgram("Columns: " & $value)
  248.             Global $ssColumns = $value
  249.         ElseIf $description = "Percent" Then
  250.             LogProgram("Change %: " & $value)
  251.             Global $ssChangePercent = $value
  252.         ElseIf $description = "Check Count" Then
  253.             LogProgram("Check Count: " & $value)
  254.             Global $ssCheckCount = $value
  255.         EndIf
  256.         $lineNumber += 1
  257.         Sleep(50)
  258.     WEnd
  259.  
  260.     FileClose($settingsFile)
  261.     LogProgram("=End Get Settings=" & @CRLF)
  262. EndFunc   ;==>GetSettings
  263.  
  264. Func GetImageForDisplaySM()
  265.     LogProgram("=GetImageForDisplaySM=")
  266.     Local $newPic = 0
  267.     Local $smhHBmp ;for GDI (secondary)
  268.  
  269.     ;Check image folder for count change
  270.     LogProgram("=GetImageForDisplaySM calling=")
  271.     CheckForImageChanges()
  272.  
  273.     ;Throw away value to prevent error with GetDimensions
  274.     $pmPicName = Random(1, $imageCount, 1)
  275.  
  276.     ;Secondary Monitor
  277.     ;Images should go in order by file
  278.     LogProgram("Image Order:" & $smImageOrder)
  279.     If $smImageOrder = "Ordered" Then
  280.         ;Counted Images default is 0
  281.         $countedImages += 1
  282.         ;If the the counted images surpasses the number of images that are there, then reset the count
  283.         If $countedImages > $imageCount Then
  284.             $countedImages = 1
  285.         EndIf
  286.         $smPicName = $countedImages
  287.         ;Select a random image from the list
  288.     ElseIf $smImageOrder = "Random" Then
  289.         ;Select a random image from the list
  290.         $smPicName = Random(1, $imageCount, 1)
  291.         ;Select a random image, but do not show the same image twice
  292.     Else ;$smImageOrder = "Random No Repeat"
  293.         If $reset = 1 Then
  294.             $reset = 0
  295.             $resetCount = 0
  296.             For $x = 1 To $imageCount Step +1
  297.                 $imageShown[$x] = ""
  298.             Next
  299.         EndIf
  300.         While $newPic <> 1
  301.             $smPicName = Random(1, $imageCount, 1) ;Pick a random image
  302.             ;Check if image has been shown
  303.             For $y = 1 To $imageCount Step +1
  304.                 If $smPicName = $imageShown[$y] Then
  305.                     $imageWasShown = 1
  306.                 EndIf
  307.             Next ;y
  308.             If $imageWasShown = 1 Then
  309.                 $imageWasShown = 0
  310.                 $newPic = 0
  311.             Else
  312.                 $newPic = 1
  313.                 $resetCount += 1
  314.             EndIf
  315.             If $resetCount = $imageCount Then
  316.                 $reset = 1
  317.             EndIf
  318.         WEnd
  319.         ;Save image to shown image list
  320.         ;Store name in next available empty slot
  321.         For $x = 1 To $imageCount Step +1
  322.             If $imageShown[$x] = "" Then
  323.                 $imageShown[$x] = $smPicName ;Save image to shown image list
  324.                 ExitLoop ;End loop early
  325.             EndIf
  326.         Next
  327.     EndIf
  328.     LogProgram("(SM) Selected Image SM: " & $imageList[$smPicName])
  329.     LogProgram("(SM - Throw Away)Selected Image PM: " & $imageList[$pmPicName])
  330.  
  331.     ;Get Dimensions of image
  332.     LogProgram("=GetImageForDisplaySM calling=")
  333.     GetDimensions($imageList[$smPicName], $imageList[$pmPicName])
  334.     $smImageHeight = $smpHeight
  335.     $smImageWidth = $smpWidth
  336.  
  337.     ;Turn them all into integers. (Fixes glitch that caused some images to skip resizing)
  338.     $smImageHeight = Int($smImageHeight)
  339.     $smImageWidth = Int($smImageWidth)
  340.     $smHeight = Int($smHeight)
  341.     $smWidth = Int($smWidth)
  342.  
  343.     LogProgram("Pre-Adjust")
  344.     LogProgram("smImageHeight: " & $smImageHeight)
  345.     LogProgram("smImageWidth: " & $smImageWidth)
  346.     LogProgram("smHeight: " & $smHeight)
  347.     LogProgram("smWidth: " & $smWidth)
  348.  
  349.     ;Adjust the image size
  350.     ;-----------------------------------------------
  351.     ;If the image is bigger than the screen, adjust it
  352.     If $smImageWidth > $smWidth = 1 Or $smImageHeight > $smHeight = 1 Then
  353.         ;Get aspect ratio
  354.         $aspectRatioX = $smWidth / $smImageWidth ;Aspect ratio = monitor horizontal / image X
  355.         $aspectRatioY = $smHeight / $smImageHeight ;Aspect ratio = monitor vertical / image Y
  356.         LogProgram("aspectRatioX: " & $aspectRatioX)
  357.         LogProgram("aspectRatioY: " & $aspectRatioY)
  358.         If $aspectRatioX < $aspectRatioY Then
  359.             LogProgram("Image is Wide")
  360.             ;New Height
  361.             $smImageHeight = $smWidth * ($smImageHeight / $smImageWidth)
  362.             $smImageWidth = $smWidth
  363.             LogProgram("New smImageHeight: " & $smImageHeight)
  364.             LogProgram("New smImageWidth: " & $smImageWidth)
  365.         Else
  366.             LogProgram("Image is Tall")
  367.             ;New Width
  368.             $smImageWidth = $smHeight * ($smImageWidth / $smImageHeight)
  369.             $smImageHeight = $smHeight
  370.             LogProgram("New smImageHeight: " & $smImageHeight)
  371.             LogProgram("New smImageWidth: " & $smImageWidth)
  372.         EndIf
  373.     Else
  374.         LogProgram("Image is smaller/same size as monitor")
  375.     EndIf
  376.  
  377.     ;Calculate Center of monitor
  378.     ;(Monitor size - image size) / 2
  379.     $smCenterX = ($smWidth - $smImageWidth) / 2
  380.     $smCenterY = ($smHeight - $smImageHeight) / 2
  381.     LogProgram("smCenterX: " & $smCenterX)
  382.     LogProgram("smCenterY: " & $smCenterY)
  383.  
  384.     ;Resize the image
  385.     LogProgram("Resize Image SM")
  386.     $smhHBmp = $pictureFolder & "\" & $imageList[$smPicName]
  387.     $smGdiPic = _GDIPlus_BitmapCreateFromFile($smhHBmp) ;convert GDI bitmap to GDI+ bitmap
  388.     _WinAPI_DeleteObject($smhHBmp) ;release GDI bitmap resource because not needed anymore
  389.     $smPic = _GDIPlus_ImageResize($smGdiPic, $smImageWidth, $smImageHeight) ;resize image
  390.     LogProgram("=End GetImageForDisplaySM=" & @CRLF)
  391. EndFunc   ;==>GetImageForDisplaySM
  392.  
  393. Func GetImageForDisplayPM()
  394.     LogProgram("=GetImageForDisplayPM=")
  395.     Local $newPic = 0
  396.     Local $pmhHBmp ;for GDI (primary)
  397.  
  398.     ;Check image folder for count change
  399.     LogProgram("=GetImageForDisplayPM calling=")
  400.     CheckForImageChanges()
  401.  
  402.     If $pmChangeImage = 1 Then
  403.         $pmChangeImage = 0
  404.         $pmPicName = Random(1, $imageCount, 1) ;Select a random image from the list for primary
  405.     EndIf
  406.  
  407.     LogProgram("(PM - Throw Away) Selected Image SM: " & $imageList[$smPicName])
  408.     LogProgram("(PM)Selected Image PM: " & $imageList[$pmPicName])
  409.  
  410.     ;Get Dimensions of image
  411.     LogProgram("=GetImageForDisplayPM calling=")
  412.     GetDimensions($imageList[$smPicName], $imageList[$pmPicName])
  413.     $pmImageHeight = $pmpHeight
  414.     $pmImageWidth = $pmpWidth
  415.  
  416.     ;Turn them all into integers. (Fixes glitch that caused some images to skip resizing)
  417.     $pmImageHeight = Int($pmImageHeight)
  418.     $pmImageWidth = Int($pmImageWidth)
  419.  
  420.     LogProgram("Pre-Adjust")
  421.     LogProgram("pmImageHeight: " & $pmImageHeight)
  422.     LogProgram("pmImageWidth: " & $pmImageWidth)
  423.     LogProgram("pmHeight: " & @DesktopHeight)
  424.     LogProgram("pmWidth: " & @DesktopWidth)
  425.  
  426.     ;Adjust the image size
  427.     ;-----------------------------------------------
  428.     ;If the image is bigger than the screen, adjust it
  429.     If $pmImageWidth > @DesktopWidth Or $pmImageHeight > @DesktopHeight Then
  430.         ;Get aspect ratio
  431.         $aspectRatioX = @DesktopWidth / $pmImageWidth ;Aspect ratio = monitor horizontal / image X
  432.         $aspectRatioY = @DesktopHeight / $pmImageHeight ;Aspect ratio = monitor vertical / image Y
  433.         LogProgram("aspectRatioX: " & $aspectRatioX)
  434.         LogProgram("aspectRatioY: " & $aspectRatioY)
  435.         If $aspectRatioX < $aspectRatioY Then
  436.             LogProgram("Image is Wide")
  437.             ;New Height
  438.             $pmImageHeight = @DesktopWidth * ($pmImageHeight / $pmImageWidth)
  439.             $pmImageWidth = @DesktopWidth
  440.             LogProgram("New pmImageHeight: " & $pmImageHeight)
  441.             LogProgram("New pmImageWidth: " & $pmImageWidth)
  442.         Else
  443.             LogProgram("Image is Tall")
  444.             ;New Width
  445.             $pmImageWidth = @DesktopHeight * ($pmImageWidth / $pmImageHeight)
  446.             $pmImageHeight = @DesktopHeight
  447.             LogProgram("New pmImageHeight: " & $pmImageHeight)
  448.             LogProgram("New pmImageWidth: " & $pmImageWidth)
  449.         EndIf
  450.     Else
  451.         LogProgram("Image is smaller/same size as monitor")
  452.     EndIf
  453.  
  454.     ;Calculate Center of monitor
  455.     ;(Monitor size - image size) / 2
  456.     $pmCenterX = (@DesktopWidth - $pmImageWidth) / 2
  457.     $pmCenterY = (@DesktopHeight - $pmImageHeight) / 2
  458.     LogProgram("pmCenterX: " & $pmCenterX)
  459.     LogProgram("pmCenterY: " & $pmCenterY)
  460.  
  461.     ;Resize the image
  462.     LogProgram("Resize Image PM")
  463.     $pmhHBmp = $pictureFolder & "\" & $imageList[$pmPicName]
  464.     $pmGdiPic = _GDIPlus_BitmapCreateFromFile($pmhHBmp) ;convert GDI bitmap to GDI+ bitmap
  465.     _WinAPI_DeleteObject($pmhHBmp) ;release GDI bitmap resource because not needed anymore
  466.     $pmPic = _GDIPlus_ImageResize($pmGdiPic, $pmImageWidth, $pmImageHeight) ;resize image
  467.     LogProgram("=End GetImageForDisplayPM=" & @CRLF)
  468. EndFunc   ;==>GetImageForDisplayPM
  469.  
  470. Func GetDimensions($smPicName, $pmPicName)
  471.     LogProgram("=GetDimensions=")
  472.     Local $prop, $dArray, $fileSize, $imageDimensionsGDI
  473.  
  474.     ;Secondary Monitor
  475.     LogProgram("-Secondary Monitor-")
  476.     $path = $pictureFolder & "\" & $smPicName
  477.     LogProgram("Path: " & $path)
  478.     $fileSize = FileGetSize($path)
  479.     LogProgram("File Size: " & $fileSize)
  480.     LogProgram("Registry Size: " & RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Size"))
  481.     ;Save information to registry for faster access. Compare size of picture to verify changes to picture
  482.     If $fileSize <> RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Size") Then
  483.         LogProgram("File Sizes Do Not Match")
  484.         RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Size", "REG_SZ", $fileSize)
  485.         $imageDimensionsGDI = _GDIPlus_ImageLoadFromFile($path)
  486.         $smpWidth = _GDIPlus_ImageGetWidth($imageDimensionsGDI)
  487.         $smpHeight = _GDIPlus_ImageGetHeight($imageDimensionsGDI)
  488.         _GDIPlus_ImageDispose($imageDimensionsGDI)
  489. ;~      $prop = _GetFileProperty($path, "Dimensions")
  490. ;~      $dArray = StringSplit($prop, " x ")
  491. ;~      $smpWidth = Number(StringMid($dArray[1], 2))
  492. ;~      $smpHeight = Number($dArray[4])
  493.         RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Width", "REG_SZ", $smpWidth)
  494.         RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Height", "REG_SZ", $smpHeight)
  495.     Else
  496.         LogProgram("File Sizes Match")
  497.         $smpWidth = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Width")
  498.         $smpHeight = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Height")
  499.     EndIf
  500.     LogProgram("smpWidth: " & $smpWidth)
  501.     LogProgram("smpHeight: " & $smpHeight)
  502.  
  503.     ;Primary Monitor
  504.     LogProgram("-Primary Monitor-")
  505.     $path = $pictureFolder & "\" & $pmPicName
  506.     LogProgram("Path: " & $path)
  507.     $fileSize = FileGetSize($path)
  508.     LogProgram("File Size: " & $fileSize)
  509.     LogProgram("Registry Size: " & RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Size"))
  510.     ;Save information to registry for faster access. Compare size of picture to verify changes to picture
  511.     If $fileSize <> RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Size") Then
  512.         LogProgram("File Sizes Do Not Match")
  513.         RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Size", "REG_SZ", $fileSize)
  514.         $imageDimensionsGDI = _GDIPlus_ImageLoadFromFile($path)
  515.         $pmpWidth = _GDIPlus_ImageGetWidth($imageDimensionsGDI)
  516.         $pmpHeight = _GDIPlus_ImageGetHeight($imageDimensionsGDI)
  517.         _GDIPlus_ImageDispose($imageDimensionsGDI)
  518. ;~      $prop = _GetFileProperty($path, "Dimensions")
  519. ;~      $dArray = StringSplit($prop, " x ")
  520. ;~      $pmpWidth = Number(StringMid($dArray[1], 2))
  521. ;~      $pmpHeight = Number($dArray[4])
  522.         RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Width", "REG_SZ", $pmpWidth)
  523.         RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Height", "REG_SZ", $pmpHeight)
  524.     Else
  525.         LogProgram("File Sizes Match")
  526.         $pmpWidth = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Width")
  527.         $pmpHeight = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Height")
  528.     EndIf
  529.     LogProgram("pmpWidth: " & $pmpWidth)
  530.     LogProgram("pmpHeight: " & $pmpHeight)
  531.     LogProgram("=End GetDimensions=" & @CRLF)
  532. EndFunc   ;==>GetDimensions
  533.  
  534. Func CheckForImageChanges()
  535.     LogProgram("=CheckForImageChanges=")
  536.     Local $newCount = _FileListToArray($pictureFolder)
  537.     LogProgram("Old Count: " & $imageCount)
  538.     LogProgram("New Count: " & $newCount[0])
  539.     If $newCount[0] <> $imageCount Then
  540.         LogProgram("New Images Found")
  541.         $imageList = _FileListToArray($pictureFolder)
  542.         $imageCount = $imageList[0]
  543.         ReDim $imageShown[$imageCount + 1]
  544.     Else
  545.         LogProgram("No New Images")
  546.     EndIf
  547.     LogProgram("=End CheckForImageChanges=" & @CRLF)
  548. EndFunc   ;==>CheckForImageChanges
  549.  
  550. Func CreateGUI()
  551.     LogProgram("=CreateGUI=")
  552.     ;Hidden GUI for fixing if FSS becomes the active window
  553.     GUICreate("FSS", 0, 0, 0, 0)
  554.     LogProgram("FSS created")
  555.     ;Parent, for window border hide effect
  556.     $GUIHide = GUICreate("hide", 0, 0, 0, 0)
  557.     LogProgram("hide created")
  558.     ;Actual GUI to be used
  559.     ;Slideshow GUI
  560.     Global $smGUI = GUICreate("Fullscreen Slideshow", $smWidth, $smHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST), -1, $GUIHide) ;GUI is the size of the secondary screen
  561.     LogProgram("Fullscreen Slideshow created")
  562.     $smGUIhandle = WinGetHandle("Fullscreen Slideshow", "")
  563.     GUICtrlSetPos($smPic, $smCenterX, $smCenterY)
  564.     GUISetBkColor(0, $smGUIhandle)
  565.     LogProgram("smGUIhandle: " & $smGUIhandle)
  566.     LogProgram("Show smGUI")
  567.     GUISetState(@SW_SHOW, $smGUIhandle) ;Show SM GUI
  568.     ;Screensaver GUI
  569.     Global $pmGUI = GUICreate("Fullscreen Screensaver", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST), -1, $GUIHide) ;GUI is the size of the primary screen
  570.     LogProgram("Fullscreen Screensaver created")
  571.     $pmGUIhandle = WinGetHandle("Fullscreen Screensaver", "")
  572.     LogProgram("pmGUIhandle: " & $pmGUIhandle)
  573.     GUICtrlSetPos($pmPic, $pmCenterX, $pmCenterY)
  574.     GUISetBkColor(0, $pmGUIhandle)
  575.     LogProgram("Hide pmGUI")
  576.     GUISetState(@SW_HIDE, $pmGUIhandle) ;Hide PM GUI
  577.     LogProgram("=End CreateGUI=" & @CRLF)
  578. EndFunc   ;==>CreateGUI
  579.  
  580. Func MoveGUIWindow()
  581.     LogProgram("=MoveGUIWindow=")
  582.     LogProgram("SM Position: " & $smPosition)
  583.     ;Move GUI according to location of secondary monitor
  584.     ;$position = WinGetPos("Fullscreen Slideshow")
  585.     If $smPosition = "Left" Then
  586.         ;If $position[0] <> (-1 * $smWidth) Or $position[1] <> $smHeight Then
  587.         WinMove("Fullscreen Slideshow", "", (-1 * $smWidth), 0, $smWidth, $smHeight)
  588.         ;EndIf
  589.     Else ;Monitor on Right
  590.         ;If $position[0] <> @DesktopWidth Or $position[1] <> $smHeight Then
  591.         WinMove("Fullscreen Slideshow", "", @DesktopWidth, 0, $smWidth, $smHeight)
  592.         ;EndIf
  593.     EndIf
  594.     WinMove("Fullscreen Screensaver", "", 0, 0, @DesktopWidth, @DesktopHeight)
  595.     LogProgram("=End MoveGUIWindow=" & @CRLF)
  596. EndFunc   ;==>MoveGUIWindow
  597.  
  598. Func ShowImageSM()
  599.     LogProgram("=ShowImageSM=")
  600.     LogProgram("smImageChangeBlack: " & $smImageChangeBlack)
  601.     If $smImageChangeBlack = 0 Then
  602.         Local $smhGraphics = _GDIPlus_GraphicsCreateFromHWND($smGUI) ;create a graphics object from a window handle
  603.         _GDIPlus_GraphicsDrawImage($smhGraphics, $smPic, $smCenterX, $smCenterY) ;display scaled image
  604.         LogProgram("smhGraphics: " & $smhGraphics)
  605.         LogProgram("smPic: " & $smPic)
  606.         LogProgram("smCenterX: " & $smCenterX)
  607.         LogProgram("smCenterY: " & $smCenterY)
  608.     EndIf
  609.     LogProgram("=End ShowImageSM=" & @CRLF)
  610. EndFunc   ;==>ShowImageSM
  611.  
  612. Func ShowImagePM()
  613.     LogProgram("=ShowImagePM=")
  614.     Local $pmhGraphics = _GDIPlus_GraphicsCreateFromHWND($pmGUI) ;create a graphics object from a window handle
  615.     _GDIPlus_GraphicsDrawImage($pmhGraphics, $pmPic, $pmCenterX, $pmCenterY) ;display scaled image
  616.     LogProgram("pmhGraphics: " & $pmhGraphics)
  617.     LogProgram("pmPic: " & $pmPic)
  618.     LogProgram("pmCenterX: " & $pmCenterX)
  619.     LogProgram("pmCenterY: " & $pmCenterY)
  620.     LogProgram("=End ShowImagePM=" & @CRLF)
  621. EndFunc   ;==>ShowImagePM
  622.  
  623. Func ShowTrayIcon()
  624.     LogProgram("=ShowTrayIcon=")
  625.     If $showIcon = "No" Then
  626.         LogProgram("No")
  627.         AutoItSetOption("TrayIconHide", 1)
  628.     Else
  629.         LogProgram("Yes")
  630.         AutoItSetOption("TrayIconHide", 0)
  631.     EndIf
  632.     LogProgram("=End ShowTrayIcon=" & @CRLF)
  633. EndFunc   ;==>ShowTrayIcon
  634.  
  635. Func StartWithWindows()
  636.     LogProgram("=StartWithWindows=")
  637.     If $startWithWindows = "Yes" Then
  638.         LogProgram("Yes")
  639.         If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Fullscreen Slideshow") = "" Then
  640.             RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Fullscreen Slideshow", "REG_SZ", '"' & @ScriptFullPath & '"')
  641.         EndIf
  642.     Else
  643.         LogProgram("No")
  644.         If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Fullscreen Slideshow") <> "" Then
  645.             RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Fullscreen Slideshow")
  646.         EndIf
  647.     EndIf
  648.     LogProgram("=End StartWithWindows=" & @CRLF)
  649. EndFunc   ;==>StartWithWindows
  650.  
  651. Func AlwaysOnTop()
  652.     LogProgram("=AlwaysOnTop=")
  653.     ;Always keep FSS on top of other windows
  654.     WinSetOnTop("Fullscreen Slideshow", "", 0)
  655.     WinSetOnTop("Fullscreen Slideshow", "", 1)
  656.     WinSetOnTop("Fullscreen Screensaver", "", 0)
  657.     WinSetOnTop("Fullscreen Screensaver", "", 1)
  658.     LogProgram("=End AlwaysOnTop=" & @CRLF)
  659. EndFunc   ;==>AlwaysOnTop
  660.  
  661. Func LoseFocus()
  662.     LogProgram("=LoseFocus=")
  663.     ;If Fullscreen Slideshow becomes the active window, change to FSS
  664.     If WinActive("Fullscreen Slideshow", "") <> 0 Then
  665.         WinActivate("FSS", "")
  666.     EndIf
  667.     LogProgram("=End LoseFocus=" & @CRLF)
  668. EndFunc   ;==>LoseFocus
  669.  
  670. Func CheckIfFSSshouldDisplay()
  671.     LogProgram("=CheckIfFSSshouldDisplay=")
  672.     Local $decided = 0
  673.     Local $returnValue
  674.  
  675.     ;Is selected window the Desktop?
  676.     $winSize = WinGetClientSize("")
  677.     LogProgram("Window Size: " & $winSize)
  678.     If $winSize = "" Then ;Prevents non-accessible glitch
  679.         $desktop = 0
  680.     Else
  681.         If $winSize[0] = @DesktopWidth + $smWidth Then ;Desktop
  682.             $desktop = 1
  683.         Else
  684.             $desktop = 0
  685.         EndIf
  686.     EndIf
  687.     LogProgram("Desktop Selected?: " & $desktop)
  688.  
  689.     ;Where is the active window
  690.     $activeWindowPosition = WinGetPos("[ACTIVE]")
  691.     LogProgram("Active Window Position: " & $activeWindowPosition[0])
  692.     If $smPosition = "Left" Then
  693.         If $activeWindowPosition[0] < 0 Then ;If Active Window is in monitor on left
  694.             If $desktop = 0 Then
  695.                 $decided = 1
  696.                 $returnValue = "Hide"
  697.                 LogProgram("Active Window: On Left")
  698.                 LogProgram("Return: " & $returnValue)
  699.             Else
  700.                 $returnValue = "Show"
  701.                 LogProgram("Active Window: On Right")
  702.                 LogProgram("Return: " & $returnValue)
  703.             EndIf
  704.         EndIf
  705.     Else ;$smPosition = "Right"
  706.         If $activeWindowPosition[0] > (@DesktopWidth - 1) Or _ ;If Active Window is in monitor on right
  707.                 $activeWindowPosition[0] = (@DesktopWidth - 8) Then ;If Active Window is fullscreen
  708.             If $desktop = 0 Then
  709.                 $decided = 1
  710.                 $returnValue = "Hide"
  711.                 LogProgram("Active Window: On Right")
  712.                 LogProgram("Return: " & $returnValue)
  713.             Else
  714.                 $returnValue = "Show"
  715.                 LogProgram("Active Window: On Left")
  716.                 LogProgram("Return: " & $returnValue)
  717.             EndIf
  718.         EndIf
  719.     EndIf
  720.  
  721.     ;Only check if undecided
  722.     If $decided = 0 Then
  723.         ;Where is the mouse located
  724.         LogProgram("Mouse Position: " & MouseGetPos(0) & ", " & MouseGetPos(1))
  725.         If $smPosition = "Left" Then
  726.             If MouseGetPos(0) < 0 Then ;If mouse is in monitor on left
  727.                 $decided = 1
  728.                 $returnValue = "Hide"
  729.                 LogProgram("Mouse Position: On Left")
  730.                 LogProgram("Return: " & $returnValue)
  731.             EndIf
  732.         Else ;$smPosition = "Right"
  733.             If MouseGetPos(0) > @DesktopWidth Then ;If mouse is in monitor on right
  734.                 ;Bottom right corner of SM is activation spot
  735.                 If MouseGetPos(0) > (@DesktopWidth + $smWidth) - 3 Then
  736.                     If MouseGetPos(1) > $smHeight - 3 Then
  737.                         LogProgram("Mouse Activation Position")
  738.                         LogProgram("Return: " & $returnValue)
  739.                         $decided = 1
  740.                         $returnValue = "Show"
  741.                     Else
  742.                         $decided = 1
  743.                         $returnValue = "Hide"
  744.                         LogProgram("Mouse Position: On Right")
  745.                         LogProgram("Return: " & $returnValue)
  746.                     EndIf
  747.                 Else
  748.                     $decided = 1
  749.                     $returnValue = "Hide"
  750.                     LogProgram("Mouse Position: On Right")
  751.                     LogProgram("Return: " & $returnValue)
  752.                 EndIf
  753.             EndIf
  754.         EndIf
  755.         If $decided = 0 Then
  756.             ;Is there a special Window that is active?
  757.             $mPos = _WinAPI_GetMousePos()
  758.             $hwnd = _WinAPI_WindowFromPoint($mPos)
  759.             ;Is VNC active?
  760.             If WinGetTitle($hwnd) = "Cursor Hider" Then
  761.                 LogProgram("Cursor Hider Active")
  762.                 $decided = 1
  763.  
  764.                 ;Temporary while VNC is in main window
  765.                 ;$returnValue = "Hide"
  766.                 $returnValue = "Show"
  767.                 LogProgram("Return: " & $returnValue)
  768.             EndIf
  769.         EndIf
  770.     EndIf
  771.  
  772.     ;Is the Toggle set to hide?
  773.     ;Is Screensaver Off?
  774.     LogProgram("forceFSSOn: " & $forceFSSOn)
  775.     If $forceFSSOn = 0 Then
  776.         If RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow", "Mode") = "Hide" Then
  777.             ;Get new image ready while hidden
  778.             CleanupPrevImageSM()
  779.             GetImageForDisplaySM()
  780.             ShowImageSM()
  781.             ;Hide GUI
  782.             $decided = 1
  783.             $returnValue = "Hide"
  784.             LogProgram("Return: " & $returnValue)
  785.         EndIf
  786.     Else
  787.         $returnValue = "Show" ;Screensaver is active
  788.     EndIf
  789.  
  790.     ;If no issues, then show
  791.     If $decided = 0 Then
  792.         $returnValue = "Show"
  793.         LogProgram("Return: " & $returnValue)
  794.     EndIf
  795.     Return $returnValue
  796.     LogProgram("=End CheckIfFSSshouldDisplay=" & @CRLF)
  797. EndFunc   ;==>CheckIfFSSshouldDisplay
  798.  
  799. Func ShowFSS()
  800.     LogProgram("=ShowFSS=")
  801.     If $smActivationMode = "Inactive" Then ;Monitor not in use
  802.         WinSetState("Fullscreen Slideshow", "", @SW_SHOW)
  803.     Else ;$smActivationMode = "Timer" (Screensaver mode)
  804.         If TimerDiff($smSSMTimer) > ($smSSMsec) Then
  805.             WinSetState("Fullscreen Slideshow", "", @SW_SHOW)
  806.         EndIf
  807.     EndIf
  808.     ;Redraw GDI
  809.     LogProgram("=ShowFSS calling=")
  810.     ShowImageSM()
  811.     ShowImagePM()
  812.     LogProgram("=End ShowFSS=" & @CRLF)
  813. EndFunc   ;==>ShowFSS
  814.  
  815. Func HideFSS()
  816.     LogProgram("=HideFSS=")
  817.     WinSetState("Fullscreen Slideshow", "", @SW_HIDE)
  818.     $smRefreshImage = 1
  819.     $smSSMTimer = TimerInit() ;Reset Screensaver Timer
  820.     LogProgram("=End HideFSS=" & @CRLF)
  821. EndFunc   ;==>HideFSS
  822.  
  823. Func ChangeImageSM()
  824.     LogProgram("=ChangeImageSM=")
  825.     If RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow", "Mode") <> "Monitor Off" Then
  826.         $smImageChangeBlack = 0
  827.         If $smChangeMethod = "Refresh" Then
  828.             If $smRefreshImage = 1 Then
  829.                 $smRefreshImage = 0
  830.                 GetImageForDisplaySM()
  831.                 CleanupPrevImageSM()
  832.                 ShowImageSM()
  833.                 GUISetState(@SW_SHOW, $smGUIhandle)
  834.             EndIf
  835.         Else ;$smChangeMethod = "Timer"
  836.             If TimerDiff($smImageChangeTimer) > $smImageChangeSec Then
  837.                 $smImageChangeTimer = TimerInit() ;Reset Image Change Timer
  838.                 GetImageForDisplaySM()
  839.                 CleanupPrevImageSM()
  840.                 ShowImageSM()
  841.                 GUISetState(@SW_SHOW, $smGUIhandle)
  842.             EndIf
  843.         EndIf
  844.     Else ;Use Black Image
  845.         If $smImageChangeBlack = 0 Then
  846.             $smImageChangeBlack = 1
  847.             CleanupPrevImageSM()
  848.             GUISetState(@SW_SHOW, $smGUIhandle)
  849.         EndIf
  850.     EndIf
  851.     LogProgram("=End ChangeImageSM=" & @CRLF)
  852. EndFunc   ;==>ChangeImageSM
  853.  
  854. Func CleanupPrevImageSM()
  855.     LogProgram("=CleanupPrevImageSM=")
  856.     ;_GDIPlus_GraphicsDispose($smGdiPic)
  857.     ;_GDIPlus_BitmapDispose($smPic)
  858.     GUISetBkColor(0, $smGUIhandle) ;Draw black over previous image
  859.     LogProgram("=End CleanupPrevImageSM=" & @CRLF)
  860. EndFunc   ;==>CleanupPrevImageSM
  861.  
  862. Func CleanupPrevImagePM()
  863.     LogProgram("=CleanupPrevImagePM=")
  864.     ;_GDIPlus_GraphicsDispose($pmGdiPic)
  865.     ;_GDIPlus_BitmapDispose($pmPic)
  866.     GUISetBkColor(0, $pmGUIhandle) ;Draw black over previous image
  867.     LogProgram("=End CleanupPrevImagePM=" & @CRLF)
  868. EndFunc   ;==>CleanupPrevImagePM
  869.  
  870.  
  871. Func DisplayTaskbar()
  872.     LogProgram("=DisplayTaskbar=")
  873.     ;Hide/Show Taskbar
  874.     If MouseGetPos(0) > 0 And MouseGetPos(0) < @DesktopWidth Then ;If mouse is in main monitor
  875.         If MouseGetPos(1) > (@DesktopHeight - 2) Then ;If mouse is at bottom of screen
  876.             LogProgram("DisplayTaskbar calling")
  877.             ShowTaskBar()
  878.         ElseIf MouseGetPos(1) < (@DesktopHeight - $taskbarSize) Then ;If mouse leaves taskbar area
  879.             If RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow", "Blink Taskbar") = 0 Then HideTaskBar()
  880.         EndIf
  881.     Else
  882.         If RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow", "Blink Taskbar") = 0 Then HideTaskBar()
  883.     EndIf
  884.     LogProgram("=End DisplayTaskbar=" & @CRLF)
  885. EndFunc   ;==>DisplayTaskbar
  886.  
  887. Func HideTaskBar()
  888.     LogProgram("=HideTaskBar=")
  889.     ControlHide('', '', WinGetHandle("[CLASS:Shell_TrayWnd]"))
  890.     ControlHide('', '', WinGetHandle("[CLASS:Button]"))
  891.     LogProgram("=End HideTaskBar=" & @CRLF)
  892. EndFunc   ;==>HideTaskBar
  893.  
  894. Func ShowTaskBar()
  895.     LogProgram("=ShowTaskbar=")
  896.     ControlShow('', '', WinGetHandle("[CLASS:Shell_TrayWnd]"))
  897.     ControlShow('', '', WinGetHandle("[CLASS:Button]"))
  898.     LogProgram("=End ShowTaskbar=" & @CRLF)
  899. EndFunc   ;==>ShowTaskBar
  900.  
  901. Func CloseProgram()
  902.     LogProgram("=CloseProgram=")
  903.     If RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow", "Close Program") = 1 Then
  904.         RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow", "Close Program", "REG_SZ", 0)
  905.         LogProgram("CloseProgram calling")
  906.         CleanupPrevImageSM()
  907.         LogProgram("CloseProgram calling")
  908.         CleanupPrevImagePM()
  909.         LogProgram("GDI Dispose")
  910.         _GDIPlus_GraphicsDispose($smGdiPic)
  911.         _GDIPlus_BitmapDispose($smPic)
  912.         _GDIPlus_GraphicsDispose($pmGdiPic)
  913.         _GDIPlus_BitmapDispose($pmPic)
  914.         LogProgram("GDI Shutdown")
  915.         _GDIPlus_Shutdown()
  916.         LogProgram("GUI Delete")
  917.         GUIDelete($smGUI)
  918.         GUIDelete($pmGUI)
  919.         LogProgram("Program Closed" & @CRLF)
  920.         FileClose($logFile)
  921.         Exit
  922.     EndIf
  923.     LogProgram("Program Not Closed" & @CRLF)
  924.     LogProgram("=End CloseProgram=")
  925. EndFunc   ;==>CloseProgram
  926.  
  927. Func ScreensaverOperations()
  928.     LogProgram("=ScreensaverOperations=")
  929.     Local $checkCount, $stop
  930.     LogProgram("Screensaver Activated? " & $screensaverActivated)
  931.     LogProgram("Is Screensaver On? " & $screenSaverIsOn)
  932.     If $screensaverActivated = "Yes" Then
  933.         ;Should Screensaver be activated?
  934.         Local $idleTime = _Timer_GetIdleTime()
  935.         LogProgram("Idle Time Seconds: " & ($idleTime / 1000))
  936.         LogProgram("Activation Seconds: " & $pmSSActivationSec)
  937.         If $idleTime > $pmSSActivationSec Then
  938.             If $screenSaverIsOn = 0 Then
  939.                 LogProgram("=ScreensaverOperations calling=")
  940.                 CaptureScreen() ;Take a screenshot of entire screen (divided into sections)
  941.                 Sleep(1000) ;Give time for screenshots to load into hard drive
  942.                 $checkCount = 1
  943.                 $stop = 0
  944.                 While $stop = 0
  945.                     LogProgram("stop: " & $stop)
  946.                     LogProgram("=ScreensaverOperations calling=")
  947.                     $result = CompareScreen() ;Compare screenshots with current desktop
  948.                     LogProgram("result: " & $result)
  949.                     If $result = "Not Changed" Then
  950.                         $checkCount += 1
  951.                         If $checkCount > $ssCheckCount Then ;Check x times before giving up
  952.                             $stop = 1
  953.                         Else
  954.                             Sleep(2000) ;Wait 2 seconds before checking again
  955.                         EndIf
  956.                     Else
  957.                         $stop = 1
  958.                     EndIf
  959.                     Sleep(50)
  960.                 WEnd
  961.  
  962.                 ;Activate screensaver
  963.                 If $result = "Not Changed" Then
  964.                     LogProgram("=ScreensaverOperations calling=")
  965.                     ShowScreensaver()
  966.                 Else ;If the screen has changed
  967.                     LogProgram("=ScreensaverOperations calling=")
  968.                     If CheckForDesktop() = 1 Then ;If Desktop is taking over screen, turn on screensaver anyway
  969.                         ShowScreensaver()
  970.                     Else ;The screen is changing, but the desktop is not active
  971.                         ;Reset Timer (to prevent constant checking)
  972.                         $screensaverActivated = 0
  973.                         _WinAPI_ShowCursor("False")
  974.                         MouseMove(MouseGetPos(0), MouseGetPos(1) - 1, 0) ;Move mouse up 1 pixel
  975.                         MouseMove(MouseGetPos(0), MouseGetPos(1) + 1, 0) ;Move mouse down 1 pixel
  976.                         _WinAPI_ShowCursor("True")
  977.                     EndIf
  978.                 EndIf
  979.                 ;Erase screenshots
  980.                 LogProgram("=ScreensaverOperations calling=")
  981.                 ScreensaverCleanUp()
  982.             EndIf ;If $screenSaverIsOn = 0
  983.         Else ;If $idleTime < $pmSSActivationSec
  984.             LogProgram("=ScreensaverOperations calling=")
  985.             HideScreensaver()
  986.         EndIf
  987.         ;===================
  988.         ;Change Image?
  989.         If $screenSaverIsOn = 1 Then
  990.             If TimerDiff($pmSSChangeTimer) > $pmSSChangeImageSec Then
  991.                 $pmChangeImage = 1
  992.                 LogProgram("=ScreensaverOperations calling=")
  993.                 GetImageForDisplayPM()
  994.                 CleanupPrevImagePM()
  995.                 ShowImagePM()
  996.                 GUISetState(@SW_SHOW, $pmGUIhandle)
  997.                 $pmSSChangeTimer = TimerInit() ;Reset Image Change Timer
  998.             EndIf
  999.         EndIf
  1000.         ;===================
  1001.         ;If $screensaverActivated = "No" do nothing
  1002.     EndIf
  1003.     LogProgram("=End ScreensaverOperations=" & @CRLF)
  1004. EndFunc   ;==>ScreensaverOperations
  1005.  
  1006. Func ShowScreensaver()
  1007.     LogProgram("=ShowScreensaver=")
  1008.     WinSetState("Fullscreen Screensaver", "", @SW_SHOW)
  1009.     _WinAPI_ShowCursor("False")
  1010.     $screenSaverIsOn = 1
  1011.     $forceFSSOn = 1
  1012.     $blinkTaskbar = 1
  1013.     LogProgram("=End ShowScreensaver=" & @CRLF)
  1014. EndFunc   ;==>ShowScreensaver
  1015.  
  1016. Func HideScreensaver()
  1017.     LogProgram("=HideScreensaver=")
  1018.     WinSetState("Fullscreen Screensaver", "", @SW_HIDE)
  1019.     _WinAPI_ShowCursor("True")
  1020.     $screenSaverIsOn = 0
  1021.     $forceFSSOn = 0
  1022.     If $blinkTaskbar = 1 Then
  1023.         $blinkTaskbar = 0
  1024.         ControlShow('', '', WinGetHandle("[CLASS:Shell_TrayWnd]"))
  1025.         ControlShow('', '', WinGetHandle("[CLASS:Button]"))
  1026.         Sleep($taskbarBlinkSec)
  1027.         ControlHide('', '', WinGetHandle("[CLASS:Shell_TrayWnd]"))
  1028.         ControlHide('', '', WinGetHandle("[CLASS:Button]"))
  1029.     EndIf
  1030.     LogProgram("=End HideScreensaver=" & @CRLF)
  1031. EndFunc   ;==>HideScreensaver
  1032.  
  1033. Func CaptureScreen()
  1034.     LogProgram("=CaptureScreen=")
  1035.     $currentShot = 1
  1036.     LogProgram("ssRows: " & $ssRows)
  1037.     LogProgram("ssColumns: " & $ssColumns)
  1038.     LogProgram("currentShot: " & $currentShot)
  1039.     ;Vertical
  1040.     For $currentYpos = 0 To $ssRows - 1 Step +1
  1041.         LogProgram("currentYpos: " & $currentYpos)
  1042.         ;Horizontal
  1043.         For $currentXpos = 0 To $ssColumns - 1 Step +1
  1044.             LogProgram("currentXpos: " & $currentXpos)
  1045.             _ScreenCapture_Capture(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp", _
  1046.                     ($incrementX * $currentXpos), _
  1047.                     ($incrementY * $currentYpos), _
  1048.                     ($incrementX * ($currentXpos + 1)), _
  1049.                     $incrementY * ($currentYpos + 1), 0)
  1050.             If FileExists(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp") = 1 Then
  1051.                 LogProgram("screensaver " & $currentShot & ".bmp saved")
  1052.             Else
  1053.                 LogProgram("screensaver " & $currentShot & ".bmp save error")
  1054.                 $captureError = 1
  1055.             EndIf
  1056.             $currentShot += 1
  1057.             LogProgram("currentShot: " & $currentShot)
  1058.             Sleep(50)
  1059.         Next ;x
  1060.         Sleep(50)
  1061.     Next ;y
  1062.  
  1063.     ;If there is a capture error, retry once
  1064.     If $captureError = 1 Then
  1065.         LogProgram("Attempt 2")
  1066.         $captureError = 0
  1067.         $currentShot = 1
  1068.         LogProgram("ssRows: " & $ssRows)
  1069.         LogProgram("ssColumns: " & $ssColumns)
  1070.         LogProgram("currentShot: " & $currentShot)
  1071.         ;Vertical
  1072.         For $currentYpos = 0 To $ssRows - 1 Step +1
  1073.             LogProgram("currentYpos: " & $currentYpos)
  1074.             ;Horizontal
  1075.             For $currentXpos = 0 To $ssColumns - 1 Step +1
  1076.                 LogProgram("currentXpos: " & $currentXpos)
  1077.                 _ScreenCapture_Capture(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp", _
  1078.                         ($incrementX * $currentXpos), _
  1079.                         ($incrementY * $currentYpos), _
  1080.                         ($incrementX * ($currentXpos + 1)), _
  1081.                         $incrementY * ($currentYpos + 1), 0)
  1082.                 If FileExists(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp") = 1 Then
  1083.                     LogProgram("screensaver " & $currentShot & ".bmp saved")
  1084.                 Else
  1085.                     LogProgram("screensaver " & $currentShot & ".bmp save error")
  1086.                     $captureError = 1
  1087.                 EndIf
  1088.                 $currentShot += 1
  1089.                 LogProgram("currentShot: " & $currentShot)
  1090.                 Sleep(50)
  1091.             Next ;x
  1092.             Sleep(50)
  1093.         Next ;y
  1094.     EndIf
  1095.     LogProgram("=End CaptureScreen=" & @CRLF)
  1096. EndFunc   ;==>CaptureScreen
  1097.  
  1098. Func CompareScreen()
  1099.     LogProgram("=CompareScreen=")
  1100.     Local $x, $y
  1101.     Local $resistance = $changeQuadrant
  1102.     If $captureError = 0 Then
  1103.         LogProgram("changeQuadrant: " & $resistance)
  1104.         $currentShot = 1
  1105.         LogProgram("currentShot: " & $currentShot)
  1106.         For $currentYpos = 0 To $ssRows - 1 Step +1
  1107.             LogProgram("currentYpos: " & $currentYpos)
  1108.             For $currentXpos = 0 To $ssColumns - 1 Step +1
  1109.                 LogProgram("currentXpos: " & $currentXpos)
  1110.                 If _ImageSearchArea(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp", 1, ($incrementX * $currentXpos), ($incrementY * $currentYpos), ($incrementX * ($currentXpos + 1)), ($incrementY * ($currentYpos + 1)), $x, $y, 0) = 1 Then
  1111.                     LogProgram("Image Did Not Change")
  1112.                 Else
  1113.                     LogProgram("Image Changed")
  1114.                     $resistance -= 1
  1115.                 EndIf
  1116.                 $currentShot += 1
  1117.                 LogProgram("currentShot: " & $currentShot)
  1118.                 Sleep(50)
  1119.             Next
  1120.             Sleep(50)
  1121.         Next
  1122.         LogProgram("resistance: " & $resistance)
  1123.         If $resistance = 0 Then
  1124.             LogProgram("Return: Changed")
  1125.             Return "Changed"
  1126.         ElseIf $resistance < 0 Then
  1127.             LogProgram("Return: Changed")
  1128.             Return "Changed"
  1129.         Else
  1130.             LogProgram("Return: Not Changed")
  1131.             Return "Not Changed"
  1132.         EndIf
  1133.     Else
  1134.         $captureError = 0
  1135.         LogProgram("Return: Skip")
  1136.         Return "Skip"
  1137.     EndIf
  1138.     LogProgram("=End CompareScreen=" & @CRLF)
  1139. EndFunc   ;==>CompareScreen
  1140.  
  1141. Func CheckForDesktop()
  1142.     LogProgram("=CheckForDesktop=")
  1143.     Local $x, $y, $desktopFound
  1144.     $desktopFound = _ImageSearchArea("*Trans0xFF00FF" & @WorkingDir & "\Screensaver\Desktop.bmp", 1, 0, 0, @DesktopWidth, @DesktopHeight, $x, $y, 0)
  1145.     LogProgram("desktopFound: " & $desktopFound)
  1146.     Return $desktopFound
  1147.     LogProgram("=End CheckForDesktop=" & @CRLF)
  1148. EndFunc   ;==>CheckForDesktop
  1149.  
  1150. Func ScreensaverCleanUp()
  1151.     LogProgram("=ScreensaverCleanup=")
  1152.     Local $file
  1153.     Local $picCount = $ssRows * $ssColumns
  1154.     For $file = 1 To $picCount Step +1
  1155.         FileDelete(@WorkingDir & "\Screensaver\screensaver " & $file & ".bmp")
  1156.         If FileExists(@WorkingDir & "\Screensaver\screensaver " & $file & ".bmp") = 1 Then
  1157.             LogProgram("screensaver " & $file & ".bmp delete error")
  1158.         Else
  1159.             LogProgram("screensaver " & $file & ".bmp deleted")
  1160.         EndIf
  1161.     Next
  1162.     LogProgram("=End ScreensaverCleanup=" & @CRLF)
  1163. EndFunc   ;==>ScreensaverCleanUp
  1164.  
  1165. Func LogProgram($sentence)
  1166.     If $keepLog = 1 Then
  1167.         ConsoleWrite($sentence & @CRLF)
  1168.         FileWrite($logFile, $sentence & @CRLF)
  1169.     EndIf
  1170. EndFunc   ;==>LogProgram

Attached Files

  • Attached File  FSS.txt   800bytes   4 downloads

"Secure" random characters

$
0
0

Hello,

There are many example of "random data generator" or similar with this language on the forum but i don't have found nothing that use a method can be considerated secure or cryptographic strong. We have the function in one of the UDF like:

_Crypt_GenRandom

CryptAcquireContext ( internal of Crypt.au3 )

CryptReleaseContext ( internal of Crypt.au3 )

/dev/urandom ( autoit Random? )

But none example in this way. I'd like to start from an array of characters like this:

Local $aKSet[52] = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', _         'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

Because i what to choice what char include in the random final string ( like only upper, or from A to K or remove some char etc )

I hope someone can provide an example using this input, thanks

 

Some reference:

http://en.wikipedia.org/wiki/Random_password_generator#Stronger_methods

http://en.wikipedia.org/wiki/CryptGenRandom

[solved] Desktop background slideshow pause and next image?

$
0
0

I do a tool for Desktop background slideshow pause and next image, but i catch some problems.

1. For pause slideshow, i use change regedit key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\0d7dbae2-4294-402a-ba8e-26777e8488cd\309dce9b-bef4-4119-9921-a851fb12f0f4\ACSettingIndex
change value to 0 or 1
How can I make it effective?, refesh regedit?, with dllcall?
2. For next background, i use right click on desktop, and choose next desktop background.
Can i use dllcall or something similar for next desktop background?

Thank :)

Listview Item / Subitem Background Colour

$
0
0

Looking for a way to set the colour of listview item and subitem colours.

 

looking through the forum it seems to be a terribly convoluted task.

 

I found this topic which looked promising, but it simply does not change the colour of any items or sub items at all.

 

Is that code very old or something?

 

EDIT:

 

Just to clarify, it is not enough for me to set the colour of the whole index item (row) I need to set sub item colours individually, and after the list view has been populated.


Directory of the included Include

$
0
0

Hello,

 

I wasn't able to find an answer for my question in this forum so I post it here:

 

Problem:

I use the ImageSearch.au3 as include in my own Include-Directory.

I have more scripts in different folders in different folder-depths that include this file.

The problem is, that die ImageSearch.au3 uses an DLL placed in the include-Directory.

 

short:

ImageSearch.au3 -> D:\incl\ImageSearch.au3

test1.au3 -> D:\Dir1\subdir1\test1.au3

test2.au3 -> D:\Dir2\test2.au3

 

How do I get the search work?

The only idea I had is to get the Directory of the include "ImageSearch.au3".

How do I get this?

Is there another way to solve this problem?

 

Thank U

Bye

Trying to make a loading screen

$
0
0

Hello all, I'm trying to make a loading screen using gdi and a udf made by UEZ, the script should open a window and display the specified gif (download here: https://d13yacurqjgara.cloudfront.net/users/90627/screenshots/1096260/loading.gif )

 

But instead it throws an error when accessing the array of frames, so I'm missing something here.

 

script:

AutoIt         
#include <gdiplus.au3> #include <_GDIPlus_GIFAnim.au3> #include <WindowsConstants.au3> #include <memory.au3> _loadinggui() while 1     sleep(10) WEnd Func _loadinggui()     Global Const $hGIFAnim3 = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\Images\loading.gif") Global Const $iW3 = _GDIPlus_ImageGetWidth($hGIFAnim3), $iH3 = _GDIPlus_ImageGetHeight($hGIFAnim3) Global $loading = GUICreate("Secure Instant Messenger (SIM) - Login", $iW3, $iH3), $iPosX = 10, $iPosY = 285 GUISetBkColor(0x000000, $loading) Global $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($loading) Global $iAnim3CurrentFrame = 0 Global Const $iAnim3DimCount = _GDIPlus_GIFAnimGetFrameDimensionsCount($hGIFAnim3) Global Const $tAnim3GUID = _GDIPlus_GIFAnimGetFrameDimensionsList($hGIFAnim3, $iAnim3DimCount) Global Const $iAnim3FrameCount = _GDIPlus_GIFAnimGetFrameCount($hGIFAnim3, $tAnim3GUID) Global Const $aAnim3FrameDelays = _GDIPlus_GIFAnimGetFrameDelays($hGIFAnim3, $iAnim3FrameCount) GUIRegisterMsg($WM_TIMER, "PlayAnimPreview2") DllCall("user32.dll", "int", "SetTimer", "hwnd", $loading, "int", 0, "int", 100, "int", 0) GUISetState()     EndFunc func PlayAnimPreview2()     Local $hBmp2 = _GDIPlus_BitmapCreateFromScan0($iW3, $iH3)     Local $hGfx2 = _GDIPlus_ImageGetGraphicsContext($hBmp2)     _GDIPlus_GraphicsDrawImageRect($hGraphic2, $hBmp2, 0, 0, $iW3, $iH3)         _GDIPlus_GraphicsDispose($hGfx2)     _GDIPlus_BitmapDispose($hBmp2)     Anim3($hGfx2) EndFunc Func Anim3(ByRef $hGfx)     Local $iDelayAnim3 = $aAnim3FrameDelays[$iAnim3CurrentFrame]     Local Static $iTimerCurrentFrame = TimerInit()     _GDIPlus_GIFAnimSelectActiveFrame($hGIFAnim3, $tAnim3GUID, $iAnim3CurrentFrame)     _GDIPlus_GraphicsDrawImageRect($hGfx, $hGIFAnim3, 20, 5, $iW3, $iH3)     If TimerDiff($iTimerCurrentFrame) > $iDelayAnim3 Then         $iAnim3CurrentFrame += 1         $iTimerCurrentFrame = TimerInit()     EndIf     If $iAnim3CurrentFrame > UBound($aAnim3FrameDelays) - 1 Then $iAnim3CurrentFrame = 0 EndFunc   ;==>Anim3

I feel like I'm missing something incredibly simple...

Input only HEX (mac format)

$
0
0

Hi, i need input a MAC number. Hex number

 

Example: 10-AB-FF-40-50-60

 

I need use the StringRegExpReplace.

 

From another trhead:

 

***

StringRegExpReplace($s_Text, "(-|^)([^\-]{" & $iMinChars & "})([^\-])", "\1\2-\3")

****

Module to edit existing array

$
0
0

I have an existing 2D array which I want a module so the user can edit the values or remove a row. Is there function that will allow me to do that.If not whats my best bet. 

 

Cannot uninstall kb

$
0
0

Been stuck for several hours trying to uninstall a kb.  From the command prompt, it works fine:

 

cd c:\

then,

C:\Windows\System32\wusa.exe /uninstall /kb:xxxxxxx /quiet /norestart

 

Wusa does its thing, finds the kb, after the wusa process is done restart the pc, and its gone.

 

For the autoit scripts Ive tried:

  1. ShellExecute("wusa.exe" & '/uninstall /kb:xxxxxxx /quiet /norestart')

No luck ^

  1. $wusa = @WindowsDir & "\System32\wusa.exe"
  2. Run($wusa & " /uninstall /kb:xxxxxxx /quiet /norestart")

No luck ^

  1. $cmd = "wusa.exe /uninstall /kb:xxxxxxx /quiet /norestart"
  2. RunWait(@ComSpec & " /c " & $cmd, @WindowsDir & "\System32", @SW_HIDE)

No luck ^

  1. ;FileCopy(@ScriptDir & '\kbuninstall.cmd', "C:\Temp")
  2. ;Sleep(5000)
  3. ;RunWait('C:\Temp\kbuninstall.cmd', '', @sw_hide)

^ Even tried running both .cmd and .bat files locally

  1. $x = RunWait(@ComSpec & " /c C:\Windows\System32\wusa.exe /uninstall /kb:xxxxxxx /quiet /norestart", @SystemDir, @SW_HIDE)
  2. MsgBox(0, "", $x)

No luck on this either, although it does bomb out with error code -2147418113 which appears to be a "catastrophic failure," (lol) similar to this link:  https://social.technet.microsoft.com/Forums/systemcenter/en-US/a218e294-b0e6-4b26-80a9-4eef72476fff/wusaexe-uninstall-and-sccm?forum=configmgrsum

 

Searched up and down, never seen anything like it.  

 

Viewing all 12506 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>