Jump to content
BBs19

MetroGUI UDF v5.1 - Windows 10 style buttons, toggles, radios, menu etc.

Recommended Posts

is there any way to make GetCurrentGUI() not to flick gui ? 

(it's difficult to give you an example code right now) 

when i use the _metro_enablebutton it instantly redraws gui (i tried sw lock with no success) 

the only solution that i found is to give directly the gui parameter to enablebutton func

 

edit -> am not sure (because i must remove the previous "fix", but if i change the (from getcurrentgui func)

Local $idCtrlDummy = GUICtrlCreateLabel("", 0, 0, 0, 0)

to 

Local $idCtrlDummy = GUICtrlCreateLabel("", 0, 0, 1, 1)

 

it seems ok

Edited by radienergos

Share this post


Link to post
Share on other sites

Any help is appreciated?

 

-#############################################################################################

-#### Au3Stripper Found   5 Error(s)!!!!    This means your script could have problems running properly.  ####
-#############################################################################################
- 2.50 Iteration 1 Strip and Rename Functions result: Output  5321 lines and stripped 7253 lines
- 5.38 Iteration 2 Strip Variables result: Output  3013 lines and stripped 2308 lines
- 6.00 Iteration 3 Strip Variables result: Output  2926 lines and stripped 87 lines
- 6.63 Iteration 4 Strip Variables result: Output  2923 lines and stripped 3 lines
- 7.25 Iteration 5 Strip and Rename Variables result: Output  2923 lines and stripped 0 lines
+> Source    22107 lines 1083820 Characters.
+> Stripped  9651 Func/Var lines and  9210 comment lines, Total 998836 Characters.
+> Saved     85% lines 92% Characters.
+> 0 Au3Stripper v15.920.938.0 finished created:C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3
+>11:12:39 Au3Stripper ended.rc:0
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3
"C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3"(1028,26) : warning: $5g: possibly used before declaration.
For $5f = 0 To UBound($5g)
~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3"(1067,54) : error: INTERNAL_INTERCEPT_FRAMEDRAW(): undefined function.
GUIRegisterMsg(0x0083, "INTERNAL_INTERCEPT_FRAMEDRAW")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3 - 1 error(s), 1 warning(s)
!>11:12:39 AU3Check ended. Press F4 to jump to next error.rc:2
+>11:12:39 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 9.544

 

Share this post


Link to post
Share on other sites
On 4.1.2017 at 11:37 AM, radienergos said:

is there any way to make GetCurrentGUI() not to flick gui ? 

(it's difficult to give you an example code right now) 

when i use the _metro_enablebutton it instantly redraws gui (i tried sw lock with no success) 

the only solution that i found is to give directly the gui parameter to enablebutton func

 

edit -> am not sure (because i must remove the previous "fix", but if i change the (from getcurrentgui func)

Local $idCtrlDummy = GUICtrlCreateLabel("", 0, 0, 0, 0)

to 

Local $idCtrlDummy = GUICtrlCreateLabel("", 0, 0, 1, 1)

 

it seems ok

Hmm not sure what you mean. I can't see any flickering. Can you post an example?

 

On 17.1.2017 at 11:16 AM, RyukShini said:

Any help is appreciated?

 

-#############################################################################################

-#### Au3Stripper Found   5 Error(s)!!!!    This means your script could have problems running properly.  ####
-#############################################################################################
- 2.50 Iteration 1 Strip and Rename Functions result: Output  5321 lines and stripped 7253 lines
- 5.38 Iteration 2 Strip Variables result: Output  3013 lines and stripped 2308 lines
- 6.00 Iteration 3 Strip Variables result: Output  2926 lines and stripped 87 lines
- 6.63 Iteration 4 Strip Variables result: Output  2923 lines and stripped 3 lines
- 7.25 Iteration 5 Strip and Rename Variables result: Output  2923 lines and stripped 0 lines
+> Source    22107 lines 1083820 Characters.
+> Stripped  9651 Func/Var lines and  9210 comment lines, Total 998836 Characters.
+> Saved     85% lines 92% Characters.
+> 0 Au3Stripper v15.920.938.0 finished created:C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3
+>11:12:39 Au3Stripper ended.rc:0
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3
"C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3"(1028,26) : warning: $5g: possibly used before declaration.
For $5f = 0 To UBound($5g)
~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3"(1067,54) : error: INTERNAL_INTERCEPT_FRAMEDRAW(): undefined function.
GUIRegisterMsg(0x0083, "INTERNAL_INTERCEPT_FRAMEDRAW")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Gr3ndel\AppData\Local\Temp\7zOC6E49E77\Example_stripped.au3 - 1 error(s), 1 warning(s)
!>11:12:39 AU3Check ended. Press F4 to jump to next error.rc:2
+>11:12:39 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 9.544

 

Try installing the newest version of Autoit and the Scite Editor. The Au3Stripper seems outdated. I have (16.306.1237.0) running and it doesn't return any errors.

Share this post


Link to post
Share on other sites

Hi everyone,

I have a problem displaying this GUI on different systems. On my laptop (windows 7) it looks like this:

:good.PNG

However, when displayed on my friends laptop (windows 10) the controls are not properly aligned and don't even fit on the screen. Here's a screenshot:

bad.PNG

 

I have no idea how to fix this. Anybody have some advice?

My script:

ExcelTools_V1.au3

Share this post


Link to post
Share on other sites

Are you sure, you used exactly the same script?

 

When I look at this for example:

$b = 66 + $t        ; Begin pos Toggles
$b1 = 105 + $t      ; Begin pos Inputs

...

Global $Checkbox2 = _Metro_CreateToggle("To UPPERCASE", $l + 40, $b, 180, 30)
    Global $Hotbut2 = _GUICtrlCreateInput("", $l + 320, $b1, 30, 25, $SS_CENTER)

I don't understand why the controls should have the same Top position under Win7..

Share this post


Link to post
Share on other sites

Yes, it's exactly the same script. That little bit of code is just to make it easier for me to slide all controls down with a certain amount of pixels.

Does it display well at your side?

 

Edited by ludocus

Share this post


Link to post
Share on other sites

@ludocus

I use Win 10 and it looked as bad as your Win 10 screenshot. But.. Do I miss something?  In the example that I looked at., the Inputfield next to the toggle UPPERCASE should have the same (or nearly the same) Top position. But $b1 is always 39 bigger then $b, what the variables for your Top position is. So the positions I can see with Win 10 seem for me exactly that, what your code says... I don't understand it.

Edited by nobbitry

Share this post


Link to post
Share on other sites

@nobbitry

You are absolutely right and I now this is confusing. I had to enter different heights because they were displayed at different heights if I entered the same height for both (still following me? :p).

@KarlosTHG

Well if that's the problem, then that solution won't work for me as this program will be installed on a lot of different systems. It should just work for everyone without having to change any settings in windows. So I might just add an If statement that will change the GUI when it is displayed on windows 10 versus windows 7.

Thank you both!

Share this post


Link to post
Share on other sites
6 hours ago, ludocus said:

@nobbitry

You are absolutely right and I now this is confusing. I had to enter different heights because they were displayed at different heights if I entered the same height for both (still following me? :p).

@KarlosTHG

Well if that's the problem, then that solution won't work for me as this program will be installed on a lot of different systems. It should just work for everyone without having to change any settings in windows. So I might just add an If statement that will change the GUI when it is displayed on windows 10 versus windows 7.

Thank you both!

Did you tried changing:

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
;#AutoIt3Wrapper_Res_HiDpi=Y

to:

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=Y


maybe that can help

Share this post


Link to post
Share on other sites

I managed to fix it by adding custom positions when operating system is windows 10.

Btw, when I try to compile the script, I get a message saying "Incorrect Wrapper Directive '#Autoit3Wrapper_REs_HiDpi=Y' "

Am I compiling it wrong or something?

 

Share this post


Link to post
Share on other sites
On 31.1.2017 at 9:56 AM, ludocus said:

Hi everyone,

I have a problem displaying this GUI on different systems. On my laptop (windows 7) it looks like this:

:good.PNG

However, when displayed on my friends laptop (windows 10) the controls are not properly aligned and don't even fit on the screen. Here's a screenshot:

bad.PNG

 

I have no idea how to fix this. Anybody have some advice?

My script:

ExcelTools_V1.au3

 

Hi,

This UDF is already optimized for high resolution screens, meaning all buttons, toggles and even the main GUI will be created with a dynamic size so that everything looks very sharp no matter that DPI size the user is using. Unfortunately many modern programs lack this feature which causes them to look very small, blurred or the controls are completely out of size and position on 4k Displays which mostly require higher DPI sizes. That why I had to add this feature.

If you use _Metro_EnableHighDPIScaling() and #AutoIt3Wrapper_Res_HiDpi=Y, then this feature will be enabled and you will require to calculate the pos+size of all controls that are created using Autoits GUICtrlCreate... functions. All functions like _Metro_CreateButton already do this by default, so no need to change anything for them.

It is actually pretty easy but might take some time if you have many controls. There is already a global variable declared in the UDF, that can be used to calculate the position/size. You can use ( x * $gDPI) for every position and size parameter.

Global $titlelabel = GUICtrlCreateLabel ("ExcelTools", 80*$gdpi, 6*$gdpi, 200*$gdpi, 28*$gdpi)

While creating the GUI, you should disable _Metro_EnableHighDPIScaling() and #AutoIt3Wrapper_Res_HiDpi=Y and create your GUI like you would usually do. After that you can enable them again and add *$gDPI to all the Autoit GUICtrlCreate... functions. This way your program will look the same on all computers when it is compiled.

 

On 2.2.2017 at 5:12 PM, ludocus said:

I managed to fix it by adding custom positions when operating system is windows 10.

Btw, when I try to compile the script, I get a message saying "Incorrect Wrapper Directive '#Autoit3Wrapper_REs_HiDpi=Y' "

Am I compiling it wrong or something?

 

Check if you have the latest Autoit and Scite Tools version installed. It should work like provided in the example GUI.

Edited by BBs19

Share this post


Link to post
Share on other sites

@BBs19: I've read up on the DPI issues and tried a few tests ... but uncertainties creep back in.  Since you seem well-versed in DPI, can you clarify you last statement:

Quote

While creating the GUI, you should disable _Metro_EnableHighDPIScaling() and #AutoIt3Wrapper_Res_HiDpi=Y and create your GUI like you would usually do.

If I apply the multipliers to the X, Y positions of all my GUI elements, which way should the Wrapper setting be? ... Y or N?

And if I decide not to use multipliers (and just let the OS scale everything in the blurry manner), what is the proper Wrapper setting?

I hope you don't mind responding to this.  From the AutoIt standpoint, it appears that your MetroGUI UDF is leading the way in this "frontier" of technology.

 

 

Share this post


Link to post
Share on other sites
5 hours ago, qwert said:

@BBs19: I've read up on the DPI issues and tried a few tests ... but uncertainties creep back in.  Since you seem well-versed in DPI, can you clarify you last statement:

If I apply the multipliers to the X, Y positions of all my GUI elements, which way should the Wrapper setting be? ... Y or N?

And if I decide not to use multipliers (and just let the OS scale everything in the blurry manner), what is the proper Wrapper setting?

I hope you don't mind responding to this.  From the AutoIt standpoint, it appears that your MetroGUI UDF is leading the way in this "frontier" of technology.

If you apply the multipliers, then you have to set #AutoIt3Wrapper_Res_HiDpi to "Y" and add _Metro_EnableHighDPIScaling()  to the script so that Windows doesn't try to rescale the program as you would be doing that yourself.

If you want to let Windows scale everything, then you just remove _Metro_EnableHighDPIScaling()  and #AutoIt3Wrapper_Res_HiDpi=Y (or put it to N) from your code.

Share this post


Link to post
Share on other sites
On 5/8/2014 at 11:04 AM, BBs19 said:

Love what you did with this Metro UDF! I'm seeing a lot of ways to improve my code.

Are you able to include GUICtrlSetResizing for labels?

I would be interested too in working some transparency levels into the interface as well on Windows 7 machines and above?

Also, this tvshowcountdown app is amazing!  Would love to learn from the code behind this, if possible? If not, it's okay. Figure I'd ask anyway.

Thank you for all of your work!

(and U2 UEZ!)

Edited by coffeeturtle

Share this post


Link to post
Share on other sites
13 hours ago, coffeeturtle said:

Love what you did with this Metro UDF! I'm seeing a lot of ways to improve my code.

Are you able to include GUICtrlSetResizing for labels?

I would be interested too in working some transparency levels into the interface as well on Windows 7 machines and above?

Also, this tvshowcountdown app is amazing!  Would love to learn from the code behind this, if possible? If not, it's okay. Figure I'd ask anyway.

Thank you for all of your work!

(and U2 UEZ!)

Thanks :)

What do you mean with include GUICtrlSetResizing for labels?

TV-Show-Manager is opensource, so you can check out the code any time. But I would suggest you wait, as the code was written very bad back then, I am rewriting the program from scratch to look similar to Netflix. Here is a small demo: Picture It will take some time to finish, as I am not really motivated to work on it at the moment :) 

 

Share this post


Link to post
Share on other sites
13 hours ago, BBs19 said:

Thanks :)

What do you mean with include GUICtrlSetResizing for labels?

TV-Show-Manager is opensource, so you can check out the code any time. But I would suggest you wait, as the code was written very bad back then, I am rewriting the program from scratch to look similar to Netflix. Here is a small demo: Picture It will take some time to finish, as I am not really motivated to work on it at the moment :) 
 

