MSFN Forum: AutoIT help please? - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

AutoIT help please? Rate Topic: -----

#1 User is offline   Mekrel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 372
  • Joined: 17-November 04

Posted 16 September 2006 - 07:49 AM

Hi, im trying to make a global command file launcher using AutoIT, I want it to just search for files and then pass them into the run command which hides the command files from launching.

I've got it working on a test setup, kinda. It the command files have not got a space in their name then they will get executed and run, but if they have they won't. I'm sure it is just to do with the run command and the placing of quotes so that the run command ends up having speech marks enclosing the command.

$search = FileFindFirstFile("*.cmd")  

While 1
	$file = FileFindNextFile($search) 
	If @error Then ExitLoop
	
	Run("cmd.exe /c '" & $file & "'", "", @SW_HIDE)
WEnd

; Close the search handle
FileClose($search)


Any help will be appreciated!


#2 User is offline   MHz 

  • SendToA3X v1.7
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,634
  • Joined: 02-August 04

Posted 16 September 2006 - 11:08 PM

You may have better luck with this
$search = FileFindFirstFile('*.cmd')  
If $search <> -1 Then
	While 1
		$file = FileFindNextFile($search) 
		If @error Then ExitLoop
		RunWait(@ComSpec & ' /c "' & $file & '"', '', @SW_HIDE)
	WEnd
	FileClose($search); Close the search handle
EndIf

ComSpec likes double quotes, not singles, so using single quotes by default and use double quotes as needed within the string works well.

:)

Also while I'm here, some other variations.

For au3 files (use AutoIt v3.2.0.1 or later)
$search = FileFindFirstFile('*.au3')  
If $search <> -1 Then
	While 1
		$file = FileFindNextFile($search) 
		If @error Then ExitLoop
		If $file = @ScriptName Then ContinueLoop
		RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file & '"')
	WEnd
	FileClose($search); Close the search handle
EndIf

or a Multi-FileType
$search = FileFindFirstFile('*.*')  
If $search <> -1 Then
	While 1
		$file = FileFindNextFile($search) 
		If @error Then ExitLoop
		If $file = @ScriptName Then ContinueLoop
		Switch StringRight($file, 4)
			Case '.cmd'
				RunWait(@ComSpec & ' /c "' & $file & '"', '', @SW_HIDE)
			Case '.au3'
				RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file & '"')
			Case '.vbs'
				RunWait(@SystemDir & '\WScript.exe "' & $file & '"')
		EndSwitch
	WEnd
	FileClose($search); Close the search handle
EndIf


#3 User is offline   Mekrel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 372
  • Joined: 17-November 04

Posted 17 September 2006 - 02:46 AM

Thanks very much, they work great :)

Knew either you or Nologic would come to my rescue sooner or later.

I'm doing this so that I just add the compiled script to cmdlines.txt and then throw any batch files into said directory and I won't have to update anything.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy