Jump to content

Path Issue When Integrating AutoIt3


Recommended Posts

Ok, so what I'm trying to do is integrate AutoIt3.exe into my windows installation source for my corporate network. I would like to keep it clean and minimal, meaning no shortcuts or extra's...just the bare essentials. From what I know about it, all that is required is the the main AutoIt3.exe, but I've also included the help file too.

So what I have done is taken the registry settings for the file associations and inserted them into the HIVECLS.INF of the installation source. The source is Windows XP Pro with SP2. If you don't know, there are several HIVE***.INF files in the source that are used during setup to create the registry. HIVECLS.INF handles things in the HKCR, which is where file associations happen. I've got two entries, one for opening with AutoIt3 and the other to edit with Notepad.

Here's the code:

HKCR,".au3","",0x00000000,"AutoIt3"

HKCR,"AutoIt3","",0x00000000,""
HKCR,"AutoIt3","BrowserFlags",0x00010001,0x00000008
HKCR,"AutoIt3","EditFlags",0x00010001,0x00000000
HKCR,"AutoIt3\DefaultIcon","",0x00000000,"C:\WINDOWS\system32\AutoIt3.exe,0"
HKCR,"AutoIt3\Shell","",0x00000000,"Open"
HKCR,"AutoIt3\Shell\Open\Command","",0x00000000,"C:\WINDOWS\system32\AutoIt3.exe %1"
HKCR,"AutoIt3\Shell\Edit\Command","",0x00000000,"C:\WINDOWS\notepad.exe %1"

I put AutoIt3.exe and AutoIt3.chm into the correct $OEM$ folders and they copy over during installation.

Now that works fine, after installation I can double-click or call au3 files and it will process it or I can right-click and edit it.

The problem is when I try to run a script from the desktop. Instead of running it says:

Error reading the file:

C:\Documents

So it looks like it's tripping up on spaces in the pathname...but I don't know why? If I move the file to a location that doesn't have a space it works like expected. Any ideas?

Hmmm...as I'm writting this I'm looking at the code and wondering if I need to enclose the %1 with "". I'll try that and see, but other than that I have no idea. I just checked the edit line, which also has the %1 without "" and it works fine to edit from the desktop...

Also, if anyone knows of a better way to do this that would be great. I don't mind getting dirty in editing stuff obviously, but I want something clean and transparent for the most part. Thanx in advance!

Oh, and I forgot to mention I'm doing this using the latest beta of AutoIt3, 3.1.133 at the time of this posting.

Edited by inthewayboy
Link to comment
Share on other sites

Well it looks like enclosing the %1 with "" does the trick...I changed the registry on the machine I'm testing on and it works, so I'm going to try this code:

HKCR,".au3","",0x00000000,"AutoIt3"

HKCR,"AutoIt3","",0x00000000,""
HKCR,"AutoIt3","BrowserFlags",0x00010001,0x00000008
HKCR,"AutoIt3","EditFlags",0x00010001,0x00000000
HKCR,"AutoIt3\DefaultIcon","",0x00000000,"C:\WINDOWS\system32\AutoIt3.exe,0"
HKCR,"AutoIt3\Shell","",0x00000000,"Open"
HKCR,"AutoIt3\Shell\Open\Command","",0x00000000,"C:\WINDOWS\system32\AutoIt3.exe ""%1"""
HKCR,"AutoIt3\Shell\Edit\Command","",0x00000000,"C:\WINDOWS\notepad.exe ""%1"""

And then I'll see what happens...hehe, sometimes it's the simpliest things. I wonder though why the edit command works without the "" but the open command doesn't...any thoughts?

Link to comment
Share on other sites

Release version 3.2 is out so you may want to use that instead.

AutoIt code example, use double quotes to help with spaces in paths.

RegWrite('HKLM\SOFTWARE\AutoIt v3\AutoIt\Run\Command', '', 'Reg_sz', '"' & @ProgramFilesDir & '\AutoIt3\AutoIt3.exe" "%1" %*')

Windows likes double quotes with space in paths, as without, you may get a warning meesage when you try to go into folder options...File Types like the messagebox with v3.2 I just induced to happen.

---------------------------

File Types

---------------------------

The specified program could not be found. Make sure the file name and path are correct.

---------------------------

OK

---------------------------

Link to comment
Share on other sites

Oh wow, it's been so long since a new release I never even checked that...sweet! I'll nab that and swap out the files!

As far as what you are suggesting MHz I think we are talking about the same thing, but I am trying to do this from the source and not through a script, so would my adjusted code in the second post work? It looks like it's the same as yours (Converted) but you added a %* to it...what's that for? Is that a way to pass info to the script from a command arguement or something?

