Jump to content

Compile issues


Recommended Posts

Ok, so i've written a code and it works perfectly when not compiled. It works perfectly compiled on the machine that it was written on. When I try to run it on another machine (exact same build) it seems to be freezing up or getting lost somewhere within the code (sorry its hard to explain).

Using Windows 7 (32 bit), on both computers.

Want to make sure I'm compiling it correctly.

I'm using the "Compile Script to .exe" program. The code is broken up into several pieces to compartmentalize its execution. So when I compile it, I compile the main code that contains all the #includes.

Are there any known issues? Do I need to mess with the compression ratio?

This is the only forum I could find with a similar issue:

Thanks in advance

Link to comment
Share on other sites

Please give your code. Don't make us guess your code error!

Sorry, was hoping someone already had this issue and knew what it was since I don't receive any error messages or anything. But here's a snippit of my code.

#RequireAdmin

#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator 

_Expand("Internet Explorer|", "Internet Control Panel|", "Security Page|", "Internet Zone", "Local Group Policy Editor")
_GetItem("Java permissions", "!e", "Disable Java", "Local Group Policy Editor")
_GetItem("Download signed ActiveX controls", "!e", 'Disable', "Local Group Policy Editor")
_GetItem("Download unsigned ActiveX controls", "!e", 'Disable', "Local Group Policy Editor")
_GetItem("Initialize and script ActiveX controls not marked as safe", "!e", 'Disable', "Local Group Policy Editor")
_GetItem("Allow font downloads", "!e", 'Disable', "Local Group Policy Editor")
_GetItem("Access data sources across domains", "!e", 'Disable', "Local Group Policy Editor")
_GetItem("Allow drag and drop or copy and paste files", "!e", 'Disable', "Local Group Policy Editor")
_GetItem("Allow installation of desktop items", "!e", 'Disable', "Local Group Policy Editor")

;Function to expand to desired position within Group Policy Editor 
Func _Expand($subChild1, $subChild2, $subChild3, $subChild4, $groupPolicyWin)
Run("mmc.exe gpedit.msc")
WinWaitActive($groupPolicyWin)
ControlClick("", "", "AMCCustomTab1", "left", 1, 105, 7)

ControlTreeView ($groupPolicyWin, "", "SysTreeView321", "Expand", "Local Computer Policy|User Configuration|" & _
    "Administrative Templates")
ControlTreeView ($groupPolicyWin, "", "SysTreeView321", "Expand", "Local Computer Policy|User Configuration|" & _
    "Administrative Templates|Windows Components|")
    ControlTreeView ($groupPolicyWin, "", "SysTreeView321", "Expand", "Local Computer Policy|User Configuration|" & _
    "Administrative Templates|Windows Components|" &$subchild1)
ControlTreeView ($groupPolicyWin, "", "SysTreeView321", "Expand", "Local Computer Policy|User Configuration|" & _
    "Administrative Templates|Windows Components|" &$subchild1 & $subChild2)
ControlTreeView ($groupPolicyWin, "", "SysTreeView321", "Expand", "Local Computer Policy|User Configuration|" & _
    "Administrative Templates|Windows Components|" &$subchild1 & $subChild2 & $subChild3)
ControlTreeView ($groupPolicyWin, "", "SysTreeView321", "Expand", "Local Computer Policy|User Configuration|" & _
    "Administrative Templates|Windows Components|" &$subchild1 & $subChild2 & $subChild3 & $subChild4)
ControlTreeView ($groupPolicyWin, "", "SysTreeView321", "Select", "Local Computer Policy|User Configuration|" & _
    "Administrative Templates|Windows Components|" &$subchild1 & $subChild2 & $subChild3 & $subChild4)

Sleep(500)
ControlClick("", "", "AMCCustomTab1", "left", 1, 105, 7)
Send("{tab}")

EndFunc

;Function to select required setting and then Enable/Disable that setting depending on requirement
;In this sample code I can successfully Enable the setting but am unable to set the "Options" setting that 
;should be set to 'Disable Java' or other setting as required
Func _GetItem($item, $setting, $setting2, $groupPolicyWin)
    Local $itemNum
    $itemNum = ControlListView($groupPolicyWin, "", "SysListView321", "FindItem", $item)
If $itemNum > -1 Then
        ControlListView($groupPolicyWin, "", "SysListView321", "Select", $itemNum)
        sleep(500)
        Send("{Enter}")
        WinWaitActive($item)
        sleep(500)
        Send($setting)
        sleep(1000)
    
    ControlFocus("", "", "WindowsForms10.COMBOBOX.app.0.378734a1")
            Send("{HOME}")  
            $focus = ControlGetText("", "", "WindowsForms10.COMBOBOX.app.0.378734a1")
            $i = 0
            While ($focus <> $setting2) OR $i = 10
                Send("{Down}")
                $focus = ControlGetText("", "", "WindowsForms10.COMBOBOX.app.0.378734a1")
                $i = $i + 1
            WEnd
            ControlCommand("", "", "OK", "Check")
    Else
        MsgBox(0, "Error", "Could not find this setting" & $item)
    EndIf
    

EndFunc

This code shows the same behavior as my much longer code. It works fine un-compiled and compiled (.exe) file on the system it was written on. But seems to freeze up on a system (with the same build, Win 7 (32 bit).

Also once the code "freezes" if you double click the highlighted setting in group policy the code will then continue to run, but may or may not "freeze" again. If you repeat the steps mentioned above the code may or may not "fully function". Hope this makes sense, if not I'll try to clarify more.

Thanks

Link to comment
Share on other sites

I noticed that you're using the script to modify the settings in gpedit, have you tried just copying the contents of "C:\Windows\System32\Group Policy" to each computer and rebooting? Set up one computer the way you want it, then copy that to each machine.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I noticed that you're using the script to modify the settings in gpedit, have you tried just copying the contents of "C:\Windows\System32\Group Policy" to each computer and rebooting? Set up one computer the way you want it, then copy that to each machine.

Will this actually be reflected in Group Policy? I'll give it a try tomorrow and see what happens.

Thanks

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...