Sign in to follow this  
Followers 0
Foderus

Script wont run after compile

27 posts in this topic

Hello!

I just wrote a script using AD UDF (its awesome btw). It ran fine, i did not change anything and then i pressed both build and compile from Sci Tech editor and after that my script wont run.

If i press F5 or Tools -> Go, nothing happends (nothing at all, no process is starting and no error message or anything). If i compile it to .exe and then run the .exe nothing happends either (process does not start).

I can run my other scripts just fine, any ideas if it has to do anything with when I compiled it?

My scripts fetches data from an XML file and then creates an AD user using that information.

This screenshots shows how SCITech looks after i have pressed Tools -> Go (nothing happends at all, no error message no nothing!).

autoitNORUN.png

 

Please do tell if you need me to try anything or if you need any other input, i checked Windows Event log too but i did not find any error message there either.

Share this post


Link to post
Share on other sites



I just ran the script on Another PC and it worked from there, what exactly does the compile script from SciTech do to screw this up? Hmm...

Share this post


Link to post
Share on other sites

Verify $xmlPath actually exists; you could also put in a MsgBox inside

the If Not FileExists($xmlPath) to check if that is where script exits...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Verify $xmlPath actually exists; you could also put in a MsgBox inside

the If Not FileExists($xmlPath) to check if that is where script exits...

 

It should be OK since it ran fine on Another computer i guess?

Also i cannot test it since even if i add msgbox with that variable the script still does not run.

Edited by Foderus

Share this post


Link to post
Share on other sites

Just curious how you expect anyone to assist in troubleshooting when all you post is a screenshot showing 10 lines of your script? Help us help you, post the whole script.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

Could you please post a screenshot of the task maanager after you have pressed F5 in SciTE?

Sio we can check if anything has started at all.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Just curious how you expect anyone to assist in troubleshooting when all you post is a screenshot showing 10 lines of your script? Help us help you, post the whole script.

 

It should not be neccesary since i am sure there is nothing wrong with the script but here it is!

Local $xmlPath = @ScriptDir & '\Beställning av behörigheter.xml'
If Not FileExists($xmlPath) Then Exit
$file = FileRead($xmlPath)
$file = StringReplace($file, @LF, '')
$file = StringSplit($file, @CR, 1)

;MsgBox(0, 'Start', "Följande värden sparades i variabler som skall vidare för AD-kontoskapning.")

;$namn = XMLget($file, 'my:minaFält\my:Förnamn') & " " & XMLget($file, 'my:minaFält\my:Efternamn')

;MsgBox(0, 'DONE!!!', $namn)

;MsgBox(0, 'DONE!!!', XMLget($file, 'my:minaFält\my:Adress'))
;MsgBox(0, 'DONE!!!', XMLget($file, 'my:minaFält\my:Postnummer'))
;MsgBox(0, 'DONE!!!', XMLget($file, 'my:minaFält\my:Ort'))

;info ssom man kan tänka på, ej nödvändigt för kontoskapning i AD
;MsgBox(0, 'DONE!!!', XMLget($file, 'my:minaFält\my:ValidTo'))
;MsgBox(0, 'DONE!!!', XMLget($file, 'my:minaFält\my:mappbehörighet'))
;MsgBox(0, 'DONE!!!', XMLget($file, 'my:minaFält\my:fält28'))

;test succesfull
;$XMLFornamn = XMLget($file, 'my:minaFält\my:Förnamn')
;MsgBox(0, 'DONE!!!', $XMLFornamn)

;exempel på xml
;MsgBox(0, 'DONE!!!', XMLget($file, 'adc_database\planets\sun'))
;MsgBox(0, 'DONE!!!', XMLget($file, 'adc_database\forecast\day number="1"\daytime\txtlong'))
;MsgBox(0, 'DONE!!!', XMLget($file, 'adc_database\currentconditions\pressure'))





;#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
;#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
;; *****************************************************************************
;; Example 1
;; Creates and activates a user in a particular OU.
;; *****************************************************************************
#include <AD.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Open Connection to the Active Directory
_AD_Open()
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)

Global $sFQDN = _AD_SamAccountNameToFQDN()
Global $sParentOU = StringMid($sFQDN, StringInStr($sFQDN, ",OU=") + 1)


 ;Enter parent OU and user to create