Link to comment
Share on other sites

Also, since you are very well versed at both, would this scenario be any problem when it comes time to update AutoIt? From what I've seen it's pretty clean, to the point where I could just copy over the newer AutoIt3.exe and all is well.

And I forgot to mention I do copy over the "Includes" folder, which ends up at C:\WINDOWS\system32\Includes. Again, when upgrade time comes just replace the files in there with the newer versions and that's all?

Link to comment
Share on other sites

Sounds good. I also keep AutoIt in the systems path in a folder I call SystemFiles, and I have no issues, but my contextmenu still points to the installed version. Yours will be fine so long as you do not install AutoIt3 later else your reg entries will be overwritten, but for just using say the zip version and replacing the files should be quite fine.

Edited by MHz
Link to comment
Share on other sites

I seem to recall in my research into the inf portion that the %* is something special...something cryptic I'm sure. I'll see if I can't dig it up again, but it had to do with parameters, and the %* was kinda like a catch-all.

And in the mean time the installation has finished and all is well. The final code is:

HKCR,".au3","",0x00000000,"AutoIt3"

HKCR,"AutoIt3","",0x00000000,""
HKCR,"AutoIt3","BrowserFlags",0x00010001,0x00000008
HKCR,"AutoIt3","EditFlags",0x00010001,0x00000000
HKCR,"AutoIt3\DefaultIcon","",0x00000000,"C:\WINDOWS\system32\AutoIt3.exe,0"
HKCR,"AutoIt3\Shell","",0x00000000,"Open"
HKCR,"AutoIt3\Shell\Open\Command","",0x00000000,"C:\WINDOWS\system32\AutoIt3.exe ""%1"""
HKCR,"AutoIt3\Shell\Edit\Command","",0x00000000,"C:\WINDOWS\notepad.exe ""%1"""

Of course now that there looks to be a portable SciTE with the new version I think I might try including that too.

Link to comment
Share on other sites

Of course now that there looks to be a portable SciTE with the new version I think I might try including that too.

Yeah, that is the SC1 version of Scite that has the scilexer and property file builtin. You can still add property files in the same directory as it to overrule the inbuilt settings if wanting to customize alittle more.
Link to comment
Share on other sites

Well it's tricky, because I really love Notepad2, but I can't for the life of me figure out how to get it to recognize the AutoIt lexer. So I keep SciTE around for that, but I'm really starting to think about moving over to using just SciTE. And now that it doesn't look so complicated (Just the app and the api folder) I might do it.

Link to comment
Share on other sites

Scite is the cream choice for editing AutoIt3 scripts. I adopted NotePad++ a few weeks ago to help with text files ofcourse, but to act as a second editor so I can have Scite and Notepad++ side by side and also NotePad++ has a dual veiw mode which I have not used much, but maybe useful. I added the xml file for Notepad++ in the Idea forum just before for v3.2 syntax if you want it. Just add it to %AppData%\Notepad++ directory.

Link to comment
Share on other sites

  • Developers

Well it's tricky, because I really love Notepad2, but I can't for the life of me figure out how to get it to recognize the AutoIt lexer. So I keep SciTE around for that, but I'm really starting to think about moving over to using just SciTE. And now that it doesn't look so complicated (Just the app and the api folder) I might do it.

I looked at this before and if I remember well they hardcoded the lexers inside Notepad2.

You need to reference to the AU3 lexer (lexer number 60) in some sort of way. Internal name is SCLEX_AU3.

Do you mean Notepad2 or Notepad++ ?

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yeah sorry for the mention of the other Notepad... Easy mixup :whistle: . I also have VbsEdit for it's code snippets for VBS with WMI also. Has a nice side pane also for selecting objects, methods etc. Very nice for creating some code and then doing a convertion to AutoIt syntax. The no timeout evalutation copy works fine, just a nag screen at startup which an automation script can take care of and the MS debugger is not needed anyway.

Edit:

I am using NotePad++, not Notepad2.

Edited by MHz
Link to comment
Share on other sites

  • Developers

Notepad2...and yeah, it looked like you needed to recomile it or something and that's when I gave up. Otherwise it's a sweet light-weight single-file replacement for Notepad.

The latest version of AutoIt3 (3.2) includes a 1 file SciTE version.. stripped from all the extra's...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Administrators

Notepad2...and yeah, it looked like you needed to recomile it or something and that's when I gave up. Otherwise it's a sweet light-weight single-file replacement for Notepad.

I did a version of that and we were going to use it in the installer, but JdeB got a single file version of scite working instead.
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...