Three problems

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

Three problems

Post by alemrantareq » Tue Nov 18, 2008 11:36 am

Hi everybody, pls solve my three problems in detail.

1. How to make a timed dialog message which will automatically closed after 5 seconds. Is that possible with answer command?

2. In "autorun.inf" file, there may be written "open=autorun.exe" or "open=myFile.txt" or "open=Readme.pdf" etc. I need to verify what filename is written after "open=" and to delete that file. What'll be the script? Is it possible with lineoffset function?

3. How to delete only the hidden files from a directory?

Pls, help me...

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Nov 18, 2008 12:17 pm

Hi tareq,

1. Yes you could use the answer dialog (and any other stack):
Create another handler in the same script or in the message hierarchy that will close the dialog and "send" this handler in X seconds:

...
send "close_dialog" to me in 5 secs
answer "This dialog will self-destruct in 5 seconds!"
...

command close_dialog
if "Answer dialog" is in the openstacks then
close stack "Answer dialog"
end if
end close_dialog

## Tested and works!


2. and 3. see the Rev-list :-)


Best from germany

Klaus

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Tue Nov 18, 2008 12:44 pm

For problem 2 and 3, I need clearcut solution. Pls...

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Nov 18, 2008 1:17 pm

What exactly is not clear enough in my answers to 2 and 3 on the Rev list?

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Tue Nov 18, 2008 9:04 pm

Yes, can you please make my program for me Klaus? please! :-)

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Nov 18, 2008 9:06 pm

Garrett wrote:Yes, can you please make my program for me Klaus? please! :-)
LOL :-D

Well, something like this was also in my mind ;-)

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Wed Nov 19, 2008 7:11 am

What do you mean by rev list?

Is it http://lists.runrev.com/ or http://www.mail-archive.com/ ????

Give me the link, pls................. :cry:

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Nov 19, 2008 9:30 am

Oh geeez!

You posted a mail to the "How to use Revolution" mailing list (use-revolution@lists.runrev.com) yesterday and I replied to your mail on the same list. What's the matter with you?


Regards

Klaus

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Thu Nov 27, 2008 9:54 am

Hi klaus,

Thanks for your replies. Your solution for no. 1 really works. For solution no. 2 & 3, I've reviewed the use-revolution archives as your suggestion. But it takes long times. I'll be very thankful if you provide the exact month & subject name. pls, pls ... :D

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Nov 27, 2008 2:39 pm

It was exactly 22 minutes after your post and had the same subject as your post only with "Re:" in front of it.

Hint:
Check the docs before you post here. (e.g. default cursor!)

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Sat Nov 29, 2008 7:32 am

Hi Klaus,
Thanks for your reply. I've two files "autorun.inf" and "test.exe" in D: drive and "open=test.exe" is written in the autorun file. I made a script for a btn -

Code: Select all

on mouseUp
put "D:/autorun.inf" into my_file
put url ("file:" & my_file) into my_autorun
put lineoffset("open=", my_autorun) into tLine
if tLine <> 0 then
    put line tLine of my_autorun into my_line
    replace "open=" with "" in my_line
    delete file my_line
end if
end mouseUp
This code doesn't work to delete that file. Is there any mistake or I've to do more?

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Sat Nov 29, 2008 3:29 pm

Unless you specify a full path "D:/test.exe" the 'delete file' commadn will look for a file "test.exe" in the 'defaultFolder' - usually the directory of your standalone executable, or while you're in the IDE, the directory where Revolution is installed.

So I would go for something like:

Code: Select all

put "D:/" into theDirectory
put theDirectory & "autorun.inf" into theAutorunFile
put URL ("file:" & theAutorunFile into theAutorunData
repeat for each line theLine in theAutorunData
  if theLine begins with "open=" then
    put theDirectory & char 6 to -1 of theLine into theFileToDelete
    delete file theFileToDelete
    exit repeat
  end if
end repeat
Note that you can only delete files if the user has the right privileges to do so, and you won't be able to delete files from read-only media like CDs or DVDs.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Sun Nov 30, 2008 8:32 am

Hi Janschenkel,
Thanks for your reply. I solved my problem last night. I made the script-

Code: Select all

on mouseUp
put "D:/autorun.inf" into my_file
put url ("file:" & my_file) into my_autorun
put lineoffset("open=",my_autorun) into tLine
if tLine <> 0 then
    put line tLine of my_autorun into my_line
    replace "open=" with "" in my_line
    put "D:/" & my_line into tpath
    if there is a file tpath then
      delete file tpath
    end if
end if
end mouseUp
This script works nicely. And your scripts too. Thanks again.

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Mon Dec 01, 2008 7:09 am

Hi Janschenkel,

sorry to infrom you that when I try to apply your script, it shows a error message " if: missing 'then' " at the line (if theLine begins with "open=" then"). Why its happen? Doesn't this error show you?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Dec 01, 2008 10:33 am

Hi alemrantareq,

Probably, you have an older version of Revolution, which doesn't understand "begins with".

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

Post Reply