#region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Active Directory Functions - Example 1", 714, 124)
GUICtrlCreateLabel("Enter the OU (FQDN):", 8, 10, 231, 17)
GUICtrlCreateLabel("Enter the user to create (samAccountName)", 8, 42, 231, 17)
Global $IOU = GUICtrlCreateInput("OU=TestOU,DC=ad,DC=foderus,DC=se" 241, 8, 459, 21)

;"OU=TestOU,DC=ad,DC=foderus,DC=se"
;$sParentOU

Global $IUser = GUICtrlCreateInput("Test-User", 241, 40, 459, 21)
Global $BOK = GUICtrlCreateButton("Create User", 8, 72, 121, 33)
Global $BCancel = GUICtrlCreateButton("Cancel", 628, 72, 73, 33, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    Global $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $BCancel
            Exit
        Case $BOK
            Global $sOU = GUICtrlRead($IOU)
            Global $sUser = GUICtrlRead($IUser)
            ExitLoop
    EndSwitch
WEnd

 ;Create a new user
Global $iValue = _AD_CreateUser($sOU, $sUser, XMLget($file, 'my:minaFält\my:Förnamn') & " " & XMLget($file, 'my:minaFält\my:Efternamn'))
If $iValue = 1 Then
    MsgBox(64, "Active Directory Functions - Example 1", "User '" & $sUser & "' in OU '" & $sOU & "' successfully created")
ElseIf @error = 1 Then
    MsgBox(64, "Active Directory Functions - Example 1", "User '" & $sUser & "' already exists")
ElseIf @error = 2 Then
    MsgBox(64, "Active Directory Functions - Example 1", "OU '" & $sOU & "' does not exist")
;ElseIf @error = 3 Then
    MsgBox(64, "Active Directory Functions - Example 1", "Value for CN (e.g. Lastname Firstname) is missing")
ElseIf @error = 4 Then
    MsgBox(64, "Active Directory Functions - Example 1", "Value for $sAD_User is missing")
Else
    MsgBox(64, "Active Directory Functions - Example 1", "Return code '" & @error & "' from Active Directory")
EndIf


;ej klart med variabler etc

;$aUser = _AD_SamAccountNameToFQDN()
;_AD_SetPasswordExpire($aUser,0)
;_AD_ModifyAttribute($aUser, "initials", $sminitial)
_AD_ModifyAttribute($sUser, "displayName", XMLget($file, 'my:minaFält\my:Förnamn') & " " & XMLget($file, 'my:minaFält\my:Efternamn'))
_AD_ModifyAttribute($sUser, "sn", XMLget($file, 'my:minaFält\my:Efternamn'))
_AD_ModifyAttribute($sUser, "givenName", XMLget($file, 'my:minaFält\my:Förnamn'))
_AD_ModifyAttribute($sUser, "streetAddress", XMLget($file, 'my:minaFält\my:Adress'))
_AD_ModifyAttribute($sUser, "l", XMLget($file, 'my:minaFält\my:Ort'))
_AD_ModifyAttribute($sUser, "postalCode", XMLget($file, 'my:minaFält\my:Postnummer'))
_AD_ModifyAttribute($sUser, "homeDirectory", "\\gcfiler01\user3$\" & $sUser)
_AD_ModifyAttribute($sUser, "homeDrive", "H:")

;_AD_ModifyAttribute($aUser, "extensionAttribute9", $sEmployee)
;_AD_ModifyAttribute($aUser, "physicalDeliveryOfficeName", $soffice)
;_AD_ModifyAttribute($aUser, "telephoneNumber", $sphone)
;_AD_ModifyAttribute($aUser, "wWWHomePage", $sweb)
;_AD_ModifyAttribute($aUser, "postOfficeBox", $spo)
;_AD_ModifyAttribute($aUser, "l", $scity)
;_AD_ModifyAttribute($aUser, "st", $sstate)
;_AD_ModifyAttribute($aUser, "postalCode", $szip)
;_AD_ModifyAttribute($aUser, "co", "United States")
;_AD_ModifyAttribute($aUser, "info", "Account created on " & @MON & "/" & @MDAY & "/" & @YEAR & " by " & @UserName )
sleep(500)




; Close Connection to the Active Directory
_AD_Close()






Func XMLget($file, $Path); XMLget($file,'adc_database\currentconditions\realfeel')
    $Path = StringSplit($Path, '/\|', 0)
    $lastline = 0
    For $lvl = 1 To $Path[0] Step 1
        For $line = $lastline To $file[0] Step 1
            $lastline = $line
            $hstart = StringInStr($file[$line], '<' & $Path[$lvl] & '>', 0)
            $hstarta = StringInStr($file[$line], '<' & $Path[$lvl] & ' ', 0)
            If $hstart Or $hstarta Then
                If $lvl == $Path[0] Then
                    If $hstart Then
                        $end = StringInStr($file[$line], '</' & $Path[$lvl] & '>', 0)
                        If $end Then
                            $hstart = $hstart + StringLen('<' & $Path[$lvl] & '>')
                            Return StringMid($file[$line], $hstart, $end - $hstart)
                        EndIf
                    EndIf
                    If $hstarta Then
                        $end = StringInStr($file[$line], '/>', 0)
                        If $end Then
                            $hstarta = $hstarta + StringLen('<' & $Path[$lvl] & ' ')
                            $return = StringMid($file[$line], $hstarta, $end - $hstarta)
                            Return $return
                        EndIf
                        $ends = StringInStr($file[$line], '>', 0)
                        If $ends Then
                            $hstart = $ends + 1
                            $end = StringInStr($file[$line], '</' & $Path[$lvl] & '>', 0)
                            If $end Then
                                $return = StringMid($file[$line], $hstart, $end - $hstart)
                                Return $return
                            EndIf
                        EndIf
                    EndIf
                EndIf
                ContinueLoop 2
            EndIf
        Next
        If $line == $file[0] Then ExitLoop
    Next
    Return 'not found'
EndFunc ;==>XMLget

 

Edited by Foderus

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Could you please post a screenshot of the task maanager after you have pressed F5 in SciTE?

Sio we can check if anything has started at all.

 

Of course, if you want me to provide any information I will try to fix it. Here it is.

EventViewAutoIt.png

Sorry i read wrong here is the right screenshot

processes.png

Edited by Foderus

Share this post


Link to post
Share on other sites

There is not even a SciTE process in your task list :huh:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

There is not even a SciTE process in your task list :huh:

 

Hehe i Think i closed it, here Another one, doesnt look much different.

autoitscreeneventman.png

Share this post


Link to post
Share on other sites

Can you please check the "Show processes from all users" box at the bottom of Task Manager? There are several system processes we're not even seeing.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Can you please check the "Show processes from all users" box at the bottom of Task Manager? There are several system processes we're not even seeing.

 

I hope this helps then, there are alot more processes, its hard to screenshot them all but just say if you want me to take a screen on all of them

autoitPROCESSALL.png

Edited by Foderus

Share this post


Link to post
Share on other sites

The screenshot shows that all menus including "Tools" are greyed out. Did you save the script as yourscriptnamegoeshere.au3? Can you please show the window title of SciTe?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

The screenshot shows that all menus including "Tools" are greyed out. Did you save the script as yourscriptnamegoeshere.au3? Can you please show the window title of SciTe?

 

Did you mean like this?

autoitTITLE.png

Share this post


Link to post
Share on other sites

Yes. If you compare it with the screenshot from post #10 you will see that all menus are greyed out. That is why F5 does nothing.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Yes. If you compare it with the screenshot from post #10 you will see that all menus are greyed out. That is why F5 does nothing.

 

It looks like that when its not the Active window. if i go to Tools -> go or mark the SciTe as Active window and press F5 nothing happens.

Share this post


Link to post
Share on other sites

Is there any way to clear some sort of cache for AutoIT?

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

What happens when you select "Tools" and then "Go" in SciTE?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

What happens if you select "Tools" and then "Go" in SciTE?

 

Nothing, the screenshot in post #1 shows what happends after i press that.

 

I want to thank all of you for your help so far by the way! (:

 

Edited by Foderus

Share this post


Link to post
Share on other sites

Which version of Windows do you run?

Which version of AutoIt?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

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
Sign in to follow this  
Followers 0