Your Netflix-like program looks great so far! Nicely done!

And badly written or not, TVShowManager is not only good looking, not only have key functions that could easily be implemented in other functions, but it itself is very useful for keeping track of shows! (So many shows barely last one season so I like to keep track of some to see if they survive the cut and if I should binge watch or not). And I huge TV Show list is like having the TV Guide. Beautiful!

I'll look for the source code!

Now, I noticed that with your controls they automatically change to the right positions whether the window is normal size or maximized (like the OK button). Beautiful. So I was putting labels in the gui, but they didn't move where I wanted them. I thought it was because of not having GUICtrlSetResizing (or creating) functions for Metro styled labels. Of course, I could have done something wrong myself.

How far were you planning on taking the Metro Design? Tray Menu's? Calendar gui?  Just was wondering.

 

Thank you for everything you did so far.

Share this post


Link to post
Share on other sites
10 hours ago, coffeeturtle said:

Your Netflix-like program looks great so far! Nicely done!

And badly written or not, TVShowManager is not only good looking, not only have key functions that could easily be implemented in other functions, but it itself is very useful for keeping track of shows! (So many shows barely last one season so I like to keep track of some to see if they survive the cut and if I should binge watch or not). And I huge TV Show list is like having the TV Guide. Beautiful!

I'll look for the source code!

Now, I noticed that with your controls they automatically change to the right positions whether the window is normal size or maximized (like the OK button). Beautiful. So I was putting labels in the gui, but they didn't move where I wanted them. I thought it was because of not having GUICtrlSetResizing (or creating) functions for Metro styled labels. Of course, I could have done something wrong myself.

How far were you planning on taking the Metro Design? Tray Menu's? Calendar gui?  Just was wondering.

 

Thank you for everything you did so far.

If you set GUICtrlSetResizing correctly, then the label should also move in the position you want.

Well there are a lot of requests at the moment like Scrollbars,Sliders etc. and I don't know which will work or not. Everything that goes beyond simple clicking like buttons, checkboxes etc. require a lot of workarounds in the background which in return create problems with big projects.. 

There will be new features, but I don't know when I will have the time to work on it again.

Share this post


Link to post
Share on other sites
On 2/19/2017 at 4:50 AM, BBs19 said:

If you set GUICtrlSetResizing correctly, then the label should also move in the position you want.

Well there are a lot of requests at the moment like Scrollbars,Sliders etc. and I don't know which will work or not. Everything that goes beyond simple clicking like buttons, checkboxes etc. require a lot of workarounds in the background which in return create problems with big projects.. 

There will be new features, but I don't know when I will have the time to work on it again.

