Sign in to follow this  
Followers 0
inspector

DirCreate

7 posts in this topic

Hello, I am new to Autoit and am not a programmer. I am trying to create a dir in a script but it does not work.

If I try the DirCreate in a simple 2 line script it works!

CODE
$name = ClipGet()

DirCreate ("C:\Documents and Settings\Owner.CSI\Desktop\Inspections\Reports\" & $name )

Any suggestions?

The ^r runs a macro in openoffice

The message box gives me the correct name

CODE
Run("C:\Program Files\OpenOffice.org 2.2\program\scalc.exe AppointmentSheet.ods","C:\Documents and Settings\Owner.CSI\Desktop\Inspections\")

WinWaitActive("AppointmentSheet - OpenOffice.org Calc")

Send("^r")

MsgBox(0, "Wait for response", "Continue")

WinActivate("AppointmentSheet - OpenOffice.org Calc")

Send("{Down 20}")

Send("^c")

Sleep(500)

$name = ClipGet()

MsgBox(0, "The value is:", $name)

DirCreate ("C:\Documents and Settings\Owner.CSI\Desktop\Inspections\Reports\" & $name )

Share this post


Link to post
Share on other sites



Um... What does $name actually contain? Because they are characters not allowed in folders...

Its an address "123 Nice Street" and it works fine if I run those two lines alone in its own script, but if its in the complete script it doesn't work.

Share this post


Link to post
Share on other sites

Its an address "123 Nice Street" and it works fine if I run those two lines alone in its own script, but if its in the complete script it doesn't work.

Look at ControlGetText () and ControlClick ().

Share this post


Link to post
Share on other sites

Look at ControlGetText () and ControlClick ().

I don't see how this would help, but maybe its just me being a newbie. The thing that I find strange is that the dirCreate works fine if I run it alone as is, it will create the dir with the last copied item in the clipboard. Is there some coding mistake I'm making in combination with the rest of the script?

Share this post


Link to post
Share on other sites

Anyone have any idea why this doesn't work?

Share this post


Link to post
Share on other sites

Its a little hard to say without knowing exactly what $name contains but the trick is to 'debug' your script replacing/modifying what could be affecting it until you know whats going wrong. For example, if you remove $name from the DirCreate and replace it with the exact path you want to create does it work then? If so you know there is a problem with $name.

What does it look like if you do MsgBox(0, "", "C:\Documents and Settings\Owner.CSI\Desktop\Inspections\Reports\" & $name )? Its possible an extra space or \ is messing you up.

Take Bert's adivce though and read up on ControlClick and ControlGetText. Even if it has nothing to do with why this isn't working coding with a lot of Send commands has a lot of potential for failure.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

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