Jump to content

Recommended Posts

Posted

Hey Surya,

no need to apologize, I'm happy that you are helping me! :-)

I tried your code but unfortunately nothing happened.
After changing
 

$fini = "C:\Windows\System32\GroupPolicy\Machine\Scripts\scripts.ini"

to
 

$fini = "C:\Windows\System32\GroupPolicy\Machine\Scripts\scripts1.ini"

I got confused. It didn't even create the nonexistent scripts1.ini. I just updated AutoIt to the newest version 3.3.14.1, maybe there's a difference?
The help file claimed: "If the file does not already exist, it is created so long as the directory exists.", but it doesn't!

Not sure what I'm missing.

Greets
Natulux

Posted (edited)

Sure, here you go:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\Programmierung\MyProjects\AutoIt\ATOSS_FavMan\FavManStartup.au3" /UserParams    
+>17:21:58 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0   Keyboard:00000407  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0407)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\MKramer\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\MKramer\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.1)  from:C:\Program Files (x86)\AutoIt3  input:D:\Programmierung\MyProjects\AutoIt\ATOSS_FavMan\FavManStartup.au3
+>17:21:58 AU3Check ended.rc:0
>Running:(3.3.14.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Programmierung\MyProjects\AutoIt\ATOSS_FavMan\FavManStartup.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>17:22:00 AutoIt3.exe ended.rc:0
+>17:22:00 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 2.479

"FavManStartup.au3" is the .au3 file with your code without any changes. You can see the results of the debugger console above.
I can't see, why it wouldn't do something...

Script.ini is empty.

Regards
Natulux

EDIT: I added admin rights, to be sure. Didn't help:
 

#RequireAdmin
If IsAdmin() Then MsgBox($MB_SYSTEMMODAL, "", "The script is running with admin rights.")

 

Edited by Natulux
Posted

then i would cut short the code simply to its bones here it is:

#requireadmin
$fini = "C:\Windows\System32\GroupPolicy\Machine\Scripts\scripts.ini"
IniWrite($fini,"Startup","0CmdLine","E:\FavMan_AktuellesRelease\ATOSS-FavoritenManager.exe")
IniWrite($fini,"Startup","0Parameters","")

This would write the script.ini after running this code check wether the script.ini is empty

No matter whatever the challenge maybe control on the outcome its on you its always have been.

MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)

Posted

Yes, I will try that tomorrow.
There must be a reason, why IniWrite() resisted my efforts though. I will tell you, if I succeed.

Natulux

Posted

Well according do the console output you posted you are running x86 AutoIt on x64 Windows, that means you would be opening the file in WysWOW64 not System32.

File System Redirector

Either make sure you are using x64 with #AutoIt3Wrapper_UseX64=y or work around it with \Sysnative folder. You probably shouldn't mess around with Wow64DisableWow64FsRedirection() if you don't know what you're doing.

Posted

Hello AdmiralAlkex,

I'm not sure if I understand that. I mean, how does x86 AutoIt influence, where the ini file should be edited, when I give a full path?
 

$fini = "C:\Windows\System32\GroupPolicy\Machine\Scripts\scripts.ini"
IniWrite($fini,"Startup","0CmdLine","E:\FavMan_AktuellesRelease\ATOSS-FavoritenManager.exe")

Nevertheless,
 

C:\Windows\SysWOW64\GroupPolicy

is empty and that would explain, why IniWrite() doesn't like to create a file.

When I am adding my script to the Group Policy by hand, my OS adds an entry to the
 

C:\Windows\System32\GroupPolicy\Machine\Scripts\scripts.ini

though.

Surya, even the plain code you gave me doesn't work. The ini file stays empty. I sense that IniWrite() has some kind of problem...

Kind regards,
Natulux
 

Posted
  On 8/26/2015 at 6:25 AM, Natulux said:

Hello AdmiralAlkex,

I'm not sure if I understand that. I mean, how does x86 AutoIt influence, where the ini file should be edited, when I give a full path?

Because x86 apps are redirected to the x86 System folder and vice versa. See the link in my previous post.

Posted

Hello again AdmiralAlkex,

I'm very sorry and you are right. I should have checked that link first.
My command really is redirected to
 

C:\Windows\SysWOW64\GroupPolicy\Machine\Scripts

and the scripts.ini now correctly displays

[Startup]
0CmdLine=E:\FavMan_AktuellesRelease\ATOSS-FavoritenManager.exe
0Parameters=

with either of Suryas samples.

When using

#AutoIt3Wrapper_UseX64=y

as suggested, I really am able to write to system32 though.

I guess I'm happy now! :-)
Thank you both, I've learned quite a lot here.

Yours sincerely
Natulux

Posted (edited)

At last here is the (slightly edited) code I used with success:

  Reveal hidden contents

I added a Regestry startup entry with a link to my script and a routine to check, if my script has already been added to the ini file.

Have a great time
Natulux

Edited by Natulux

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
×
×
  • Create New...