AutoHotkey Community

It is currently May 25th, 2012, 8:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Replacing if - else
PostPosted: February 4th, 2005, 11:41 am 
Offline

Joined: February 3rd, 2005, 12:05 pm
Posts: 10
Hello

I have still problems understanding AutoHotKey

I tried to replace
Code:
if A_Index = 1
   X = %A_winDir%\Temp\*.*
      else if A_Index = 2
      X = %userprofile%\Lokale Einstellungen\Temp\*.*
with
Code:
dirs = %A_winDir%\Temp\*.*,%userprofile%\Lokale Einstellungen\Temp\*.*
and then
Code:
Loop,parse,dirs,`,
{
   Loop,%Dirs%,1,1
   FileRemoveDir,%A_LoopFileFullPath%,1
   FileDelete,%Dirs%
   }


This is not working - Could anybody tell me why?

Ore is there another way to replace 5 or 6 if - else like the above one with a shorter solution?

Andy


Report this post
Top
 Profile  
Reply with quote  
 Post subject: wrong variable
PostPosted: February 4th, 2005, 12:21 pm 
Offline

Joined: April 23rd, 2004, 4:38 am
Posts: 34
Location: Adelaide, South Australia
Hi a_clauss

It looks like you're trying to clean out some folders... try this.

Code:
Loop,parse,dirs,`,
{
  Loop,%A_LoopField%,0,1
    FileRecycle,%A_LoopFileFullPath% ; This is safer than FileDelete!
  Loop,%A_LoopField%,2,0
    FileRemoveDir,%A_LoopFileFullPath%,1 ; delete sub-folders
}


Caution! Just made this up, not actually tested.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: I Think I made ist
PostPosted: February 4th, 2005, 12:28 pm 
Hi Everybody

I think I found a solution, which is short and working. I will post it in the scripts forum.

Again thanks for the support

Andy


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, just me, SKAN, Yahoo [Bot] and 70 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group