Understood. No worries. Everything seems to be working well.

Just was curious: What would be the best way to get Transparency to work with the Metro GUI?

On Windows 10, this works fine: _WinAPI_DwmEnableBlurBehindWindow10($Form1, True)/#include <_WinAPI_DwmEnableBlurBehindWindow10.au3>

However, this does not work with Windows 7. The old GUI Create does have a flag for transparent layers, but not sure if there is a Metro equivalent?

Thanks again!

Edited by coffeeturtle

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Yodavish
      My AutoIt script works fine, for the most part, however, if it goes idle for roughly 30 minutes, it will won't be able to send data to a 3rd party application window titled, "Case #". 
      The problem lies within the function "SendFusion", it's able to see the handle for the "WinActivate" and "WinWaitActivate" (I've also tried putting in 10 seconds in the WinWaitActivate as well, doesn't work). However, if we have been idle, it will always fail to send data afterward. On what I've tried so far:
      "Send" function with the data and a {ENTER} i.e. Send($CaseTxt & "{ENTER}"), this won't even hit the enter key  ControlSetText, tried passing the handle from WinActivate, using the title "Case #" that was copied directly from the Autoit Window Info, hard coding the title, Using CLASS:WindowsForms10... always returns a 0 ControlCommand (same as above) always returns a 0 ControlGetFocus always returns a 0 ControlFocus, always returns a 0 Creating a new and simple Au3 script that just sends data to "Case #", also fails NOTE: If I close the Au3 script and just scan the data directly into the "Case #" or even type it, it works fine with no issues. I'm confused as to why it would not work after a long idle period?
      Below are the essential parts of the script, I can provide the entire thing if needed. Any suggestions would be greatly appreciated!
      #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Process.au3> #include <Misc.au3> #include <IE.au3> ;--------------------------------------------------------------- ; Only one instance can run ;--------------------------------------------------------------- If _Singleton("gross.exe", 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "Gross.exe is already running. Please exit the existing version first (check the icons in the lower right corner of your screen) before running it again.") Exit EndIf ;--------------------------------------------------------------- ; AutoIt Options ;--------------------------------------------------------------- Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt("WinWaitDelay", 0) ; Alters how long a script should briefly pause after a successful window-related operation. Time in milliseconds to pause (default=250). Opt("WinTextMatchMode", 1) ; Alters the method that is used to match window text during search operations. 2 = Quick mode Opt("SendKeyDelay", 0) ; Alters the length of the brief pause in between sent keystrokes. A value of 0 removes the delay completely. Time in milliseconds to pause (default=5). if ($fusionWindowTitle="NONE" or $fusionCaseNumWinTitle="NONE" or $appWindowTitle="NONE" or $winActivateTimeout="NONE" or $winCloseTimeout="NONE" or $winWaitTimeout="NONE" or $pdfViewerWidth="NONE" or $pdfViewerHeight="NONE" or $pdfViewerLeft="NONE" or $pdfViewerWindowName="NONE" or $pdfViewerExeName="NONE" or $pdfUrl="NONE" or $pdfDownloadCommand="NONE") Then Msgbox(0,"ERROR", "gross.ini is missing or does not contain all settings. Please contact Help Desk with this information") Exit -1 EndIf ;--------------------------------------------------------------- ; application settings/constants ;--------------------------------------------------------------- Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") Global Const $[VARIABLE] = IniRead("gross.ini", "default", "[TitleOfVariable]", "NONE") ;--------------------------------------------------------------- ; create the main window ;--------------------------------------------------------------- Local $mainWindow = GUICreate($appWindowTitle, 380, 190) ; create the main GUI window GUISetOnEvent($GUI_EVENT_CLOSE, "handleCloseClick") ; when the click the windows close button call handleCloseClick() WinSetOnTop($appWindowTitle, '', 1) ; Sets main GUI always on top ;--------------------------------------------------------------- ; create the controls on the main window ;--------------------------------------------------------------- Local $okButton = GUICtrlCreateButton("OK", 160, 160, 54,24) ; create OK button GUICtrlSetOnEvent($okButton, "validateInput") ; when they click ok, call handleInputProcessRequest() GUICtrlCreateLabel("Scan Input", 10, 10) ; create a label Global $inputScan = GUICtrlCreateInput("", 10,134,358) ; create the input scan box GUICtrlSetOnEvent($inputScan, "validateInput") ; when they press enter in the scan input box, call handleInputProcessRequest() GUICtrlSetState($inputScan,$GUI_FOCUS) ; automatically sets focus on the input field GUISetState(@SW_SHOW) ; main GUI loop that runs at all times ;--------------------------------------------------------------- While 1 ;---------------------------------------------------------- ; If sumatraPDF active, resets focus back to GUI ;---------------------------------------------------------- If WinActive($pdfViewerWindowName) Then consoleWrite('While Loop sumatraPDF was active' & @CRLF) setMainWindow() ;---------------------------------------------------------- ; After data sent to ProTracker, check for mismatch ; save button to trigger the event handler when clicked ;---------------------------------------------------------- ElseIf WinActive($proTrackerWindowTitle) Then $ie = _IEAttach("ProTracker") $mismatchButton = _IEGetObjByName($ie, $proTrackerMisMatchButtonId) $oEvent = ObjEvent($mismatchButton, "mismatchButton_") If @error Then setMainWindow() ;--------------------------------------------------------------------- ; If Fusion is prompting for the case #, focus back to main GUI input ; If second GUI 'Unknown' detect do nothing ;--------------------------------------------------------------------- ElseIf WinExists($fusionWindowTitle) and WinExists($fusionCaseNumWinTitle) and Not WinActive($mainWindow) and Not WinExists('Unknown Input') Then setMainWindow() EndIF ;--------------------------------------------------------------------- ; Checks if $processFlag = Done, if so, shows PDF viewer and clears ; processFlag for next iteration ;--------------------------------------------------------------------- IF WinExists($pdfViewerWindowName) and $processFlag == 'Done' Then WinSetState ($pdfViewerWindowName, '', @SW_SHOW) $processFlag = '' setMainWindow() EndIF Sleep(100) ; Sleep to reduce CPU usage WEnd Func handleInputProcessRequest($input) $processFlag = True Local $hTimer = TimerInit() consoleWrite('> handleInputProcessRequest: ' & @CRLF) Local $idInput = identifyInput($input) ; Select a proccess to run based on id input Select Case $idInput = "container" ; regex that captures only the case number $caseTxt = StringUpper(StringRegExpReplace($strippedInputData, '\??(\w*\d*-\d*|\d*).*$','$1')) If WinExists($fusionWindowTitle) and WinExists($fusionCaseNumWinTitle) Then sendProTracker(StringUpper($strippedInputData)) sendFusion($caseTxt) ; gets pdf for sumatraPDF in seperate script, since that function is the slowest Run("viewPDF.exe " & $caseTxt) ;getSumatraPDF($caseTxt) $lastCaseNum = $caseTxt Else ; Checks to make sure the previous "Container" case num is the same ; to the current Container case num, before sending to ProTracker If($lastCaseNum <> $caseTxt) Then ; If not the same case number send alert sound SoundPlay("error.wav") Else sendProTracker($strippedInputData) EndIf EndIf Case $idInput = "user" sendProTracker($strippedInputData) Case $idInput = "cassette" sendProTracker(StringUpper($strippedInputData)) Case $idInput = "unknown" selectUnknown() EndSelect Local $fDiff = TimerDiff($hTimer) $processFlag = 'Done' consoleWrite('> handleInputProcessRequest Completed Total time: ' & $fDiff & ' ' &@CRLF&@CRLF&@CRLF) EndFunc Func sendFusion($caseTxt)     Local $hTimer = TimerInit()     consoleWrite('+ sendFusion initiated: ' & $caseTxt & @CRLF)     If $caseTxt = "" Then         MsgBox(0, "Error", "Not a valid case number")     Else         ;$fusionCaseNumWinTitle = "Case #"         $retVal1 = WinActivate($fusionCaseNumWinTitle, "")         consoleWrite("ReturnValue WinActivate " & $retVal1 & @CRLF)         $retVal2 = WinWaitActive($fusionCaseNumWinTitle,"",$winActivateTimeout)         consoleWrite("ReturnValue WinWaitActive: " & $retVal2 & @CRLF)         $retVal3 = ControlSetText($fusionCaseNumWinTitle, "", "", $caseTxt)         ;$retVal3 = ControlCommand($fusionCaseNumWinTitle, "", "", "EditPaste", $caseTxt)         consoleWrite("ReturnValue ControlSetText: " & $retVal3 & @CRLF)         ;Send($caseTxt & "{ENTER}")         WinWaitClose($fusionCaseNumWinTitle, "", $winCloseTimeout)         consoleWrite('+ sendFusion WinWaitClose: ' & @CRLF)     EndIf     Local $fDiff = TimerDiff($hTimer)     ConsoleWrite('+ sendFusion Completed Total time:' & $fDiff & ' ' & @CRLF) EndFunc
      Console logs from the SciTLE
      Window (x86) Info matches the correct handle for the WinActivate and WinWaitActivate

      Window Control (x86) Info, I've tried the CLASS, the ID, also I just noticed that the "handle" in "Control" and "Window" appear to be different as well.

       
      So far the only work-around is to close down the 3rd party application and the AutoIt script, re-open them and it works all completely fine. But this is a pain for the end-user since it's all touch screen and it slows down their workflow, which they can be extremely sensitive about.
       
    • By antonioj84
      I am not able to use the $GUI_READ_EXTENDED with the  Metro UDF,  any work around ?
      Local $aPos[2] = [$Radio1, $Radio2] For $Radio In $aPos If GUICtrlRead($Radio) = $GUI_UNCHECKED Then ContinueLoop IniWrite($sGUIstate_IniFile, "Data", "POS", GUICtrlRead($Radio, $GUI_READ_EXTENDED)) ;; return the text of the menu item ExitLoop Next  
    • By taylansan
      Hello All, 
      If you're interested in the story, read below. Otherwise, just jump to the end of the post. 
      Story: 
      Sometimes my computer goes crazy with Windows update. I tried to turn it off with "services.msc", but couldn't close the it. So, I did some research online that it's triggered by Update Orchestration and Task Scheduler and Windows Update. I also checked that all three processes are triggered by svchost.exe.

      So, I tried to make a script to close this process. I found some useful functions ProcessList and _ProcessGetName using the help documents and coded something as below: 
      #include <MsgBoxConstants.au3> #include <Process.au3> Local $aProcessList = ProcessList() For $i = 1 To $aProcessList[0][0] $iPid = $aProcessList[$i][1] $sName = _ProcessGetName($iPid) MsgBox($MB_SYSTEMMODAL, "The process", "PID: " & $iPid & @CRLF & "NAME: " & $sName) If $sName = "svchost.exe" Then ;ProcessClose($iPid) ;I don't know if this is the process I want to close EndIf Next But the problem is; there are so many svchost.exe exists in the process list. I can't close all of them, some of them are essential to run Windows (well, accidentally I terminated some of them and ended up with a blue screen  
      ---------------
      Well, how can I know the process name like "Service Host: Update Orchestration" (not the scvhost)?
      It's not only with the .exe file, just to the name shown in Windows. 
    • By Yodavish
      I have this AutoIt script that works on Windows 7. However, when I test it on Windows 10, the objEvent will not execute the function it's supposed to call. So I have a webpage the script will check if it is active, then it will search if a popup button exist (elementId), if so, assign it to the event handler so that when that button is clicked, then handler function will move the focus back to the main GUI again.
      If WinActive("Website Title - Internet Explorer") Then    $ie = _IEAttach("Website Title")    $objElement= _IEGetObjById ($ie, "elementId")    local $oEvent = ObjEvent($objElement, "_MY_EVENT_HANDLER_") EndIf Func _MY_EVENT_HANDLER_onclick($oEvtObj)     msgbox(0,"Alert Window", "Button Clicked!") setMainWindow() ; sets focus back to main GUI EndFunc  
      I've verified, on Windows 10, that it does see the object element. But it will not trigger the event. Could it be related to some timing issues due to Windows 10 Internet Explorer over Windows 7 Internet Explorer? 
      Windows 7 IE version 11.0.9600.19507
      Windows 10 IE version 11.418.18362.0
      AutoIt v 3.3
       
×
×
  • Create New...