Sign in to follow this  
Followers 0
blitzkrg

Help - Dealing With Spaces

5 posts in this topic

#1 ·  Posted (edited)

I'm having the hardest time trying to detect a space.

I've been using aut 2 for about 1 1/2 years now and have become quite good at it.

I decided to write a script to do some folder/file management.

If I have the following folders

Test test - hello hello

blah-testfolder

I'm trying to segreate the front part from the back part.

i want to take hello hello and move it inside test test

and take testfolder and move it inside of blah

i can only do one or the other, i can get the 1st folder to work fine, but not the second, or i can get the 2nd line to work and not the 1st.

i'm doing this by searching for the "-" and doing an envsub 1 or (or not subbing a character)

what i want to do it detect teh space

but if i say ifinstring,search,, msgbox,0,info, a space was found

it doesnt work.

i've also tried ifequal,search,, msgbox,............. (etc etc)

i cant seem to detect that space..

any help is much apprechiated.

thanks

Edited by blitzkrg

Share this post


Link to post
Share on other sites



Have you tried to work with a variable which contains that space ?

SetEnv, A_Space, <-- here's a space char

MsgBox, 0, SpaceCheck, |%A_Space%|

.

.

.

IfEqual, search, %A_Space%, msgbox, 0, SpaceCheck, I've got it !

I guess the majority of the guys in this forum would recommend to use AutoIt3,

On the other hand AutoHotkey which is based on AutoIt2 provides an %A_Space% variable and is backward compatible with AutoIt2. It's up to you if A2/AHK/A3 should solve your issue. :D

Share this post


Link to post
Share on other sites

What was the reason to choose blitzkrg (Blitzkrieg) as your nick :D

Share this post


Link to post
Share on other sites

Thanks for the replies. While i was waiting i came up with a work around using atool.exe (found on the yahoo autoit groups website)

runwait,atool.exe FindString " " "%blah%" 0

ifequal,errorlevel,0,msgbox,0,FindString_Result,a space was found

ifnotequal,errorlevel,0,msgbox,0,FindString_Result,a space was not found

that works for me. however i didnt want to have to use an external program to get the job done. so will try your suggestions when i get home.

thanks!!!

As for my nick name.

Blitzkrieg as you may know is a german style of warfar (send everything at once - lightning wars) it's also a song by Metallica - Blitzkrieg

back in the day when i was on the net, long before ppp and the web, all i had was a unix shell account with my 19.2 modem. and you could only have 8 characters.. so i shortened it to blitzkrg

ironically - my entire family is pure english blood..

go figure :D

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Larry: your fix worked perfectly..

thanks!!!!!!!!

here's what i did with it

checkme:

SetEnv, check, * *

StringMid,blah1,bna,%dash%,1

IfEqual, check,*%blah1%*,goto, spaces

IfnotEqual, check,*%blah1%*,goto, nospaces

it now branches properly!! woohoo!!!

Edited by blitzkrg

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0