Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Thu May 27, 2010 4:34 am
Hi everybody, I've made a script to handle the command prompt messages -
Code: Select all
on mouseUp
set the hideconsolewindows to true
get shell("ren c:\test myTest")
if the result is "The system cannot find the file specified." then
answer "Error"
else
answer "Renamed successfully!"
end if
end mouseUp
The problem is that it always answers "Renamed successfully!" whether the folder "test" exists in C: drive or not. I just can't understand what wrong I made. Someone pls, help me correcting this script. Thanks in advance..........

-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu May 27, 2010 9:41 am
alemrantareq,
Probably, there is a return character at the end of the returned string. Try
Code: Select all
if the result contains "The system cannot find the file specified." then
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Thu May 27, 2010 9:57 am
Thanks Mark for replying, but its not working......

-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Thu May 27, 2010 10:00 am
Sorry, alemrantareq, I forgot to add that you need to replace "the result" with "it". If that still doesn't work, then you need to post the complete output.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Thu May 27, 2010 10:20 am
WOW ! it really works perfect ! Thanks a lot
Mark.........Cheers !!!

-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Sat May 29, 2010 1:40 pm
Sometimes cmd seeks permission like [Y/N] where we need to press Y and Enter to complete the task. For example, for fixing drive error, we type "chkdsk [drivename:] /f" which sometimes ask [Y/N] type permission to dismount that drive. As we hide the console windows before working with command prompt, how can I handle that [Y/N] situation?
-
Janschenkel
- VIP Livecode Opensource Backer

- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
-
Contact:
Post
by Janschenkel » Mon May 31, 2010 9:26 pm
In that case, you shouldn't use the shell function, but opt for a combination of the open process, read from process, write to process and close process commands. This will allow you to exchange data with a separate command-line process.
HTH,
Jan Schenkel.
-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Tue Jun 01, 2010 3:34 am
Hi
Janschenkel, thanks for giving me the idea but I can't figure it out properly. For example, I wrote -
And then, it asks me to input the current label of the drive. I know the label of it but I just want to know how can I input the label without showing the command prompt window. Please, do me a fever giving a sample for it.
-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Wed Jun 02, 2010 2:08 pm
I'm stuck with my project and can't continue until I get a sample of my last reply. Pls, someone help me.......pls.

-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Sun Jun 06, 2010 8:11 pm
It has been a long time that no one could give me a sample. So my pals, I think I should reject my project, right?

-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Sun Jun 06, 2010 8:24 pm
alemrantareq,
What you want might be possible, but it takes me too much time to work it out. An alternative might be to write a VBScript. You could ask on the VBScript newgroup.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Mon Jun 07, 2010 3:13 pm
Dear
Mark, your reply made me pleased ! I've made a deep search on VBScript, but nothing found fruitful. I thank you to work on it & I'm patient for your reply.........

-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Mon Jun 07, 2010 3:22 pm
Hi alemrantareq ,
As I wrote, you should not ask here. Ask on the VBScript newsgroup instead.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
alemrantareq
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Post
by alemrantareq » Tue Jun 08, 2010 4:11 am
I've asked on the VBScript newsgroup and got a reply.
Click Here to see it.
As I've no knowledge on VBScript, please someone help me explaining the vbscript. I mean where I've to make changes and how, where I should input [Y/N] or [Enter] where the console windows prompts for [Y/N] or [Enter], so that I can hide the console windows, and how to apply it in rev.ent. Please...........
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Wed Jun 16, 2010 12:07 pm
Hi alemrantareq,
Apparently, you can execute the command as one line:
echo [YourLabel]| convert [drivename]: /fs:ntfs
In Revolution, you can use the shell() function:
Code: Select all
get shell("echo [YourLabel]| convert [drivename]: /fs:ntfs")
Read Tom's messages to find out what to replace the strings in brackets with.
Best regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode