Close
Showing results 1 to 8 of 8
  1. #1

    Default SetForegroundWin Intermittent Error

    <SetForegroundWin> failed: Operating system SetForegroundWindow function failed; Windows reports system error 0, "The operation completed successfully."

    Anyone know how to correct this error or why it happens only intermittently

  2. #2

    Default

    I am currently having the same issue. The error happens very inconsistently, maybe 50% of the time I try to execute a ToggleWin command. The frustrating thing about this is the same script was working without issue as recently as two or three weeks ago.

    Has anyone else encountered this issue?

  3. #3

    Default

    I don't face this error using the <SetForegroundWin> only for the first window, but when I use the code with <SeForegroundWin> after each window target it does cause that error... Let me know if this works for you as worked for me

    *Resize for 1920x1080p monitor and five accounts
    Code:
    <Command ResizeAndPosition>
       <TargetWin %2%>
          <SetWinRect 1280 0 640 360>
         <UpdateWin>  
       <TargetWin %3%>
          <SetWinRect 1280 360 640 360>  
         <UpdateWin>   
       <TargetWin %4%>
          <SetWinRect 1280 720 640 360>
         <UpdateWin>
       <TargetWin %5%>
          <SetWinRect 640 720 640 360>
         <UpdateWin>
       <TargetWin %1%>
          <SetWinRect 0 0 1280 720>
             <SetForegroundWin>
         <UpdateWin>
    Last edited by muldorante : 07-21-2019 at 05:42 AM Reason: Missing information

  4. #4

    Default

    Thank you for the response! I played around a bit with the solution you recommended and found that the errors were happening less frequently, but were still occurring. In my case, I'm toggling between 3 accounts as opposed to your 5 accounts. I started to wonder whether the time needed to resize 5 windows introduced a delay long enough to avoid the errors. Incidentally, another symptom I noticed was when errors occurred I could hear 2 soundtracks playing on top of one another.

    I started to wonder whether there was a timing issue involved between switching focus to the desired window and syncing up the hidden window, which might be responsible for playing the soundtrack.

    I introduced a delay to see if it helped matters and it eliminated the errors I was experiencing. Here was the original setup that failed roughly half the time:

    Code:
    // -- run this first
    <Hotkey ScrollLockOn Ctrl F12>
        <SendPC local>
            <RenameWin "World of Warcraft" hidden-wow-1> 
            <RenameWin "World of Warcraft" hidden-wow-2> 
            <RenameWin "World of Warcraft" hidden-wow-3> 
            
    // -- run this second
    <Hotkey ScrollLockOn Shift Ctrl F12>
        <SendPC local>
            <RenameWin "World of Warcraft" wow1> 
            <RenameWin "World of Warcraft" wow2>
            <RenameWin "World of Warcraft" wow3>
    
    
    <Hotkey ScrollLockOn Shift Ctrl F11>
       <SendPC local>
            <ToggleWin wow1 wow2 wow3>
    I introduced a delay in my own version of ToggleWin:

    Code:
    // -- run this first
    <Hotkey ScrollLockOn Ctrl F12>
        <SendPC local>
            <RenameWin "World of Warcraft" hidden-wow-1> 
            <RenameWin "World of Warcraft" hidden-wow-2> 
            <RenameWin "World of Warcraft" hidden-wow-3> 
            
    // -- run this second
    <Hotkey ScrollLockOn Shift Ctrl F12>
        <SendPC local>
            <RenameWin "World of Warcraft" wow1> 
            <RenameWin "World of Warcraft" wow2>
            <RenameWin "World of Warcraft" wow3>
                
    <Command DelayedToggleWin>
        <SendPC local>
            <TargetWin %1%>
                <wait 100>        
                <SetForegroundWin>
                <UpdateWin>
    
    <Hotkey ScrollLockOn Shift Ctrl F11>
        <If ActiveWinIs wow1>
            <DelayedToggleWin wow2>
        <Else If ActiveWinIs wow2>
            <DelayedToggleWin wow3>
        <Else>
            <DelayedToggleWin wow1>
    So far, this seems to work for me without errors. After some experimentation, I settled on a wait time of 100ms (note the <wait 100> command) and no longer saw errors. I will say that adjusting the wait to be lower started to result in errors again, so it's possible you'll need to adjust this number based on your own setup.

    Note that this is working for my use case: 3 accounts running on a single computer. Hopefully this will be helpful to others experiencing this issue.

    Update:
    After playing with this config for a few hours, I'm still seeing issues. The errors are happening much less frequently, but they are still happening. Please share if you have other ideas on this issue. Thanks!
    Last edited by raikodin : 08-07-2019 at 10:42 AM

  5. #5

    Default

    In your hotkeynet settings the Disable foreground lock is checked?

    Options > Settings > Disable foreground lock

    With this option checked and the code that i posted earlier I don't face any errors

    Give it a try, good luck

  6. #6

    Default

    Thanks for taking another look at this issue. Unfortunately, my 'disable foreground lock' setting was already selected. Just in case I'm missing something, I've posted my settings below.


    Attached Images Attached Images
    Last edited by raikodin : 08-11-2019 at 10:12 PM Reason: Original post settings image was a bit too hard to read

  7. #7

    Default

    Can you post your script? Maybe something else is causing this error...

  8. #8

    Default

    Code:
    <Hotkey ScrollLockOn Ctrl F12>
        <SendPC local>
            <RenameWin "World of Warcraft" hidden-wow-1> 
            <RenameWin "World of Warcraft" hidden-wow-2> 
            <RenameWin "World of Warcraft" hidden-wow-3> 
            
    <Hotkey ScrollLockOn Shift Ctrl F12>
        <SendPC local>
            <RenameWin "World of Warcraft" wow1> 
            <RenameWin "World of Warcraft" wow2>
            <RenameWin "World of Warcraft" wow3>
    
    
    <Label w1 Local SendWinM wow1>
    <Label w2 Local SendWinM wow2>
    <Label w3 Local SendWinM wow3>
    
    
    <Hotkey ScrollLockOn B, C, M, 0-9, Plus, Minus, Space>
    <SendLabel w1, w2, w3>
    <Key %Trigger%> 
    
    
    <Hotkey ScrollLockOn Ctrl B, 0-9, Plus, Minus>
    <SendLabel w1, w2, w3>
    <Key %Trigger%> 
    
    
    <MovementHotkey ScrollLockOn S, down>
    <SendLabel w1, w2, w3>
    <Key %Trigger%> 
                
    <Command DelayedToggleWin>
        <SendPC local>
            <TargetWin %1%>
                <wait 100>        
                <SetForegroundWin>
                <UpdateWin>
       
    <Hotkey ScrollLockOn Shift Ctrl F8>
        <DelayedToggleWin wow1>
    
    
    <Hotkey ScrollLockOn Shift Ctrl F9>            
        <DelayedToggleWin wow2>
    
    
    <Hotkey ScrollLockOn Shift Ctrl F10>
        <DelayedToggleWin wow3>    
    
    
    <Hotkey ScrollLockOn Shift Ctrl F11>
        <If ActiveWinIs wow1>
            <DelayedToggleWin wow2>
        <Else If ActiveWinIs wow2>
            <DelayedToggleWin wow3>
        <Else>
            <DelayedToggleWin wow1>

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •